#jacob-subs-deferred

1 messages ยท Page 1 of 1 (latest)

hot wolfBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

alpine jetty
#

Hi, what do you mean by 'have it update the payment element'?

#

Can you add a bit more details?

frigid meadow
#

Sure! I'm using this tutorial to set things up: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements

In step 4 of that tutorial, it instructs you to create the subscription on the backend before collecting the payment information through the payment element (which is what I'm doing). My use case/design requires me to collect and apply any promo codes on the same screen as the payment element.

I've got a field set up on the frontend to collect a promo code, which I'm then sending to the backend. On the backend, I'm calling updateSubscription to apply the promo code to the subscription I created in step 4. However, when I continue checking out using the payment element, the promo code is not applied.

alpine jetty
frigid meadow
#

Yeah that's essentially what I'm saying. here's the request ID req_GaQBQuKyg3bQo9

#

and this is the one I used to create the subscription: req_3Ui1BuvaajKqdb

alpine jetty
#

I'm digging into this

#

Thank you for your patience

frigid meadow
#

No problem! Thank you

#

I also just completed/submitted the checkout with request ID: req_D9yy1vnN6sTqkD if that helps

alpine jetty
#

Thank you, I'm taking to a colleague here

frigid meadow
#

Sounds good! LMK if you need any more info

alpine jetty
#

Sure, thank you

hot wolfBOT
crimson helm
#

๐Ÿ‘‹ Hopping in here since pgskc has to head out soon - the promotion code is being applied to the subscription, but it'll be applied to the next invoice for that subscription. It won't apply to the Invoice that was already created + finalized when the subscription was created

frigid meadow
#

aaaah gotcha. Is there a way to have it apply to both?

#

Would I need to update the payment intent as well as the subscription?

crimson helm
#

You'd have to pass in the promo code when the subscription is created if you want it to apply to that initial invoice. Really the better way to do this is to wait to create the Subscription until the end and use the deferred intents flow (which does not require a client secret up front)

#

jacob-subs-deferred

frigid meadow
#

Ok gotcha. I'll check out that doc and reply again if I have any more questions. Thanks!

crimson helm
#

๐Ÿ‘

frigid meadow
#

Actually, one more thing. I want to be able to build a toggle on the same page as the payment element. This toggle should let the user switch between the annual plan and the monthly plan. Is it possible to update the amount in the "options" being passed to the payment element? I had trouble updating the clientSecret and wasn't sure if the whole "options" object is immutable or if it's just the clientSecret field

crimson helm