I have a Django project configured with Stripe for payments. I have created promocodes for discounts, which can only be redeemed once per customer. The problem is that I want to validate whether a given customer has already redeemed a specific promocode. If they haven't redeemed it, I want to proceed to the next step; otherwise, I want to stop the customer at that point.
I have retrieve the promocode but it returns the following values:
{
"active": true,
"code": "test10",
"coupon": {
"amount_off": null,
"created": 1716289929,
"currency": "usd",
"duration": "once",
"duration_in_months": null,
"id": "test10",
"livemode": false,
"max_redemptions": null,
"metadata": {},
"name": null,
"object": "coupon",
"percent_off": 10.0,
"redeem_by": null,
"times_redeemed": 1,
"valid": true
},
"created": 1716289930,
"customer": null,
"expires_at": 1716595200,
"id": "promo_1PIqc2B67hjAZnF4umv6pZCP",
"livemode": false,
"max_redemptions": null,
"metadata": {},
"object": "promotion_code",
"restrictions": {
"first_time_transaction": true,
"minimum_amount": null,
"minimum_amount_currency": null
},
"times_redeemed": 1
}
I am not able to find an API that validates whether a customer has already redeemed a given promocode.
I'm expecting a method or API endpoint in Stripe that allows me to check if a specific customer (customer ID) has redeemed a specific promocode.
I have created The promocode which is only be redeemed once per customer.
You would need to either:
customer
and code
(in case you want to use the same code) to check if it was used, ormetadata
field, to record if a given promo code was used.