Integrating Razorpay Payment Gateway in your Flask E-Commerce app

python e-commerce flask html razorpay payment gateway

Razorpay is one of the most popular payment services in India with a significant amount of customers because of its ease of use. This is a  short, crisp, and precise tutorial on integrating the service on your python-based backends like Flask or Django. For this tutorial, we will be only focusing on Flask but a very similar approach is followed in Django as well. 

Creating a Razorpay account and obtaining the API keys

To begin with the tutorial, you first need to have an account on Razorpay. For starter plans, the Razorpay payment gateway charges 2% of each transaction as a platform fee. It is quite good considering the features you get out of the box.

Once you log in, you would see a drop-down to select Live Mode and Test Mode:

  • Live Mode shows all the legitimate payments that you would actually receive through your customers.
  • Test Mode is mainly for testing your payment gateway while developing the application.

The pipeline for both modes is basically the same. The only difference lies in API Key and Secret.

As shown in the dashboard below, all your transactions would be visible with Payment ID and Order ID.