cashfree_pg_sdk_cordova v1.4.3
Cordova/Ionic/Phonegap bindings for Cashfree's SDKs
Official Cordova/Ionic/Phonegap plugin for integrating Cashfree's checkout.
Supported platforms
- Android
- iOS
Note :: This plugin doesn't support capacitor ionic framework. It does support cordova ionic framework.
Installation:
Install the plugin
cd your-project-folder
cordova plugin add cashfree_pg_sdk_cordova
Step 1: Generate Token (From Backend)
You will need to generate a token from your backend and pass it to app while initiating payments. For generating token you need to use our token generation API.
Please note that this API is called only from your backend as it uses secretKey. Thus this API should never be called from App.
Request Description
For production/live
usage set the form action to:
https://api.cashfree.com/api/v2/cftoken/order
For test
usage set the form action to:
https://test.cashfree.com/api/v2/cftoken/order
You need to send orderId
, orderCurrency
and orderAmount
as a JSON object to the API endpoint and in response a token will received. Please see the description of request below.
curl -XPOST -H 'Content-Type: application/json'
-H 'x-client-id: <YOUR_APP_ID>'
-H 'x-client-secret: <YOUR_SECRET_KEY>'
-d '{
"orderId": "<ORDER_ID>",
"orderAmount":<ORDER_AMOUNT>,
"orderCurrency": "INR"
}' 'https://test.cashfree.com/api/v2/cftoken/order'
Request Example
Replace YOUR_APP_ID and YOUR_SECRET_KEY with actual values.
curl -XPOST -H 'Content-Type: application/json' -H 'x-client-id: YOUR_APP_ID' -H 'x-client-secret: YOUR_SECRET_KEY' -d '{
"orderId": "Order0001",
"orderAmount":1,
"orderCurrency":"INR"
}' 'https://test.cashfree.com/api/v2/cftoken/order'
Response Example
{
"status": "OK",
"message": "Token generated",
"cftoken": "v79JCN4MzUIJiOicGbhJCLiQ1VKJiOiAXe0Jye.s79BTM0AjNwUDN1EjOiAHelJCLiIlTJJiOik3YuVmcyV3QyVGZy9mIsEjOiQnb19WbBJXZkJ3biwiIxADMwIXZkJ3TiojIklkclRmcvJye.K3NKICVS5DcEzXm2VQUO_ZagtWMIKKXzYOqPZ4x0r2P_N3-PRu2mowm-8UXoyqAgsG"
}
The cftoken
is the token that is used authenticate your payment request that will be covered in the next step.
Usage code
Create order object
var params = {
"appId":<your x-client-id>,
"orderId":<order id>,
"orderAmount":<amount in string>,
"orderNote":<order note string>,
"customerName":<customer name string>,
"customerPhone":<customer phone string>,
"customerEmail":<customer email string>,
"notifyUrl":<notify url>,
"orderCurrency":<order currency>,
"stage":"TEST/PROD",
"tokenData":<ordertoken>}
Initiate and handle payment response
cordova.exec(function(success) {
}, //Success callback
function(error) {
}, // Error Callback
"PgCordovaWrapper",
"startPaymentWEB",
[params]);
1 year ago
1 year ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago