#last_api

1 messages ¡ Page 1 of 1 (latest)

soft sierraBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1231931691191504927

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

jade finch
#

I found out that in the past I let the user pay the payment intent even when the subscription was already in canceled status. And the payment got through correctly but the subscription wasn't resumed obviously. So I wonder if it's actually the correct way to resolve this at all.

coarse meadowBOT
faint kettle
#

Hi, let me help you with this.

#

If the Subscription is cancelled, there's no coming back, you should create a new Subscription object. But if it's in pase_due state, it's still possible to recover it, by adding a new Payment Method and paying (or voiding) the outstanding Invoice.

jade finch
#

Can you point out the API calls I need to do? The current way the software does it is that it has a form for a user to enter their credit card but it's directly you to pay the paymentIntent. It's not attaching the card as a payment method for future uses.

#

So I suspect it can be a bit wrong.

#

And how can I find out from the API payloads if it's still valid to pay the outstanding invoice or if it's too late already?

faint kettle
#

The outstanding Invoice will have a hosted_invoice_url property that you can send to the customer, where they will be able to enter the new PM. I suspect it will also be saved on the Subscription. Have you tried that?

jade finch
#

No, I didn't know about it. What if I want to do it in my own form on my side?

faint kettle
#

You mean with Stripe Elements? You can then use the Payment Intent client_secret, as you mentioned. You can then grab the used Payment Method and set it as default_payment_method on the Subscription.

jade finch
#

Alright, thank you!

faint kettle
#

Happy to help.