The Loyalty Coupons API allows you to create loyalty coupons when a customer redeems their loyalty points for loyalty rewards.
With the Loyalty Coupons API, you can:
It's important to note the following points before starting to code:
A loyalty coupon is created when a customer redeems their loyalty points for a reward. Creating a loyalty coupon also creates a corresponding "reference" coupon with the Coupons API.
Loyalty coupon ID.
Loyalty account ID of the customer that redeemed points for a coupon.
Member ID of the customer that redeemed points for a coupon.
Member ID of the customer that redeemed points for a coupon.
Transaction ID for the transaction that created a coupon.
Reference coupon information for the corresponding coupon that is created along with the loyalty coupon.
Loyalty coupon status.
This status relates to the corresponding coupon that is created
at the same time as the loyalty coupon and is included in couponReference
.
Name of reward that was redeemed to create this coupon.
Revision number, which increments by 1 each time the loyalty coupon is updated.
To prevent conflicting changes, the current revision
must be passed when updating the loyalty coupon.
Date and time the loyalty coupon was created.
Date and time the loyalty coupon was last updated.
{
"coupon": {
"id": "c90918b2-e9a5-4147-b4a4-953e235b9ddd",
"accountId": "bf14421a-0ccb-4656-a91f-84119e8fc994",
"memberId": "e64eee9f-ec4e-4c8a-b015-eb3be0b2761b",
"couponReference": {
"couponId": "e48b4b92-3481-40bf-943d-c9324ae3cd6d",
"code": "6Q1LC0K4KHSL",
"name": "Free shipping",
"specification": {
"type": "FREE_SHIPPING",
"freeShipping": true
}
},
"status": "PENDING",
"rewardName": "Free shipping",
"revision": "1",
"createdDate": "2024-04-18T15:07:53.639Z",
"updatedDate": "2024-04-18T15:07:53.639Z"
}
}
Redeems a customer's loyalty points for a loyalty reward and creates a loyalty coupon.
Creating a loyalty coupon also creates a corresponding "reference" coupon with the Coupons API.
The customer receives the reference coupon, which they can apply to their order. The loyalty coupon and its corresponding reference coupon
are linked and the loyalty coupon's status
reflects the current state of the reference coupon.
Check which loyalty rewards a site has available with List Rewards.
ID of the loyalty reward to redeem.
ID of the loyalty account of the customer redeeming points.
Created loyalty coupon.
curl -X POST \
'https://www.wixapis.com/loyalty-coupons/v1/coupons' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
--data-raw '{
"rewardId": "960d1ef4-80b8-4c87-8301-cda0c35b6b8d",
"loyaltyAccountId": "bf14421a-0ccb-4656-a91f-84119e8fc994"
}'
{
"coupon": {
"id": "c90918b2-e9a5-4147-b4a4-953e235b9ddd",
"accountId": "bf14421a-0ccb-4656-a91f-84119e8fc994",
"memberId": "e64eee9f-ec4e-4c8a-b015-eb3be0b2761b",
"couponReference": {
"couponId": "e48b4b92-3481-40bf-943d-c9324ae3cd6d",
"code": "6Q1LC0K4KHSL",
"name": "Free shipping",
"specification": {
"type": "FREE_SHIPPING",
"freeShipping": true
}
},
"status": "PENDING",
"rewardName": "Free shipping",
"revision": "1",
"createdDate": "2024-04-18T15:07:53.639Z",
"updatedDate": "2024-04-18T15:07:53.639Z"
}
}
Redeems a current customer's loyalty points for a loyalty reward and creates a loyalty coupon.
Creating a loyalty coupon also creates a corresponding "reference" coupon with the Coupons API.
The customer receives the reference coupon, which they can apply to their order. The loyalty coupon and its corresponding reference coupon
are linked and the loyalty coupon's status
reflects the current state of the reference coupon.
Check which loyalty rewards a site has available with List Rewards.
Note: This endpoint requires visitor or member authentication.
ID of the loyalty reward to redeem.
Created loyalty coupon.
curl -X POST \
'https://www.wixapis.com/loyalty-coupons/v1/coupons/redeem-my-coupon' \
-H 'Authorization: <AUTH>' \
-H 'Content-Type: application/json' \
--data-raw '{
"rewardId": "960d1ef4-80b8-4c87-8301-cda0c35b6b8d"
}'
{
"coupon": {
"id": "c90918b2-e9a5-4147-b4a4-953e235b9ddd",
"accountId": "bf14421a-0ccb-4656-a91f-84119e8fc994",
"memberId": "e64eee9f-ec4e-4c8a-b015-eb3be0b2761b",
"couponReference": {
"couponId": "e48b4b92-3481-40bf-943d-c9324ae3cd6d",
"code": "6Q1LC0K4KHSL",
"name": "Free shipping",
"specification": {
"type": "FREE_SHIPPING",
"freeShipping": true
}
},
"status": "PENDING",
"rewardName": "Free shipping",
"revision": "1",
"createdDate": "2024-04-18T15:07:53.639Z",
"updatedDate": "2024-04-18T15:07:53.639Z"
}
}
Retrieves a loyalty coupon.
You can only call this method when authenticated as a Wix app or Wix user identity.
ID of the loyalty coupon to retrieve.
Retrieved loyalty coupon.
curl -X GET \
'https://www.wixapis.com/loyalty-coupons/v1/coupons/c90918b2-e9a5-4147-b4a4-953e235b9ddd' \
-H 'Authorization: <AUTH>'
{
"coupon": {
"id": "c90918b2-e9a5-4147-b4a4-953e235b9ddd",
"accountId": "bf14421a-0ccb-4656-a91f-84119e8fc994",
"memberId": "e64eee9f-ec4e-4c8a-b015-eb3be0b2761b",
"couponReference": {
"couponId": "e48b4b92-3481-40bf-943d-c9324ae3cd6d",
"code": "6Q1LC0K4KHSL",
"name": "Free shipping",
"specification": {
"type": "FREE_SHIPPING",
"freeShipping": true
}
},
"status": "PENDING",
"rewardName": "Free shipping",
"revision": "1",
"createdDate": "2024-04-18T15:07:53.639Z",
"updatedDate": "2024-04-18T15:07:53.639Z"
}
}
Retrieves the loyalty coupons for the currently logged-in member.
Note: This endpoint requires visitor or member authentication.
Retrieved loyalty coupons.
curl -X GET \
'https://www.wixapis.com/loyalty-coupons/v1/coupons/my-coupons' \
-H 'Authorization: <AUTH>'
{
"loyaltyCoupons": [
{
"id": "c90918b2-e9a5-4147-b4a4-953e235b9ddd",
"accountId": "bf14421a-0ccb-4656-a91f-84119e8fc994",
"memberId": "e64eee9f-ec4e-4c8a-b015-eb3be0b2761b",
"couponReference": {
"couponId": "e48b4b92-3481-40bf-943d-c9324ae3cd6d",
"code": "6Q1LC0K4KHSL",
"name": "Free shipping",
"specification": {
"type": "FREE_SHIPPING",
"freeShipping": true
}
},
"status": "PENDING",
"rewardName": "Free shipping",
"revision": "1",
"createdDate": "2024-04-18T15:07:53.639Z",
"updatedDate": "2024-04-18T15:07:53.639Z"
}
]
}
Retrieves a list of loyalty coupons, given the provided paging, filtering, and sorting.
You can only call this method when authenticated as a Wix app or Wix user identity.
Query options.
Retrieved loyalty coupons.
Metadata.
curl -X POST \
'https://www.wixapis.com/loyalty-coupons/v1/coupons/query' \
-H 'Authorization: <AUTH>'
-H 'Content-Type: application/json' \
--data-raw '{
"query": {
"filter": {"memberId": {"$eq": "e64eee9f-ec4e-4c8a-b015-eb3be0b2761b"}}
}
}'
{
"loyaltyCoupons": [
{
"id": "c90918b2-e9a5-4147-b4a4-953e235b9ddd",
"accountId": "bf14421a-0ccb-4656-a91f-84119e8fc994",
"memberId": "e64eee9f-ec4e-4c8a-b015-eb3be0b2761b",
"transactionId": "aba2ef65-8f70-4113-b4bd-d44338a4e37d",
"couponReference": {
"couponId": "e48b4b92-3481-40bf-943d-c9324ae3cd6d",
"code": "6Q1LC0K4KHSL",
"name": "Free shipping",
"specification": {
"type": "FREE_SHIPPING",
"freeShipping": true
}
},
"status": "ACTIVE",
"rewardName": "Free shipping",
"revision": "2",
"createdDate": "2024-04-18T15:07:53.639Z",
"updatedDate": "2024-04-18T15:07:55.426Z"
}
],
"metadata": {
"count": 1,
"cursors": {},
"hasNext": false
}
}
Deletes a loyalty coupon.
The deletion of a loyalty coupon does not impact the functionality of the corresponding coupon itself.
You can only call this method when authenticated as a Wix app or Wix user identity.
ID of the loyalty coupon to delete.
Revision number, which increments by 1 each time the loyalty coupon is updated.
To prevent conflicting changes, the current revision
must be passed when updating the loyalty coupon.
curl -X DELETE \
'https://www.wixapis.com/loyalty-coupons/v1/coupons/c90918b2-e9a5-4147-b4a4-953e235b9ddd?revision=1' \
-H 'Authorization: <AUTH>'
{}
Triggered when a loyalty coupon is created.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.loyalty.v1.coupon
.
Event name. Expected created
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.loyalty.v1.coupon_created",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}
Triggered when a loyalty coupon is deleted.
Unique event ID. Allows clients to ignore duplicate webhooks.
Fully qualified domain name of the entity associated with the event. Expected wix.loyalty.v1.coupon
.
Event name. Expected deleted
.
ID of the entity associated with the event.
Event timestamp.
Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
If present, indicates the action that triggered the event.
Event information.
The data payload will include the following as an encoded JWT:
{
"data": {
"eventType": "wix.loyalty.v1.coupon_deleted",
"instanceId": "<app-instance-id>",
"data": "<stringified-JSON>",
// The identity field is sent as a stringified JSON
"identity": {
"identityType": "<identityType>", // ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
"anonymousVisitorId": "<anonymousVisitorId>", // in case of ANONYMOUS_VISITOR
"memberId": "<memberId>", // in case of MEMBER
"wixUserId": "<wixUserId>", // in case of WIX_USER
"appId": "<appId>" // in case of APP
}
}
}