Coupons
Within NeoDay, coupons can be earned either as rewards for participating in campaigns or as products sold in the reward shop.
Notifying NeoDay of Used Coupons
When coupons are processed by an external system, you may want to notify us when a coupon is consumed. This will make sure the coupon shows up as such in our UI and will allow you to configure campaigns that react to the consumption of a coupon.
Coupons can have two types of "Ticket Issuers":
- Predefined Code
- Unlimited Single Code
Depending on the "Ticket Issuer" assigned to a coupon, the appropriate endpoint must be used.
Consuming a Predefined Code Coupon
When uploading the codes in the backoffice, you must set a reference
that you will use in the API call to signal the consumption of a coupon. To mark a predefined code as consumed, make a POST
request to /api/1/coupon/predefined-code/consume
. The endpoint requires two parameters: the consumed code
and the reference
you defined in the backoffice.
POST /api/1/coupon/predefined-code/consume?locale=en_GB HTTP/1.1
Host: gateway.acme.neo.day
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9........
Content-Type: application/json
{
"code": "4-c03p0n-c0d3",
"reference": "my-coupon"
}
HTTP/1.1 200 OK
Consuming an Unlimited Single Code Coupon
To mark an unlimited single code as consumed, make a POST
request to /api/1/coupon/unlimited-single-code/consume
. The endpoint requires two parameters: the user_id
of the user consuming the coupon and the consumed code
.
POST /api/1/coupon/unlimited-single-code/consume?locale=en_GB HTTP/1.1
Host: gateway.acme.neo.day
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9........
Content-Type: application/json
{
"user_id": "gfi80lee86qbl98axhb7jboc4",
"code": "4-c03p0n-c0d3"
}
HTTP/1.1 200 OK