Web Integration

This is a new API based integration provided by Cashfree. If you are integrating with Cashfree PG for the first time, we recommend that you use this integration.

In our latest version 2022-09-01, we have revamped Cashfree Payment Gateway integration to make it secure for merchants & customers while keeping it easy for merchants to integrate and customize the payment flows. If you plan to integrate with Cashfree APIs we recommend you try out these APIs.

Cashfree provides two environments, one being the sandbox environment for developers to test the payment flow & responses and the other being production environment which gets shipped to production. The URL for these are -
Production -> https://api.cashfree.com/pg/orders
Sandbox -> https://sandbox.cashfree.com/pg/orders

Access on the sandbox is provided for everyone.

👍

Prerequisite

We hope you have already created an account with Cashfree Payments and have the API keys ready to start the integration. If not, click here to know how to create an account.

This API integration allows you the flexibility to create a payment experience as you want. You can use our pre-built customisable checkout User Interface and either redirect the customers to Cashfree-hosted checkout page or collect payments on checkout page hosted at your end.

The integration can be completed in a few steps and should not take more than 30 minutes.

  1. Create Order with Cashfree from backend (Step 2 in the image below)
  2. Pay Order (Step 3 in the image below)
  3. Handle Redirection (Step 4 and 5 in the image below)
1476

Simplified payment flow

When a customer places an order on merchant website, merchant needs to create order in Cashfree's system. In response of that request Cashfree will return payment_session_id to you. It contains all the order details and your website uses it while initialising our Javascript SDK to initiate the payment. Then checkout page is loaded and customer chooses the payment method he wants to pay by and enters his details (like UPI ID/card number etc.) Cashfree uses these details to process the payment. Merchant verifies the payment and order status from Cashfree's backend and the same is shown to the customer on the website.

1300

Snapshot of integration using JS SDK

Resources

  1. You can try out the APIs from our postman collection
    Run in Postman
  2. Or you can also use the following user interface to try out the APIs
  3. Or you can test using our API Documentation

Ask a question about Integration

You can ask questions and participate in discussions about Cashfree PG API in the Cashfree Discord channel.


What’s Next

We will start with the (2) in the above diagram. You need to create an order with Cashfree.