#reyanchougle
1 messages ยท Page 1 of 1 (latest)
Sure, what are your questions?
Thanks for your message. Let me tell you our use case that I want to acheive using Stripe
Basically we have subscription plans with yearly renewal requirements
We have users to pay for one year and next year he should be automatically deducted. If he renews next year then we should got to know it that user has renewed so that we can renew the subscription on our end as well
I am using .net core
Also, need to know if stripe will redirect user to our app when payment is success or failure
Please help me in integration
What you describe looks like an ordinary Subscription Integration that I believe is possible. You can start by looking at this Doc: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=checkout#create-session
In Step 3 "Create a Checkout Session", the success_url will be your app that Stripe will redirect back after customer complete payments
ok.. In case of failure how will it redirect to our app?
There is cancel_url when it's cancelled
Well it's optional, but yes better to have webhook
There can be only two events from Stripe, right? either success or failure. Or any other event can be there like pending or something?
A lot more ๐ https://stripe.com/docs/billing/subscriptions/webhooks
But you can focus on invoice.paid and invoice.payment_failed
ok.. invoice.paid and invoice.payment_failed must be used when the payment happens automatically next year right?
Are you there?
Yes!
You should check the Invoice Id comes through via the events, and see if it belongs to your Subscription
ok.
Whenever a user is redirected to the Stripe website for payment, it is guaranteed that he will be redirected back on success or failure URLs right?
yes
Amd the webhook is only needed to know about the automatic payments done yearly right?
Yep! But I recommend to also listen to webhook for the first payment.
it is guaranteed that he will be redirected back
Yes it's guaranteed, by theory. Let's say if your customer lost their internet access, or if they are on train and get into a tunnel, their connection could be lost and never reach your website
So it's not 100% guaranteed by practice
Since it's Checkout Session, you should look at checkout.session.completed Detail guide for first payment handling logic here: https://stripe.com/docs/payments/checkout/fulfill-orders
So this same event **checkout.session.completed **can be used for success and failure both?
It's for success, sorry. for failure you sill need to listen to invoice.payment_failed
oh ok .. So for first payment, we need to monitor checkout.session.completed for success and invoice.payment_failed for failure.. For automatic payments, we need to monitor invoice.paid for success and invoice.payment_failed for failure. Please confirm my understanding
Yes correct!
ok
Irrespective of the country from where the user will be making the payment, we want to process all payments in dollars. So can this be configured anywhere one time or passed during each payment?
The currency will be passed when you first create the Subscription, specifying the price. The Price has a currency parameter
oh ok
So on a high level. What all things do I need to create using API from our web app e.g. subscription
I mean can you tell me the flow.. Like First we need to create this and then that
Yeah the first Doc I provided is the high-level flow: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=checkout#provision-and-monitor
ok. So once I create a subscription from our app. Do we also need to create product or customer as well? The product and customer will be changing mostly in each payment
Are you their bro?
Product and Customer are required for each Subscription
You would need to create as many as Subscriptions if it changes that frequently (but normally business doesn't have 1 product per 1 payment)
ok so for payment, Using the API, I need to first create a product, then a customer, then the subscription, then will redirect to stripe right?
Yep
ok and there is no max limit on creations of product, customer and subscription right?
I don't think so, but you can confirm with Support or easily write a test script to test in test mode ๐
ok sure
How can a user unsubscribe from the next recurring payment and what are the prerequisites for it?
If you provide them the Billing Portal to, or if you call Cancel Subscription for them
We want to do it from our web app using API. So which API to refer and how many days before I can unsubscribe it
Well you can either pause the Subscription, or cancel it completely
oh ok understood..
Suppose before next automatic payment if a user does the payment by some other mode like GPay. Then is there a way to tell stribe that the payment is already done so not to do it automatically for this year and can continue as is for next year
like skip the next invoice?
It's the same as pausing in above Doc. For example you can use keep_as_draft then later on finalize all draft invoices and mark them paid out of band
Yes.. Skip the next automatic payment then continue again
How can above case be achieved?
Please read the Pause Subscription Doc above
oh ok got it.. So after the automatic payment date is gone we can resume the subs right?
Yep (also in the Doc)