#atul
1 messages · Page 1 of 1 (latest)
Hey! Bit of a broad question! Is there a specific use case you're trying to account for?
I have system designed that use stripes subscription
I have to build solution to handle payment failure
Yes, so you can follow these guides depending on situations for that:
If the Payment failed
https://stripe.com/docs/billing/subscriptions/webhooks#payment-failures
if the Payment requires addition actions (aka 3DS)
https://stripe.com/docs/billing/subscriptions/webhooks#additional-action
The idea is to set up webhook that listens to some events and get the customer back in order to set their PaymentMethod
I have used stripe checkout to subcribe
Or simply via Dashboard, you configure Stripe to send Customer emails after Payment Failure:
https://dashboard.stripe.com/settings/billing/automatic
Please refer to section Manage failed payments
no problem, webhooks applied to whatever how subscription is created
Which events to listen for ??
When subscription change from active to past_due, customer.subscription.updated event is fired ??
Yep, exactly
I need to provide option to my customer, clicking on that they can make the payment,
What how to achieve it ?
Clicking on what? Can you describe what it is exactly you're doing?
ok
Suppose customer have subscribed to my product.
Choose monthly billing cycle,
Stripe automatically charge the card on 1st of every month, and listening to invoice.paid event, i increase the subscription date in my database.
Lets suppose a scenario, stripe tried to charge the card on 1st of next month, but could not process it.
Now i want to offer customer a button, clicking on which they can make the payment, How can be this achieved ??
You'd create a payment page, using Stripe Elements, that would collect payment information from the user and then attempt to confirm the Payment Intent from the Invoice object
DO we have any diagram, demonstrating the complete flow of subscription
Complete flow of subscription? Anything more specific? There's a lot of detail here: https://stripe.com/docs/billing/subscriptions/overview
Still i am not clear how to implement thing
- Build a page that initialises Stripe Elements, in order to collect payment details and confirm the payment: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements#collect-payment
- You need to fetch the Payment Intent
client_secretfrom the Invoice of the payment that has failed: https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent - You can pass the
client_secretwhen initialising an Elements instance: https://stripe.com/docs/js/elements_object/create#stripe_elements-options-clientSecret - Add a 'pay' button to the site that calls
confirmPaymentwhen clicked: https://stripe.com/docs/js/payment_intents/confirm_payment
There's no one document/guide that outlines how to do all this. You need to cherry pick parts of the documentation and bring it all together, but the above is a good starting point