How to process Marketplace Loyalty
Introduction
When a customer adds their loyalty details to a marketplace order, Deliverect can forward the order to an integrated loyalty platform to allow points to be awarded to the customer.
Marketplace loyalty requires the loyalty platform to support three webhooks:
Loyalty flow
Customer checks out with their loyalty identifier
The customer completes checkout on the marketplace with their loyalty platform identifier (phone number, email or membership ID) added in the loyalty field.
Deliverect requests the customer — GET Customer
Deliverect calls the loyalty platform's GET Customer webhook with this value as providerId, plus accountId, loyaltyProfileId, locationId and channelLinkId, all sent as URL-encoded query parameters.
Loyalty platform returns the customer — GET Customer
The loyalty platform looks up the customer and returns 200 with their loyalty profile if they exist, or 404 if they don't. A 404 ends the flow.
Deliverect sends the loyalty order — POST Loyalty Order
After a 200, Deliverect sends the complete order to the loyalty platform's /loyalty/order webhook so points can be awarded.
Deliverect sends cancellations — POST Cancel Loyalty Order
If the order is later cancelled, Deliverect sends the customer and cancelled order details to the loyalty platform's /loyalty/cancelOrder webhook so any awarded points can be reversed.
Sample loyalty order
Below is an example of the payload sent to the loyalty platform's Loyalty Order Notification webhook in step 4. The customer.loyaltyProviderCustomerId matches the providerId returned by the loyalty platform in the GET Customer response.
{
"sessionId": null,
"account": "69********************b2",
"accountId": "61********************6f",
"channelLinkId": "67********************7y",
"location": "62********************p1",
"locationId": "63********************a9",
"orderType": 2,
"paymentAmount": 99,
"customer": {
"email": null,
"phoneNumber": "+442033166035",
"loyaltyProviderCustomerId": "customer-id-1234",
"name": "John"
},
"created": "yyyy-MM-ddTHH:mm:ss.SSSSSSZ",
"channelOrderDisplayId": "T**4206",
"orderId": "TEST******4206",
"items": [
{
"plu": "13118",
"name": "Cookie",
"price": 99,
"quantity": 1,
"subItems": []
}
],
"subTotal": 99,
"taxTotal": null,
"discountTotal": 0,
"discounts": [],
"decimalDigits": 2,
"serviceCharge": 0,
"deliveryCost": 0,
"bagFee": 0,
"tip": 0,
"driverTip": 0,
"smallOrderFee": 0,
"loyaltyProfileId": "6a********************e3"
}Loyalty Order Model
For a full list of the loyalty order model attributes and their meaning, see link below;
Updated about 15 hours ago
