POST /api/v4.0/integrations/coupons/{code}/validate
Changed onValidates a single coupon identified by {code} and checks its eligibility for use by a customer. Describe the cart as well, and the coupon is additionally matched against its rules - on merchant, branch, channel, collection, category, product, the line-item fields and extra data. Set the lock flag to True to reserve the coupon by creating a lock reference, so it cannot be used by others while the order is being completed. By default the lock flag is False, allowing only validation without reserving the coupon.
Request
- Base URLhttps://api.gameball.co
- AuthAPI key in header apikey and API key in header secretkey
Path parameters
The coupon code you want to validate. Compared case-insensitively.
Request body
Unique identifier for the customer that you can reference across the customer's whole lifetime. Could be a database ID, random string, email or anything that uniquely identifies the customer.
Customer's email address. Required if your account uses email-based channel merging.
Customer's mobile number. Required if your account uses mobile-based channel merging.
Indicates whether the request is intended to validate the coupon or to lock it for a future redemption.
Required only if the lock flag is set to True and you need to validate and lock a new or updated list of coupons within an existing lock session.
Represents the number of minutes for which a coupon will be locked if the lock flag is set to True.
Cart-level. The merchant the order is placed with. Required if the coupon is restricted to specific merchants.
Cart-level. The branch or outlet the order is placed at. Required if the coupon is restricted to specific branches. There is no plural or per-item form.
Cart-level. The sales channel the order is placed through. Read by a coupon's Channel rule.
Cart-level. Free-form order data, read by a coupon's Extra.<key> rules. The rule names the key path to read: Extra.paymentMethod reads extra.paymentMethod, and Extra.shipping.city reads the nested extra.shipping.city. Send each key exactly as it is spelled in the rule.
Item-level. A collection the basket touches. Evaluated together with collectionsIds as a single list. Ignored when lineItems is present.
Item-level. Every collection the basket touches. Maximum 200 values. Ignored when lineItems is present.
The cart described item by item. Maximum 500 entries. The only way to send categories and products. Required for any rule on a field with no flat form (category, product, title, price, quantity, discount, vendor, sku, tags, weight, extra, and the TotalItems and TotalUniqueItems totals), and for an AND coupon with two or more item-level rules. When lineItems is present, the flat collectionId and collectionsIds fields are ignored for matching.
Cart-level. The total value of the purchase the coupon will be applied to. Checked against the coupon's minOrderValue. Sending this field describes a cart only when the coupon carries a minOrderValue; for those coupons it switches on full restriction enforcement, and omitting it is rejected the same way a value below the minimum is.
Example request
{
"merchantId": "cairo-downtown",
"branchId": "branch-14",
"channel": "online",
"extra": {
"paymentMethod": "card"
}
}Response
Coupon validated successfully
Indicates whether the coupon is valid to be used by the customer or not.
A coupon as returned by the validate endpoints, including the rules it carries and how they combine. On a coupon configured with rules, the entitled* lists hold only the values of its Equals rules on merchant, branch, collection, category and product; read rules for the full picture.
The unique reference code associated with the coupon lock session.
The exact date and time when the coupon lock will expire.
Example response
{
"coupon": {
"rules": [
{
"name": "Price",
"operator": "GreaterThanOrEqual",
"matchValue": "100"
}
]
}
}Changes
- breaking
the response property
coupon/couponRulesLogicalOperatorbecame nullable for the status - breaking
the
coupon/couponRulesLogicalOperatorresponse's property type changed fromintegertostringnullfor status - warning
removed the request property
categories
18 more changes in this revision
- breaking