Cashfree libraries are in Beta. It is a work in progress, and we are continuously working on improving various aspects of it, releasing as a learning aid and an example kit for the API integrators. Cashfree does not recommend this for direct use in production code. Please report any bugs to Cashfree at [email protected].

Cashfree has build libraries for different programming languages. Here are the listed language-wise libraries:

  • Node
  • Java
  • Python

Node

The preferred way to install the Cashfree library for Node.js is to use the npm package manager for Node.js. Simply type the following command into a terminal window:

npm i cashfree-sdk

Run the following command to initialize the payouts library.

//require CashfreeSDK
const cfSdk = require('cashfree-sdk');

//access the PayoutsSdk from CashfreeSDK
const {Payouts} = cfSdk;

// Instantiate Cashfree Payouts
const payoutsInstance = new Payouts({
  env: 'TEST',
  clientId: '<CLIENT_ID>',
  clientSecret: '<CLIENT_SECRET>',
});

// Instantiate Cashfree Payouts
const payoutsInstance = new Payouts({
  env: 'TEST',
  clientId: '<CLIENT_ID>',
  clientSecret: '<CLIENT_SECRET>',
  pathToPublicKey: '/path/to/your/public/key/file.pem',
  //"publicKey": "ALTERNATIVE TO SPECIFYING PATH (DIRECTLY PASTE PublicKey)"
});

Check our API docs or see the code in GitHub.

Java

Cashfree Java library gets stored as a jar in Maven Central. You can install them in your maven and gradle projects by adding the following in your build files.
For Maven project, add the following to your pom.xml file:

<dependency>
   <groupId>com.cashfree</groupId>
   <artifactId>cashfreelibjava</artifactId>
   <version>0.0.6</version>
</dependency>

For Gradle project, add the following to your gradle.build file:

compile 'com.cashfree:cashfreelibjava:0.0.6'

To initialize the payouts library run:

import com.cashfree.lib.clients.Payouts;
import com.cashfree.lib.constants.Constants.Environment;

public static void main() {
Payouts payouts = Payouts.getInstance(
    Environment.PRODUCTION, "<client_id>", "<client_secret>");
payouts.init();
}

Check our API docs or see the code in GitHub.

Python

The preferred way to install the Cashfree library for Python is to install it using pip3. Enter the following command into a terminal window. Cashfree's python library works only for python version 3.5 and above.

pip3 install cashfree-sdk

To initialise the payouts library run:

from cashfree_sdk.payouts import Payouts

//Initialize Cashfree Payout
Payouts.init("<client_id>", "<client_secret>", "PROD")
// OR for dynamic IP's
Payouts.init("<client_id>", "<client_secret>", "PROD", public_key= b'public key')

Check our API docs or see the code in GitHub.