Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Coresdk integration instruction

Step 1: Add Core SDK

Android Studio

From your project, create a new module from paymentwall-android-sdk.aar

After that add this line in your app module's build.gradle:

compile project(':paymentwall-android-sdk')


Extract and import the project into your workspace. And add this as your main project's library.

Declare required permission

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

Declare required activity

   android:windowSoftInputMode="stateVisible|adjustResize|adjustPan" />

Step 2: Build Unified Payment Params

Import needed classes to your app activity

import com.paymentwall.pwunifiedsdk.core.PaymentSelectionActivity;
import com.paymentwall.pwunifiedsdk.core.UnifiedRequest;
import com.paymentwall.pwunifiedsdk.util.Key;
import com.paymentwall.pwunifiedsdk.util.ResponseCode;

Define the request from your activity

UnifiedRequest request = new UnifiedRequest();

Set payment params


setTimeout(int timeout): set max duration for request (in milliseconds)

Set item’s image: please refer to guidance below on how to set item's image.

Set item image for the request

There are some data types of an item’s image you can pass to Paymentwall SDK. You can choose one in 4 below options:

//From url
setItemUrl(String itemUrl);

//From file
setItemFile(File itemFile);

//From resource
setItemResID(int itemResID);

//Content provider(image's URI converted to string)
setItemContentProvider(String itemContentProvider);

Step 3: Add Payment methods

You can choose one or more payment methods according to your needs.

Step 4: Set Custom Pingback Parameters (Optional)

Add custom parameters

By default, Pingback will send goodsid and ref to your server. To satisfy the needs for more information, Paymentwall Android Sdk allows to add extra parameters which can be used for pingback. Example code:

request.addCustomParam("timeStamp", System.currentTimeMillis() / 1000 + "");
request.addCustomParam("own_order_id", "o123456");
request.addCustomParam("shopname", "ecopark");

Multiple parameters are supported.

Step 5: Launch SDK and Handle Callback

Launch the SDK

Intent intent = new Intent(getApplicationContext(), PaymentSelectionActivity.class);
intent.putExtra(Key.REQUEST_MESSAGE, request);
startActivityForResult(intent, PaymentSelectionActivity.REQUEST_CODE);

Handle the callback

Paymentwall SDK callback falls in onActivityResult(int requestCode, int resultCode, Intent data) Result code is one of those constants in ResponseCode class.

