#g105b

1 messages · Page 1 of 1 (latest)

remote gustBOT
drifting glade
#

You can't create zero amount Payment Intents so that's not really an option

#

How are you integrating with Stripe?

glad canyon
#

I take the product details in an HTML form to generate an Order, then I show a payment screen using Elements.

drifting glade
#

You're using our Orders API?

glad canyon
#

Yeah!

drifting glade
#

How are you application the promotion code? Is it not showing as redeemed?

#

Can you share some object IDs? order_xxx

glad canyon
#

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?

drifting glade
#

As I understand, yes. The order will just be zero amount and no resulting payment

#

And the promotion code redeemed

glad canyon
#

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 .

glad canyon
#

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?

torn quartz
#

👋 taking over for my colleague. Let me catch up.

drifting glade
#

My guess is the promotion isn't redeemed until the order is submitted/complete

glad canyon
#

Aha OK, so creating an Order is not enough, I have a step left to submit a created Order?

torn quartz
#

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

glad canyon
#

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?

torn quartz
#

I'm not following

glad canyon
#

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?

drifting glade
#

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

glad canyon
#

Thanks for the link. Can I confirm that the API endpoint should have /v1/ at the start, even though I'm using Orders v2?

drifting glade
#

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?

torn quartz
#

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

glad canyon
#

Perfect, OK this all makes sense, thank you. I will get this coded up, hopefully I don't need to follow up again.

torn quartz
#

let me know if you need any more help

glad canyon
#

@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.