Adding a gift card or coupon
How to redeem a gift card or coupon by entering a code
Problem
You have a pending order and you want to give your customer the possibility to add a gift card or coupon code to the order so that they get the associated discount.
Solution
To add a gift card or coupon code to an order, send a PATCH
request to the /api/orders/:id
endpoint, setting the gift_card_or_coupon_code
attribute to the desired value. If an active gift card or coupon code matches that value — with at least the first 8 digits — the order amounts are updated according to the associated gift card balance or coupon discount.
In the unlikely event that both a gift card and a coupon code match the same code, the gift card takes precedence.
Example
The following request adds the gift card identified by the "GIFT1234-ABC" code to the order identified by the "NgojhKoyYN" ID:
Mapping
The image below shows how the related action during the checkout process is mapped to a specific attribute of the order object.
Additional notes
Separating the gift card and coupon fields
Using the gift_card_or_coupon_code
attribute is a convenient way of managing the most common use case, when you have just one field that can accept both types of code. In case you need to manage gift cards or coupon code fields separately, you can use the gift_card_code
or the coupon_code
attributes instead.
Removing a gift card or coupon code
In case you want to remove a gift card or coupon code from the order — resetting any applied discount — you need to send a blank value to either the gift_card_code
or coupon_code
field.
More to read
See our documentation if you need more information about the gift card object and its attributes or on how to update an order.
Last updated