简体   繁体   中英

Monthly payments using Stripe

I am coding a MVC 5 internet application and am using the Stripe service for user payments. I am setting up a feature so that each month, a payment is made to the Stripe service for a users subscription.

Currently, I am using Hangfire, with a recurring monthly task for this. Each month, a payment is made to Stripe, and if the payment is successful, the users account in the MVC application is extended by 1 month.

My question is this: Should I setup a subscription with Stripe, and have a webhook that is called after a monthly payment is made. In the webhook, if the payment is successful, the users account in the MVC application is extended by 1 month.

Does anyone have some coding advice on the best way to setup a monthly payment for a users account when using MVC 5?

Thanks in advance.

Stripe's subscriptions will automatically charge your customer every month so there shouldn't be any need for a recurring task on your end to build this.

First you would create a monthly plan in the dashboard so that you can subscribe your customers later. Then you would call the Create Customer API and pass the plan identifier as the plan parameter.

You customer would then get immediately charged the plan price and then charge each month on the same day until you cancel the subscription.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM