#ahjaydog-async-payment-failed
1 messages ยท Page 1 of 1 (latest)
Hi again. Sure.
As far as I can tell, the PaymentIntent associated with the checkout session should have an error code
If not, you can check the charge itself as well
hmm so would i have to expand on checkout.session to get the payment intent?
yup
ok. I had a few other questions. If I get a failure, I think I will just cancel the unpaid subscription if one exists. How would I do that?
There isn't a built in way to cancel the subscription if the payment fails. I believe you'd need to call the API to do that separately
hmm ok.
Is this correct for the other thing? https://dpaste.org/OHWbH
And which email is the right one to use for print(checkout.session)? I see like 3 different customer emails in the JSON. And one of them is null
checkout_session.customer.email ?
so it depends on your integration really.
if you already have a customer object, that's the one you'd want to use.
If you don't have an existing customer, you would want to use customer_details.email as that's the one that is the most recent valid email provided by the customer on the Checkout form
i already have it since i grey out the checkout email text box. However, on my donation form I leave the email text box enabled. So I guess I will use the customer details one then
I just worry that it will be null so I'll take your word for it
I don't remember how i disabled the email textbox in cheeckout? Was it from the dashboard?
If I decide not to cancel after an async failure, how do I allow my customer to pay from the customer portal the unpaid invoice and give them the subscription and change my database membership to activated?
I think the dashboard settings have a way to automatically cancel the unpaid subscription? https://dashboard.stripe.com/settings/billing/automatic
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
By the way, the other day it was a bad idea to try to automatically redirect from the success page to the verification pin page. The pin page creation is delayed so it wouldn't have worked.
Or rather for the async failure I would need to cancel the subscription plus void the invoice
I don't remember how i disabled the email textbox in cheeckout? Was it from the dashboard?
I don't think you can disable email textbox unless you provide an existing customer while creating the checkout session
oh makes sense that is why then
If I decide not to cancel after an async failure, how do I allow my customer to pay from the customer portal the unpaid invoice and give them the subscription and change my database membership to activated?
Your integration would control that flow to be honest. You can bring them back to a page that collects their information again
By the way, the other day it was a bad idea to try to automatically redirect from the success page to the verification pin page. The pin page creation is delayed so it wouldn't have worked.
Yup. I remember flagging it to you as well that the micro-deposits may take 1-2 days to show up
Yea I realized later after you told me lol
hmm I probably want to cancel the sub and void the invoice on the failure. So I would need to expand the payment intent on the async_failure, then find the subscription id, delete it, and find the invoice from the payment intent, void it?
Yea or does the dashboard billing settings page handle that for me? I forget.
It can, yes.
ok I will code it and test it both ways
thanks i will try it out. I will come back if I need more help figuring out how to get these IDs lol
NP! ๐ Good luck
Hmm well I have the 1 webhook to handle both 1 time donations / subscription donations and my other subscription only main product. How would I expand the checkout session to tell I have a one time payment versus a recurring payment?
The session object would have mode property
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-mode
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.