Stripe Payment Gateway Functional Flow Understanding with Webhooks

To start with, let me tell you integrating a Stripe into your project’s native language is not very hard rather than first understanding it’s flow and how does Stripe work. Here we will describe the functional flow of a Stripe subscription of a plan and Webhooks

Before we move ahead you should have little knowledge about the WebHooks on Stripe because we think before starting with making payment events you should know something called WebHooks on Stripe.

WebHooks is nothing but it sends you a notification if any new event occurs on your Stripe account. In more easy language if Stripe Charges any customer then WebHook will send a notification of “charge.succeeded” to the registered WebHook Url, same it does for “charge.failure”, “invoice.created” and much more you can find it out on Stripe documentation. It may be a case that for a single payment charge there may occur multiple events like as soon as charges have been deducted from the customer Stripe account an invoice for that charge is also created so for one customer we will get two WebHooks notification one for “charge.succeeded” and other for “invoice.creation.succeeded”.

Payment Gateway_Tudip

Also, Stripe has given us the WebHook feature for choosing some number of an event from all set of events to get notified, as per our requirement, like you can only select an event of “charge.succeeded” so you will only be notified of that particular event not other than it.

By WebHook we can get assured for charges success and invoice created for a particular customer, if our charges are in recursive order and also based on our project requirements.

To Subscribe to any plan on Stripe user has to follow below four steps in order:

  • Get Card Details of a user (at this point user is not a customer in terms of Stripe) (No need API for this)

PamentScreen_Stripe_Tudip

Here you go now you can play with Stripe Subscription any time by keeping in mind the above four steps. All these steps can be accomplished practically by calling their respective API’s for them, which is provided on Stripe documentation https://stripe.com/docs/api#intro.

As soon as the customer subscribes to another plan then that particular customer is unsubscribed from the old plan and the charges are cut on a basis on proration and the proration is taken care by Stripe so you don’t have to worry about it.

For more understanding, you can visit https://stripe.com/docs/api Stripe documentation and can read about Tokens, Customers, Subscriptions and Plans in respective order.