#reyanchougle

1 messages ยท Page 1 of 1 (latest)

tropic fractalBOT
wispy ember
#

Sure, what are your questions?

carmine apex
#

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

wispy ember
#

In Step 3 "Create a Checkout Session", the success_url will be your app that Stripe will redirect back after customer complete payments

carmine apex
#

ok.. In case of failure how will it redirect to our app?

wispy ember
#

There is cancel_url when it's cancelled

carmine apex
#

ok

#

So do we need an webhook?

wispy ember
#

Well it's optional, but yes better to have webhook

carmine apex
#

There can be only two events from Stripe, right? either success or failure. Or any other event can be there like pending or something?

wispy ember
#

But you can focus on invoice.paid and invoice.payment_failed

carmine apex
#

ok.. invoice.paid and invoice.payment_failed must be used when the payment happens automatically next year right?

#

Are you there?

wispy ember
#

Yes!

#

You should check the Invoice Id comes through via the events, and see if it belongs to your Subscription

carmine apex
#

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?

wispy ember
#

success_url or cancel_url

#

Yep

carmine apex
#

yes

#

Amd the webhook is only needed to know about the automatic payments done yearly right?

wispy ember
#

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

carmine apex
#

ohh good to know..

#

So in this case which events must be checked?

wispy ember
carmine apex
#

So this same event **checkout.session.completed **can be used for success and failure both?

wispy ember
#

It's for success, sorry. for failure you sill need to listen to invoice.payment_failed

carmine apex
#

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

wispy ember
#

Yes correct!

carmine apex
#

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?

wispy ember
#

The currency will be passed when you first create the Subscription, specifying the price. The Price has a currency parameter

carmine apex
#

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

wispy ember
carmine apex
#

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

carmine apex
#

Are you their bro?

wispy ember
#

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)

carmine apex
#

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?

wispy ember
#

Yep

carmine apex
#

ok and there is no max limit on creations of product, customer and subscription right?

wispy ember
#

I don't think so, but you can confirm with Support or easily write a test script to test in test mode ๐Ÿ™‚

carmine apex
#

ok sure

#

How can a user unsubscribe from the next recurring payment and what are the prerequisites for it?

wispy ember
#

If you provide them the Billing Portal to, or if you call Cancel Subscription for them

carmine apex
#

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

wispy ember
#

Well you can either pause the Subscription, or cancel it completely

carmine apex
#

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

wispy ember
#

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

carmine apex
#

Yes.. Skip the next automatic payment then continue again

#

How can above case be achieved?

wispy ember
#

Please read the Pause Subscription Doc above

carmine apex
#

oh ok got it.. So after the automatic payment date is gone we can resume the subs right?

wispy ember
#

Yep (also in the Doc)

carmine apex
#

ok thanks bro..

#

this conversation was really helpful..

#

I will try out everything you explained

#

If I have any doubts during implementation then will ping you

#

thanks again and have a great day ahead