Cashfree Redirect CheckoutLast updated: 2022-11-11
This integration will redirect the customer to Cashfree’s user interface to capture payment details and complete the payment. For this integration you’ll be using our latest nextgen APIs and Javascript SDK. Start collecting payments by integrating out web checkout in following easy steps.
Setup
Required
API URL
https://sandbox.cashfree.com/pg
SDK SOURCE
<script type="text/javascript" src="https://sdk.cashfree.com/js/ui/2.0.0/cashfree.sandbox.js"></script>
Create Order
To process any payment on Cashfree PG, the merchant needs to create an order in the cashfree system. This order must be created from your backend (as it uses your secret key). Read more
POST /orders
Order Recipe
Response will come here
Initialize JS SDK
Once you receive payment_session_id from create order response, you need to use Cashfree's JS SDK 2.0.0 to redirect the customer to the web checkout page. Read more
Required
const paymentSessionId = "";
const cashfree = new Cashfree(paymentSessionId);
Redirect
Use redirect function to redirect to pre-built checkout page.
return cashfree.redirect();