Checkout Options

You can set the checkoutOptions in the following way.

let checkoutOptions = {
    paymentSessionId: "your-payment-session-id"
}

paymentSessionId

typestring
Required

To make payment you will need a paymentSessionId, you can get this by making a create order API call to POST /orders. Please make sure you are using the correct hostname for the environment you want to process the payment for. In the response of POST /orders you will find payment_session_id. Note that this is a backend call so you will need to have a server. Read how to generate payment_session_id here

returnUrl

typestring
OPTIONAL

This is the url where your customers will be redirected after they have complete the payment. The returnURL has to have a wild card entry {order_id}. Cashfree will replace {order_id} with the actual order id that was used to create the order. Let us suppose your order_id is myorder123 and you have specified https://yourhost.com/{order_id} as your returnUrl then cashfree will redirect your customer to https://yourhost.com/myorder123. You can extract the order id here and call get order to confirm the payment status. Read more here. The checkout() promise resolves with {redirect: true}

redirectTarget

typestring
OPTIONAL

We also provide a way for you to decide how to redirect your customer. This takes all the values that are valid for hyperlink. Default is _self

ValueDescription
_blankOpens the linked document in a new window or tab
_selfOpens the linked document in the same frame as it was clicked (this is default)
_parentOpens the linked document in the parent frame
_topOpens the linked document in the full body of the window
_framename_Opens the linked document in the named iframe

Experience the all-new Cashfree Payments Docs! Faster, smarter, and easier to navigate. Check it out here!🎉