1.4.3 • Published 1 year ago

cashfree_pg_sdk_cordova v1.4.3

Weekly downloads
15
License
ISC
Repository
-
Last release
1 year ago

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.4.5-rc.1

1 year ago

1.4.5-dev.0

1 year ago

1.4.3

2 years ago

1.4.4-rc.1

1 year ago

1.4.4-rc.2

1 year ago

1.4.2

2 years ago

1.4.2-dev.1

2 years ago

1.4.2-dev.2

2 years ago

1.4.1

2 years ago

1.4.1-dev.1

2 years ago

1.4.0

3 years ago

1.3.6-dev.2

3 years ago

1.3.5

3 years ago

1.3.5-dev.2

3 years ago

1.3.5-dev.1

3 years ago

1.3.4-support.1

3 years ago

1.3.4-support.2

3 years ago

1.3.5-dev.0

3 years ago

1.3.4-support

3 years ago

1.3.4-support.0

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.3.0

4 years ago

0.2.9

4 years ago

0.2.8

4 years ago

0.2.1

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.0

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago