consumeCoupon
POST
/v2/coupons/consume
const url = 'https://api-crm-staging.divinea.com/api/v2/coupons/consume';const options = { method: 'POST', headers: {APIKey: '<APIKey>', 'Content-Type': 'application/json'}, body: '{"code":"example","couponRule":{"coupon":{"active":true,"code":"example","couponRules":[{"coupon":{},"createdAt":"2026-04-15T12:00:00Z","entityId":"example","entityType":"example","id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","rules":{},"updatedAt":"2026-04-15T12:00:00Z"}],"createdAt":"2026-04-15T12:00:00Z","discountCents":1,"discountPercent":1,"discountType":"percent","endAt":"2026-04-15T12:00:00Z","id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","minimumOrderCents":1,"startAt":"2026-04-15T12:00:00Z","type":"RESERVATION","updatedAt":"2026-04-15T12:00:00Z","useCount":1,"useMax":1,"useMaxByEmail":1,"winery":{"createdAt":"2026-04-15T12:00:00Z","id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","name":"example","updatedAt":"2026-04-15T12:00:00Z"}},"createdAt":"2026-04-15T12:00:00Z","entityId":"example","entityType":"example","id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","rules":{},"updatedAt":"2026-04-15T12:00:00Z"},"email":"example","purchaseId":"example","purchaseType":"RESERVATION","saleEntities":[{"amountCentsAfterDiscount":1,"amountCentsBeforeDiscount":1,"amountCentsPerUnitAfterDiscount":1,"amountCentsPerUnitBeforeDiscount":1,"discountCents":1,"entityId":"example","entityType":"example","quantity":1}],"totalAmountCentsBeforeDiscount":1,"wineryId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api-crm-staging.divinea.com/api/v2/coupons/consume \ --header 'APIKey: <APIKey>' \ --header 'Content-Type: application/json' \ --data '{ "code": "example", "couponRule": { "coupon": { "active": true, "code": "example", "couponRules": [ { "coupon": {}, "createdAt": "2026-04-15T12:00:00Z", "entityId": "example", "entityType": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "rules": {}, "updatedAt": "2026-04-15T12:00:00Z" } ], "createdAt": "2026-04-15T12:00:00Z", "discountCents": 1, "discountPercent": 1, "discountType": "percent", "endAt": "2026-04-15T12:00:00Z", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "minimumOrderCents": 1, "startAt": "2026-04-15T12:00:00Z", "type": "RESERVATION", "updatedAt": "2026-04-15T12:00:00Z", "useCount": 1, "useMax": 1, "useMaxByEmail": 1, "winery": { "createdAt": "2026-04-15T12:00:00Z", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "updatedAt": "2026-04-15T12:00:00Z" } }, "createdAt": "2026-04-15T12:00:00Z", "entityId": "example", "entityType": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "rules": {}, "updatedAt": "2026-04-15T12:00:00Z" }, "email": "example", "purchaseId": "example", "purchaseType": "RESERVATION", "saleEntities": [ { "amountCentsAfterDiscount": 1, "amountCentsBeforeDiscount": 1, "amountCentsPerUnitAfterDiscount": 1, "amountCentsPerUnitBeforeDiscount": 1, "discountCents": 1, "entityId": "example", "entityType": "example", "quantity": 1 } ], "totalAmountCentsBeforeDiscount": 1, "wineryId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Authorizations
Sezione intitolata “Authorizations”Request Body
Sezione intitolata “Request Body”Body
Media typeapplication/json
ConsumeOrValidateCouponRequest
object
code
string
couponRule
CouponRule
object
coupon
Coupon
object
active
boolean
code
string
couponRules
Array<object>
CouponRuleobject
coupon
object recursive
createdAt
string format: date-time
entityId
string
entityType
string
id
string format: uuid
rules
object
updatedAt
string format: date-time
createdAt
string format: date-time
discountCents
integer format: int64
discountPercent
integer format: int32
discountType
string
endAt
string format: date-time
id
string format: uuid
minimumOrderCents
integer format: int64
startAt
string format: date-time
type
string
updatedAt
string format: date-time
useCount
integer format: int32
useMax
integer format: int32
useMaxByEmail
integer format: int32
winery
Winery
object
createdAt
string format: date-time
id
string format: uuid
name
string
updatedAt
string format: date-time
createdAt
string format: date-time
entityId
string
entityType
string
id
string format: uuid
rules
object
updatedAt
string format: date-time
email
string
purchaseId
string
purchaseType
string
saleEntities
Array<object>
SaleEntityobject
amountCentsAfterDiscount
integer format: int64
amountCentsBeforeDiscount
integer format: int64
amountCentsPerUnitAfterDiscount
integer format: int64
amountCentsPerUnitBeforeDiscount
integer format: int64
discountCents
integer format: int64
entityId
string
entityType
string
quantity
integer format: int32
totalAmountCentsBeforeDiscount
integer format: int64
wineryId
string format: uuid
Responses
Sezione intitolata “Responses”OK
Media type*/*
CouponUtilizationResult
object
coupon
Coupon
object
active
boolean
code
string
couponRules
Array<object>
CouponRuleobject
coupon
Coupon
object
active
boolean
code
string
couponRules
Array<object> recursive
createdAt
string format: date-time
discountCents
integer format: int64
discountPercent
integer format: int32
discountType
string
endAt
string format: date-time
id
string format: uuid
minimumOrderCents
integer format: int64
startAt
string format: date-time
type
string
updatedAt
string format: date-time
useCount
integer format: int32
useMax
integer format: int32
useMaxByEmail
integer format: int32
winery
Winery
object
createdAt
string format: date-time
id
string format: uuid
name
string
updatedAt
string format: date-time
createdAt
string format: date-time
entityId
string
entityType
string
id
string format: uuid
rules
object
updatedAt
string format: date-time
createdAt
string format: date-time
discountCents
integer format: int64
discountPercent
integer format: int32
discountType
string
endAt
string format: date-time
id
string format: uuid
minimumOrderCents
integer format: int64
startAt
string format: date-time
type
string
updatedAt
string format: date-time
useCount
integer format: int32
useMax
integer format: int32
useMaxByEmail
integer format: int32
winery
Winery
object
createdAt
string format: date-time
id
string format: uuid
name
string
updatedAt
string format: date-time
couponCode
string
discountTotalCents
integer format: int64
message
string
saleEntities
Array<object>
SaleEntityobject
amountCentsAfterDiscount
integer format: int64
amountCentsBeforeDiscount
integer format: int64
amountCentsPerUnitAfterDiscount
integer format: int64
amountCentsPerUnitBeforeDiscount
integer format: int64
discountCents
integer format: int64
entityId
string
entityType
string
quantity
integer format: int32
success
boolean
totalAmountCentsAfterDiscount
integer format: int64
totalAmountCentsBeforeDiscount
integer format: int64
wineryId
string format: uuid