Promotional Coupon
Streamline Promotional Coupon Handling with Webhooks
Here's a comprehensive guide to effectively utilizing the promotional coupon webhook:
Trigger:
A user enters a promotional coupon code within the RETM POS app.
Notification:
RETM sends a POST request to your designated notification URL, containing the following request parameters:
- reward_code: The unique code of the entered coupon.
- business_reference: The identifier of the restaurant where the coupon was applied.
Response Structure:
:::highlight green
Valid Response (2xx OK)
:::
{
"data":{
"type": "1:for order,2:for product",
"is_percentage": "boolean", // Indicates whether the discount is a percentage or a fixed amount.
"customer_number": "", // Optional field for customer identification.
"discount_amount": "", //The value of the discount.
"max_discount_amount": "0:unlimit", // The maximum discount allowed (0 represents unlimited).
"allowed_products": [ // Array of product IDs and quantities eligible for the discount (if applicable).
{
"product_id": "",
"quantity": ""
}
],
"button": { // Optional, will perform actions when clicked
"label": { // Text for the button in both Arabic and English.
"ar": "string",
"en": "string"
},
"url": "", // The URL to be triggered when the button is clicked, carrying all parameters as GET.
"close_modal": "boolean" // Boolean indicating whether to close the coupon modal upon button click.
}
},
"errors": [] // An empty array, signifying a successful validation.
}
:::highlight red
Invalid Response (400 BAD REQUEST)
:::
{
"data":[], // Optional, may contain additional information.
"message": "Reward 1234 has been used", // A human-readable error message.
"errors": ["merchant doesn't exist"] // Array of specific error details.
}
Integration Considerations:
Process coupon data: Extract relevant information from the response to apply discounts, display messages, or guide user actions.
Handle button customization: Respect the provided button configuration for a seamless user experience.
Error handling: Implement robust mechanisms to gracefully manage invalid responses and communicate errors to the user.
Logging: Maintain detailed logs of webhook events for troubleshooting and auditing purposes.
By effectively leveraging this webhook, you'll create a dynamic and user-friendly experience for handling promotional coupons within your RETM integration.