#default_user_Bq67qllUp5l4mHuk0ao
1 messages · Page 1 of 1 (latest)
Interesting, so you are saying that if they put in the code, close checkout, and put in the code again they will get an error that the code is not valid?
yes -
also the return we get form the post - after applying it the first time will be invalid
(even though code is indeed taking into cosidartaion in the final payment
What POST call are you making once the card has been put in to the form?
in order to add the promo
await stripe.customers.update(
customer.stripeId,
{ promotion_code: promotionCode.id },
);
im setting the promo on customer
I think I am unclear on the intended flow that you want. Can you tell me what steps are involved here?
Is it something like:
- You generate a Checkout Session
- On the Session's page, the user adds a promo code
- You are listening for some webhook, when you hear it you apply the same coupon to the customer?
- user start checkout session
- user tries to add promo code to
- a post request is send to validate the added promo
- if the promo exist and active: add to customer (customer.update)
- send the response of the customer update to the frontend - where the name of the coupon will be presented instaed of the promo code
thanks
so the reponse fro update customer is that the coupon is not valid
Ah so this is your own custom page
When I asked about Checkout I was referring to a specific Stripe product (https://stripe.com/docs/payments/checkout)
Looking in to how you may be able to do this on a custom page...
my question is essentialy why when adding promom code to customer the coupon is not valid?
Adding it to the customer is redeeming it. I think you want to save that step until the payment is actually being submitted. So maybe when they input the code you just need to check if it is a valid code.
Though that would mean we would have the same problem if the user added the code, tried to pay but got declined, closed the tab, and returned later to try again
agreed
I think you may need some custom code on side to make up the gap
I think you would have to get rid of our max_redemptions param and enforce that limit yourself, only updating after a successful transaction from the user with that coupon code.
I can put in feedback that outlines the flow that you are going for. I definitely get that usecase. Though I can't guaruntee if/when it would be added so a workaround will be needed
Yes, that parameter is optional so you can choose not to provide it when making the coupon.
Though on second thought, if this is a customer level coupon, maybe it is fine to apply it to the customer and the second time they load the page you just display that the customer already ha a coupon on them
yes - but the coupon is not valid - and we have a check to vaify that
Not sure what you mean, are you saying after it has been used on the customer?
"used" = assigned
I was more trying to say that once it has been applied to the customer, you can display that it has been applied without ever having to make that POST request again
true - but on the forst assignment - the response of the customer update - is invalid coupon
Can you send me the ID of a request where you got this error? (req_123)
req_J5BW1BSWoL12Kl
The description for that field says "whether this coupon can still be applied to a customer." so I think here it is trying to say that it is already on this customer and it can't be applied to other ones. Have you tried actually making an applicable subscription on that customer? I think the coupon has already been applied when you get that return, you would get an error if it wasn't able to be added to the customer
https://stripe.com/docs/api/coupons/object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
the coupon did work on real time - i unserstand the value valid is confusin in this case because it means no longer valid *for other users *
Yeah, definitely get that confusion. Glad it still worked here!
so to sum it up -
the best way to get the coupon details wil be befre adding it to customer
Yep yep