#default_user_Bq67qllUp5l4mHuk0ao
1 messages · Page 1 of 1 (latest)
req_rWFbuuCihON5Pq
we can see this reem is failed becasue the code is not valid
Is this what you expect to happen?
no
i expect the coupon woll rturn wth not valid - since this is what the value is
how come same object : coupon {code: 'H15H9N3X' }can have 2 differrent values?
i want to avoid the assigning of invalid coupon and though in the update customer action i get error since coupon is not valid, when i try to retrieve the object before, i get valid = true
thanks vanya
?
Sorry, I am not following. Could you please rephrase the situation.
yes
i have code : H15H9N3X
the code is one time used and already got used
therfore - another customer can't use it and redeem it
i want to blok the option of redeem coupon that is not valid = coupon that can not be reemed because it's already been used
before the redeem code happen
i use the api to send a get message to /v1/promotion_codes
to see if the code i have (H15H9N3X in this case) is valid
the answer of api : valid = true !
and when trying to reddem the coupon - the operation fails because the coupon is not valid
so i want to find out he best way to allow us to block the flow of redeem such coupon
req_rWFbuuCihON5Pq
req_Xeo1VC2BzjxQ7Q
this 2 requests represent the post to redeem and get to promotion code
is that more clear ?
coupon: { amount_off: null created: 1689683467 currency: null duration: "once" duration_in_months: null id: "VUrWPKaV" livemode: false max_redemptions: null metadata: {0} name: "hilat-once" object: "coupon" percent_off: 100 redeem_by: null times_redeemed: 1 valid: true }
?
valid might not be the right property to check. You can see the times_redeemed: 1, you can rely on that one.
no i cant - what if max redeem is 5?
its very tricky
since max_redemption is null
what does valid represent?
why its not the property to check?
what wil be the flow according to stripe ?
I think there might be a confusion between a Coupon and Promotion Code.
Coupon defines the rules for the discount, and Promotion Code is something that can be used on purchases to apply the discount.
agreed
just wanted to simplify
i still need the flow you suggest
since neither the coupon nor promo code are valid
?
You can create a Coupon and define all the discount details, and then create a Promo Code and set max_redemptions (https://stripe.com/docs/api/promotion_codes/create#create_promotion_code-max_redemptions). On your purchases then you can use the Promo Code, and once the times_redeemed is exhausted you will not be able to use it anymore.
i know
but then how do i make sure no coupon will go to the fow of redeem?
i want to block this option!
not after trying to reddem
i dont want to get the 400 from the post customer
I just checked, active property will turn false once the Promo Code is used up: https://stripe.com/docs/api/promotion_codes/object#promotion_code_object-active