SSLcommerz payment gateway integration (Sandbox)

Step 1 : Go to this link and register .

Step 2 : Login account with

Step 3 : Go to console and click developer tab . you can now download android sdk file . You will find .aar file . Now follow the steps . You also get a manual but it’s not enough for android studio . or Download it from here : ANDROID_190617


  1. Place the ssl-payment-sdk-v4.aar file in your project’s lib folder.
  2. To include the SDK file go to File > New > New Module… > import .JAR/.AAR package > file name (browse the ssl-payment-sdk-v4.aar file) and press enter.
  3. Right click on your Android Studio Project and go to Open Module Settings. Click on your Application Name and then click Press + sign and go to Module Dependency. Click on ssl-payment-sdk-v4 and click ok.

4.     Include the following library to your app label gradel. If your already include any library from the following list , then don’t need to again that particular library. 

5.  compile project(‘:ssl-payment-sdk-v4’) and sync in gradle file project app folder .

 MandatoryFieldModel mandatoryFieldModel = new MandatoryFieldModel("testbox","qwerty","10", "1012", CurrencyType.BDT, SdkType.TESTBOX, SdkCategory.BANK_LIST);/*Mandatory Field For Specific Bank Page*/
 MandatoryFieldModel mandatoryFieldModel = new MandatoryFieldModel("testbox","qwerty","10", "1012", CurrencyType.BDT, SdkType.TESTBOX, SdkCategory.BANK_PAGE, BankName.DBBL_VISA);
 /*Optional Fields*/
 CustomerFieldModel customerFieldModel = new CustomerFieldModel("Customer Name","Customer Email Address", "Customer Address 1", "Customer Address 2", "Customer City", "Customer State", "Customer Post Code", "Customer Country", " Customer Phone", "Customer Fax");
 ShippingFieldModel shippingFieldModel = new ShippingFieldModel("Shipping Name", "Shipping Address 1","Shipping Address 2","Shipping City", "Shipping State", "Shipping Post Code", "Shipping Country" );
 AdditionalFieldModel additionalFieldModel = new AdditionalFieldModel();
 additionalFieldModel.setValueA("Value Option 1");
 additionalFieldModel.setValueB("Value Option 1");
 additionalFieldModel.setValueC("Value Option 1");
 additionalFieldModel.setValueD("Value Option 1");
 /*Call for the payment*/
 PayUsingSSLCommerz.getInstance().setData(this,mandatoryFieldModel,customerFieldModel,shippingFieldModel,additionalFieldModel,new OnPaymentResultListener() {
 public void transactionSuccess(TransactionInfo transactionInfo) {
 // If payment is success and risk label is 0.
 if(transactionInfo.getRiskLevel().equals("0")) {
             Log.d(TAG, "Transaction Successfully completed");
 // Payment is success but payment is not complete yet. Card on hold now.
             Log.d(TAG, "Transaction in risk. Risk Title : "+transactionInfo.getRiskTitle().toString());
 public void transactionFail(TransactionInfo transactionInfo) {
 // Transaction failed
 Log.e(TAG, "Transaction Fail");
 public void error(int errorCode) {
 switch (errorCode){
 // Your provides information is not valid.
 case ErrorKeys.USER_INPUT_ERROR :
                 Log.e(TAG, "User Input Error" );break;
 // Internet is not connected.
                 Log.e(TAG, "Internet Connection Error" );break;
 // Server is not giving valid data.
 case ErrorKeys.DATA_PARSING_ERROR :
                 Log.e(TAG, "Data Parsing Error" );break;
 // User press back button or canceled the transaction.
                 Log.e(TAG, "User Cancel The Transaction" );break;
 // Server is not responding.
 case ErrorKeys.SERVER_ERROR :
                 Log.e(TAG, "Server Error" );break;
 // For some reason network is not responding
 case ErrorKeys.NETWORK_ERROR :
                 Log.e(TAG, "Network Error" );break;

Download project


Leave a Reply

Your email address will not be published. Required fields are marked *