switch (resultCode) {
   case ResponseCode.ERROR:
       // There is an error with the payment
   case ResponseCode.CANCEL:
       // User cancels the payment
   case ResponseCode.SUCCESSFUL:
       // The payment is successful
   case ResponseCode.FAILED:
       // The payment was failed
   case ResponseCode.MERCHANT_PROCESSING:
       // This case is only for Brick. If nativeDialog set to false,
       // means that merchant displays successful payment dialog by himself
       // so the sdk will return brick token and this resultCode to merchant app

Step 6: UI Customization (optional)

There are two ways for UI modification which Paymentwall Sdk supports:

  • UI plugins: add plugin for UI designed by Paymentwall.
  • Custom theme: adding several lines of codes in core SDK, the style is determined by you.

Custom theme

Firstly, create a new style in your styles.xml

<style name="PwsdkCustomTheme" parent="@style/PaymentwallSDKTheme">

with PaymentwallSDKTheme is the default theme for the sdk.

We support the changeable components as in the list below:

        <attr name="colorMain" format="color" />
        <attr name="textMain" format="color" />
        <attr name="mainBackground" format="integer" />
        <attr name="bgProductInfo" format="color" />
        <attr name="bgProductInfoLand" format="color" />
        <attr name="textProductInfo" format="color" />
        <attr name="bgPsButton" format="integer" />
        <attr name="textPsButton" format="color" />
        <attr name="textCopyright" format="color" />
        <attr name="bgInputForm" format="integer" />
        <attr name="bgInputErrorForm" format="integer" />
        <attr name="textInputForm" format="color" />
        <attr name="textInputErrorForm" format="color"/>
        <attr name="iconErrorForm" format="integer"/>
        <attr name="textFormTitle" format="color" />
        <attr name="bgConfirmButton" format="integer" />
        <attr name="textConfirmButton" format="color" />
        <attr name="backButton" format="integer"/>
        <attr name="bgExpDialog" format="color"/>
        <attr name="textExpDialog" format="color"/>
        <attr name="monthButtonNormal" format="integer"/>
        <attr name="monthButtonPressed" format="integer"/>
        <attr name="textMonth" format="color"/>
        <attr name="yearLeftArrow" format="integer"/>
        <attr name="yearRightArrow" format="integer"/>
        <attr name="bgNotifyDialog" format="color"/>
        <attr name="progressColor" format="color"/>
        <attr name="successIcon" format="integer"/>
        <attr name="failIcon" format="integer"/>
        <attr name="textProgress" format="color"/>
        <attr name="textSuccess" format="color"/>
        <attr name="textFail" format="color"/>
        <attr name="textExtraMessage" format="color"/>
        <attr name="iconPwlocal" format="integer" />

You can modify any component you want by adding it in your custom style. Example:

<style name="PwsdkCustomTheme" parent="@style/PaymentwallSDKTheme">
        <item name="colorMain">@color/baseRedFont</item>
        <item name="textMain">@color/white</item>
        <item name="mainBackground">@color/pw_secondary_color</item>
        <item name="bgProductInfo">@color/pw_primary_color</item>
        <item name="bgProductInfoLand">@color/pw_primary_color</item>
        <item name="textProductInfo">#FF0000</item>

Finally, apply the theme for PaymentSelectionActivity in the AndroidManifest.xml:


Declare tools namespace in the manifest tag:


Payment methods integration details


Step 1: Add Brick Payment Method


If only Brick is added into request, Brick payment will be displayed directly.

NOTE: If you are asked to add bank information in footer, please add code below:


Step 2: Handle One-time Token

One-time token is automatically obtained by the SDK. You need to register for a broadcast receiver in your activity/service to get the token sent from the sdk:

BroadcastReceiver receiver = new BroadcastReceiver() {
   public void onReceive(Context context, Intent intent) {
       if (intent.getAction().equalsIgnoreCase(getPackageName() + Brick.BROADCAST_FILTER_MERCHANT)) {
           String brickToken = intent.getStringExtra(Brick.KEY_BRICK_TOKEN);
           String userEmail = intent.getStringExtra(Brick.KEY_BRICK_EMAIL);
           String cardHolderName = intent.getStringExtra(Brick.KEY_BRICK_CARDHOLDER);
          //process your business logic


Then you can use the one-time token to create a charge.

Step 3: Create A Charge

After obtaining one-time token, send a request from backend to Paymentwall server to create a charge.

POST request to:

Parameters and description can be referred here.

Step 4: Handle Charge Response

Brick.getInstance().setResult(result, token);

result: 1 or 0 (success or failed)

token: the permanent token from charge object you get, if the charge is success.

If the response is charge object, you need to extract the permanent token and send it back to the SDK:


If the response is 3d secure form, the following is returned in the response body:


You need to parse and obtain the 3ds url and then send it back to the sdk:


3ds form will be opened in SDK's native webview. After 3ds is completed, please redirect the form to your website and return a charge object in HTTP response, so SDK can detect the event and close the webview. 3ds webview can also be closed with Brick.getInstance().setResult(result, token)

Note: If 3ds is omitted, charge object will be returned in response.

If the response is an error object, please set error in the place of token.

Brick.getInstance().setResult(0, errorMessage);

Step 5: Card Scanner Plugin (Optional)

By compiling CardScanner plugin, users are allowed to use their phone camera to scan credit cards for card number and expired date. Please refer here for integration guidance.


Add Mint payment method



Step 1: Declaration

Declare required permissions in AndroidManifest

<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
   android:label="Request for sending mobiamobroadcast to Mobiamo"
   android:protectionLevel="signature" />

<uses-permission android:name="${applicationId}.mobiamo.PAYMENT_BROADCAST_PERMISSION" />

Declare Mobiamo activity and broadcast receiver

       <action android:name="com.paymentwall.mobiamosdk.SENT_SMS_ACTION"></action>

   android:theme="@android:style/Theme.Translucent.NoTitleBar" />

Step 2: Add Mobiamo From UnifiedRequest Object



Step 1: Declare required activity

   android:theme="@android:style/Theme.Translucent" />

Step 2: Add PwLocal Payment Method


Step 3: Add Extra parameters

Use addPwlocalParams(String key, String value) method to add extra params for Pwlocal.

Some params are automatically added by SDK (taken from UnifiedRequest object you declared above), so you don't need to add them for a second time.

  • prices
  • amount
  • currencyCode
  • ag_name
  • ag_external_id
  • uid

Extra params list can be referred to here.

Sample code:

request.addPwlocalParams(Const.P.EMAIL, "fixed");
request.addPwlocalParams(Const.P.WIDGET, "pw");
request.addPwlocalParams(Const.P.EVALUATION, "1");


Paymentwall SDK supports external payment system injection (which are in our defined payment system (PS) list). Each time you import an external PS, all you need to do are adding that native sdk (if available) of PS and our adapter (produced for that one) to your project, make the params and then pass to our core Sdk.

Step 1: Building .gradle File

Add compilation lines for external ps sdk and adapter in your main app module build.gradle file

compile project(':pandappsdk')
compile project(':alipayadapter')
compile files('libs/alipaySdk-20160825.jar')

Step 2: Initialzing

Initialize an external PS and add to UnifiedRequest

public ExternalPs(String id , String displayName, int iconResId, Serializable params)

id: payment system’s id

displayName: label of the ps displayed on the button.

iconResId: PS logo resource id

Params: parameters object passed to core sdk (varies among different PS).

Step 3: Add Payment Options

Add external ps object to UnifiedRequest object.

request.add(ps1, ps2,...);
You can’t perform that action at this time.