Skip to content

This is the official cordova plugin for Cashfree payments.

License

Notifications You must be signed in to change notification settings

akilude/cordova-plugin-cashfree

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cashfree Cordova SDK Sample

GitHub Discord GitHub last commit (branch) GitHub release (with filter) GitHub forks GitHub Repo stars

Sample Banner Image

Description

Sample integration project for Cashfree Payment Gateway's Cordova SDK, facilitating seamless and secure payment processing within your Cordova application.

Supported platforms

  • Android
  • Cordova

Installation:

Install the plugin

cd your-project-folder

cordova plugin add cordova-plugin-cashfree-pg

Step 1: Generate Session ID (From Backend)

You will need to generate a sessionID from your backend and pass it to app while initiating payments.

API Doc Link - https://docs.cashfree.com/reference/createorder

Note: This API is called only from your backend as it uses secretKey. Thus this API should never be called from App.

Step 2: Create a Payment Object

Step 2.1: Create a Drop Payment Object

const dropPaymentObject = {
    "components": ["CARD", "UPI", "NB", "WALLET", "PAY_LATER"], //optional
    "theme": { //optional
        "navigationBarBackgroundColor": "#E64A19",
        "navigationBarTextColor": "#FFFFFF",
        "buttonBackgroundColor": "#FFC107",
        "buttonTextColor": "#FFFFFF",
        "primaryTextColor": "#212121",
        "secondaryTextColor": "#757575"
    },
    "session":  { //required
        "payment_session_id": "order_session_id",
        "orderID": "order_id",
        "environment": "SANDBOX" // "SANDBOX" or "PRODUCTION"
    }
}

Step 2.2: Create a UPI Payment Object

const upiPaymentObject = {
    "theme": { //optional
        "navigationBarBackgroundColor": "#E64A19", //ios
        "navigationBarTextColor": "#FFFFFF", //ios
        "buttonBackgroundColor": "#FFC107", //ios
        "buttonTextColor": "#FFFFFF", //ios
        "primaryTextColor": "#212121", 
        "secondaryTextColor": "#757575", //ios
        "backgroundColor": "#FFFFFF"
    },
    "session":  { //required
        "payment_session_id": "order_session_id",
        "orderID": "order_id",
        "environment": "SANDBOX" // "SANDBOX" or "PRODUCTION"
    }
}

Step 2.3: Create a Web Checkout Payment Object

const webPaymentObject = {
    "theme": { //optional
        "navigationBarBackgroundColor": "#E64A19",
        "navigationBarTextColor": "#FFFFFF"
    },
    "session":  { //required
        "payment_session_id": "order_session_id",
        "orderID": "order_id",
        "environment": "SANDBOX" // "SANDBOX" or "PRODUCTION"
    }
}

Step 3: SetCallback

Set the callback on the creation of your payment page.

const callbacks = {
    onVerify: function (result) {
        console.log("This is in the Application Verify: " + result);
        const orderId = result.orderID;
    },
    onError: function (error){
        console.log("This is in the Application Error: " + error);
        const orderID = error.orderID
        const status = error.status
        const code = error.code
        const type = error.type
        const message = error.message
    }
}
CFPaymentGateway.setCallback(callbacks) // onLoad of the Page

Step 4: Initiate Payment

Step 4.1: Initiate Drop Payment

CFPaymentGateway.doDropPayment(dropPaymentObject)

Step 4.2: Initiate Web Checkout Payment

CFPaymentGateway.doWebCheckoutPayment(webPaymentObject)

Step 4.2: Initiate Web Checkout Payment

CFPaymentGateway.doUPIPayment(upiPaymentObject)

Getting help

If you have questions, concerns, bug reports, etc, you can reach out to us using one of the following

  1. File an issue in this repository's Issue Tracker.
  2. Send a message in our discord channel. Join our discord server to get connected instantly.
  3. Send an email to [email protected]

Getting involved

For general instructions on how to contribute please refer to CONTRIBUTING.


Open source licensing and other misc info

  1. LICENSE
  2. CODE OF CONDUCT

About

This is the official cordova plugin for Cashfree payments.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 29.9%
  • Java 22.7%
  • TypeScript 15.2%
  • JavaScript 13.9%
  • CSS 11.0%
  • HTML 7.3%