Overview
When a coupon is validated and locked, it becomes temporarily unavailable for others (or the same user) to redeem.If the order fails, payment doesn’t go through, or the customer abandons checkout, those locked coupons should be released to make them reusable. That’s where the Release Coupons API comes in; it reverts the coupon status from locked to available.
Why This Matters
Coupon locking ensures discounts are held during checkout to prevent misuse or concurrent redemptions.However, if these coupons remain locked after failed transactions, they can become unavailable to customers who never actually used them. Releasing them promptly:
When to Use It
You should call the Release Coupons API when:| Scenario | Description |
|---|---|
| 💳 Payment Fails | The transaction fails before completing checkout. |
| ❌ Order Is Canceled | The order was canceled manually or automatically. |
| ⏱️ Checkout Timeout | The session expired before confirmation. |
| 🛒 Cart Abandoned | The customer left checkout after applying a coupon. |
How to Implement
Once an order fails or is canceled, call the Release Coupons API using the samelockReference that was returned during the coupon validation (or lock) phase.
Example Response:
What Gameball Does Behind the Scenes
1
Validates the lock reference
Ensures the lock reference matches a valid, previously locked coupon session.
2
Updates coupon status
Changes coupon state from locked → available.
Example Use Cases
🛍️ E-commerce Checkout Cancellation
Scenario: Sarah applied the coupon WINTER25 but canceled the order before confirming payment. Implementation: Your system should call the Release Coupons API immediately after order cancellation.Result: The coupon becomes available again for future use.
💳 Payment Gateway Failure
Scenario: John applied FREESHIP, but his payment failed due to an expired card. Implementation: After receiving the failure callback from your payment gateway, release the locked coupon.Result: The coupon is reactivated, and John can retry the transaction.
🏪 POS Transaction Reversal
Scenario: A store cashier mistakenly voids a transaction where a coupon was applied. Implementation: Call the Release Coupons API to unlock the coupon for reuse.Result: The coupon is freed for the same or another customer to use later.
Best Practices:
Always call the Release Coupons API immediately after payment failure or cancellation.
Avoid skipping release; otherwise, coupons may appear as unavailable until their lock expires.