Skip to main content
More in Learn

Razorpay Payment Integration

Razorpay is an Indian payment company that allows businesses to accept payments. The company offers payment processing software and application programming interfaces (APIs) for e-commerce websites and mobile applications.

Getting Razorpay Credentials

To get started, you need to create a Razorpay account. The Razorpay developer documentation provides all the resources you will need to optimize your payment integration. Please note that you will need an Indian phone number as well as your PAN number to finish the sign up process. After getting an account, you get:

  • A key ID
  • A secret key

These act as an authorization header for every request you make to the Razorpay API. The header is simple a base64 encoded string of RAZORPAY_KEY_ID:RAZORPAY_KEY_SECRET.

Remix Run - Furniture Boilerplate - Example

The Remix Run Furniture v2 boilerplate includes a full Razorpay integration, including a way to verify the signature sent back by the API. To make it easier to test things out, a Postman collection featuring all the requests is provided by the API.

On the checkout page, we render the Razorpay payment button, click on which does 2 things:

  • makes the cart immutable
  • creates an order in Razorpay

In this boilerplate, we decided to save the cart in our own service layer, so we push the order to Crystallize only when the payment is successful.

When the user clicks the button, a modal opens which prompts the user for their payment details. Once the payment is done, a new payment is created in Razorpay and the API returns the following:

  • orderCreationID
  • razorpayPaymentID
  • razorpayOrderID
  • razorpaySignature

The signature is what we use to verify the payment. If the payment is successful, we do the following:

  • create the order in Crystallize
  • updates the cart from placed to paid, allowing the waiting page to update to the order confirmation

This boilerplate is also using our Node Service API Request Handlers that include handlers to speed up your Razorpay integration.

People showing thumbs up

Need further assistance?

Ask the Crystallize team or other enthusiasts in our slack community.

Join our slack community