Stripe Payment Gateway Integration

Stripe Payment Gateway Integration

Tudip

Tudip

19 July 2016

Introduction:

As Stripe becomes de facto payment gateway, its time to look closer at the Stripe Payment Gateway Integration. To begin with, let me tell you integrating a Stripe into your project’s native language is not at all difficult. Firstly you need to understand it’s flow and how does Stripe actually 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. It is because we think before starting with making payment events you should know something called WebHooks on Stripe.

 

WebHooks

WebHooks is just an HTTP Post Callback, that 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”.

Stripe Payment Gateway Integration

Also, Stripe gives let’s you pick what all events you want to get notified, as per our requirement. Like you can only select an event of “charge.succeeded” so you will only be notified just for that particular event.

By WebHooks, We can be 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 4 steps in following order:

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

Stripe Payment Gateway Integration

 

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, 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. 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.

 

Note:

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.

search

Blog Categories

Request a quote