Skip to content

SDK Installation

Raka Westu Mogandhi edited this page Nov 25, 2016 · 28 revisions

We publish our SDK to bintray repository. Please add bintray in your repository list(as below)

Gradle Setup

Following bintray repository needs to be added to your repository section in build.gradle

repositories {
    jcenter()
        // Add the midtrans repository into the list of repositories
        maven { url "http://dl.bintray.com/pt-midtrans/maven" }
    }

Core Flow SDK Installation

Add one of SDK codeflow installation following into your build.gradle

dependencies {
    // For using the Veritrans Sandbox
    compile 'com.midtrans:corekit:$VERSION-SANDBOX'
    // For using the Veritrans Production
    compile 'com.midtrans:corekit:$VERSION'
}

UI Flow SDK Installation

Add one of SDK uiflow installation following into your build.gradle

dependencies {
    // For using the Veritrans Sandbox
    compile 'com.midtrans:uikit:$VERSION-SANDBOX'
    // For using the Veritrans Production
    compile 'com.midtrans:uikit:$VERSION'
}

Adding external card scanner (Using Card.io library)

We provide a plugin to integrate card.io for allowing customers to read the credit card/debit card information using the mobile phone camera.

You can add external card scanner using ScanCardLibrary implementation by adding this code block into your build.gradle.

   //..other dependencies
   compile ('com.midtrans:scancard:$VERSION'){
      exclude module: 'uikit'
   }

Product Flavor Definition (Optional)

Add the Merchant server URL (MERCHANT_BASE_URL) and the Veritrans client key (CLIENT_KEY) in the MAP configuration into your build.gradle file.

Note:

  • MERCHANT_BASE_URL (PRODUCTION AND/OR SANBDOX) is merchant API endpoint that implemented basic requirement of merchant server reference.
  • We have different CLIENT_KEY values for SANDBOX and PRODUCTION so it's better if you have two flavors in build.gradle script and define them here.
productFlavors {
        development {
            buildConfigField "String", "BASE_URL", <MERCHANT_BASE_URL_SANDBOX>
            buildConfigField "String", "CLIENT_KEY", <MERCHANT_CLIENT_KEY_SANDBOX>
        }
        production {
            buildConfigField "String", "BASE_URL", <MERCHANT_BASE_URL_PRODUCTION>
            buildConfigField "String", "CLIENT_KEY", <MERCHANT_CLIENT_KEY_PRODUCTION>
        }
}

Modify Manifest (Optional)

This can be skipped since gradle build will automatically add these permissions.

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Proguard Rules

Merchants don't need to add any proguard rules to their app. This SDK will automatically add the rules when merchant enable the proguard build.

Clone this wiki locally