#Mathieu-Checkout
1 messages · Page 1 of 1 (latest)
Hi there, if the payment method is for subscription purpose, I'll suggest to use off_session, so that the payment is more likely to go through when your customers are not on_session.
However, you still need to handle the scenario when customer's authorization is required (i.e., the payment_intent status becomes requires_action)
and you'll need to bring customers back to your app and confirm the payment.
What webhook should i listen to handle this scenario ?
On an other project where i did custom integration i listen to invoice.payment_failed and check the $subscription->latest_invoice->payment_intent->status being equal to requires_action if so i send the user a notification email.
Is it the same for the checkout scenario ?
Yes, you will have your status on payment intent
Hi @night mauve you can listen to payment_intent.requires_action event to get notified when a payment intent requires action https://stripe.com/docs/api/events/types#event_types-payment_intent.requires_action
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ok and what is the code-less way to deal with this event on the front application (after sending the email notification from the backend) ? Redirect to the client portal ?
Also what is the best practice about dealing with the customer object in this scenario ? Created it first and pass it to the Session or let the Session create it ?
Ok and what is the code-less way to deal with this event on the front application (after sending the email notification from the backend) ?
The "code-less way" is to let Stripe handle everything for you! There are settings in the Stripe dashboard to automatically retry/email failed invoices for subscriptions https://dashboard.stripe.com/settings/billing/automatic
Also what is the best practice about dealing with the customer object in this scenario ? Created it first and pass it to the Session or let the Session create it ?
Both options work, this is completely up to you. If you already have an existing customer, pass it to the Checkout Session (to avoid duplicates). Otherwise you can let the Checkout Session create one for you automatically.
ok i've got one more question about the customer portal. Can you create mutiple customer portal for one Stripe Account (like to have different product/price by portal) or is it best to have an account centered on one product ?
You can have a single Customer Portal configuration that will apply to all your customers, or you can have multiple configurations (for example one configuration for each customer).
Here's how to create a configuration: https://stripe.com/docs/api/customer_portal/configuration