Stripe 101: How stripe payment API works?

Dhanraj Acharya
wineofbits
Published in
2 min readAug 7, 2018

--

If you have come here, then you already know that stripe is a platform to accept payments. This guide will describe how you can accept payments through stripe using any stack you use.

Sometimes, it is rather difficult for beginners to integrate stripe on their website. This guide does not give code snippets but provides overall flow while using stripe payments API in three simple steps.

Stripe Payment API 101

Step 1

The first step is to get the user details on the front-end of your website/application. This depends on the type of payment method you’re trying to integrate.

Stripe has SDK available for every front-end stack. You will use SDK to implement the form or redirect to the bank’s page.

The User will insert his detail and will allow the payment. Many hacking attacks happen due to the leakage of card/bank details and to avoid this, stripe creates a token from the submitted user details. You will get this token on your front-end application.

Note: Till now you have not charged the customer. You only have user’s stripe token.

Step 2

Once you have the stripe token, it is time to make the payment.

Send the stripe token to your back-end server. Use the stripe REST API directly or stripe SDK to charge the customer. Here you will need to specify the amount, stripe token, currency and your stripe secret key.

If you are using net banking or similar payment method such as Bancontact where the user is redirected to bank’s website for payment then you will have to check the status of the transaction by implementing a webhook.

Note: For more information about what is webhook, check this out.

Step 3

You will have to check the status of your last request to confirm whether the payment was successful or not.

In case of Bancontact or related payment methods, you will use webhook to confirm the payment.

The status is then rendered on the front-end to show it to the user.

Congratulations, you have successfully integrated stripe payment API in your website and you can start making $$$.

For more information,

check out the official stripe documentation.

Available payment methods in stripe.

Best Practises to follow while using stripe.

Conclusion

And that’s it! Did this work for you? Please leave any questions and comments below!

Thank you for reading!

If you found this article helpful, 👏👏👏.

--

--

Dhanraj Acharya
wineofbits

Full Stack Developer. I love experimenting with new tools and tech.