1. Setting up the SDK

Gradle Changes

Add Cashfree maven repository

Add to your module's build.gradle file if your gradle version is less than 6.+ or below.

🚧

Note

Maven repository is only needed upto SDK version v2.0.3. From v2.0.4 onwards you can remove cashfree maven repository.

repositories 
{
    maven 
    { 
      url 'https://maven.cashfree.com/release'
      content {
        includeGroup "com.cashfree.pg"
	    }
    }
}

If you are using Gradle version 7.+ in your project then add the maven repository in your settings.gradle file

dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
  repositories {
  ...
    maven 
    { 
      url 'https://maven.cashfree.com/release'
    }
  }
}

add the following lines to the dependencies section of the build.gradle file

implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.gridlayout:gridlayout:1.0.0'

implementation 'com.cashfree.pg:api:2.1.6'

You can use the ChangeLog to get the latest version of the SDK here.

Application Integrity

The latest versions of our Android SDK(1.1.0 and newer) comes with Play Integrity API integration which prevents applications from using our payment features if the application is distributed outside of playstore. This enables us to protect our merchants from potentially risky and fraudulent interactions, such as cheating and unauthorized access, allowing us to respond with appropriate actions to prevent attacks and reduce abuse.

Apps on Google Play

In the Play Console, navigate to the Release section of the left menu. Go to Setup > App integrity. Select the Integrity API tab and enable it.

Click on the "Link project" which will open a setup page where you can link it with a Google Cloud Project which has this API enabled or select "Create new project" and all the necessary setup is automatically handled by google play store.

1074

Click on the "Link project" button, It'll open a setup page where you can link it with an existing Google Cloud Project which has Google Play Integrity API enabled or select "Create new project" and all the necessary setup is automatically handled by google play store.

Apps distributed outside Google Play Store

If your application is distributed outside of the play store get in touch with your account manager or write an email to [email protected].

Android Package Whitelisting

The newest versions of our Android SDK(2.0.0 and newer) will require your android package to be whitelisted in cashfree's system to use the SDK Checkout elements. Whitelisting request can be made from Developers>Whitelisting

You can check step-by-step process of making whitelisting request here.

📘

Note

Please ensure you enter correct android package for the whitelisting.
Android Package example -
com.cashfree.merchant (correct)