#g105b
1 messages · Page 1 of 1 (latest)
You can't create zero amount Payment Intents so that's not really an option
How are you integrating with Stripe?
I take the product details in an HTML form to generate an Order, then I show a payment screen using Elements.
You're using our Orders API?
Yeah!
How are you application the promotion code? Is it not showing as redeemed?
Can you share some object IDs? order_xxx
orderData["discounts"] = [ ["promotion_code" => $promoId] ]
I think your question might have led me to the answer, because I think the issue I'm having is my code doesn't create the order if there's no price... If I still go ahead and create the £0 order, will this handle the coupon usage for me?
As I understand, yes. The order will just be zero amount and no resulting payment
And the promotion code redeemed
Brilliant, I didn't know that's how it worked. I will code this up and hopefully not have any follow up questions. Thank you @drifting glade .
I've created the Order with the associated Promotion, and I can see it in the log at req_dDH1wc5sUYftxS, but it doesn't look like the promotion has been redeemed.
Have I missed a step?
👋 taking over for my colleague. Let me catch up.
My guess is the promotion isn't redeemed until the order is submitted/complete
Aha OK, so creating an Order is not enough, I have a step left to submit a created Order?
if you see in the response to your query in the discounts array
there's a di_estimated_1LDQJ8HorLyYqvBKN5yuilZr which is an estimated discount
this will not become applicable until the order gets submitted as @drifting glade confirmed
OK, so I need to "submit" the Order, but without requiring taking payment? That's the bit that I don't know how to do - if there's no Payment to be taken, how can I complete the Order?
I'm not following
I think what I'm missing is how there doesn't seem to be a way to convert an Order object into a "completed" Order object, without passing the orderID to the Stripe Elements object and taking card payment, which wouldn't be appropriate for £0.
However, I think with it being in beta, I might have to make a manual POST request to the Orders API to "submit" an Order, am I right? Will the process of "submitting" the Order mark the Order's Coupon as redeemed?
Correct, this endpoint: https://stripe.com/docs/api/orders_v2/submit
There's no equivalent in Stripe.js that doesn't require an Elements instance
And yes, I expect that when you submit the order and its complete, then the promotion code is redeemed
Thanks for the link. Can I confirm that the API endpoint should have /v1/ at the start, even though I'm using Orders v2?
Doesn't make sense to redeem it when the order is initially open – what if they customer abandons the flow, returns later but can't use the promotion code?
and since you can update the order before submission, the estimation of the discount would differ, that's why until the order is finalized the discount won't get applied
yes that's correct
Perfect, OK this all makes sense, thank you. I will get this coded up, hopefully I don't need to follow up again.
let me know if you need any more help
@torn quartz , @drifting glade I've just put my first test through after calling the submit endpoint, and I'm happy to say the coupon has been redeemed successfully. Thank you so much for your help, you're amazing.