We accept online payments from various methods, such as:
Credit or Debit cards (Visa, Mastercards, JCB, Diners Club & UnionPay, etc.)
e-Wallets (KHQR, Wing, PiPay, eMoney, Alipay, WeChat Pay, etc.)
Online Banking (ACLEDA XPay, CAMPU Direct Debit, Chip Mong Pay, AMK Online Card, Prince Bank QR, etc.)
Appendix I (1. PaymentId)
Demo App
Mobile Payment SDK - Android
Your application initializes the library.
After buyers complete their payments, the library returns a callback to your application with the status of the payment and the transaction id.
After the library flow is complete, an activity result will be posted to be received by your application.
No
Date
By
Version
Supports
Features
1
2022-Mar-06
kuntola
1.0.0
minSdk 21 --> targetSdk 31
- Redirect Payment
2
2022-May-09
kuntola
1.0.1
minSdk 21 --> targetSdk 31
- Open PlayStore if App's Deep-link not yet installed
Please share your AppId inside module build.gradle to IPay88 team:
android {
defaultConfig {
applicationId " xxx.xxx.xxx"
}
}
Then IPay88 team will setup your AppId into IPay88 system to allow you to use IPay88 Mobile Payment channel.
And then IPay88 team will share you these credentials:
2.1 Permissions inside AndroidManifest.xml
<manifest >
<uses-permission android : name =" android.permission.INTERNET" />
<uses-permission android : name =" android.permission.READ_PHONE_STATE" />
<uses-permission android : name =" android.permission.ACCESS_WIFI_STATE" />
<uses-permission android : name =" android.permission.CHANGE_WIFI_STATE" />
<uses-permission android : name =" android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android : name =" android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android : name =" android.permission.WRITE_EXTERNAL_STORAGE" />
</manifest >
2.2 ClientAppSecret inside AndroidManifest.xml
<manifest >
<application >
<meta-data
android : name =" kh.com.ipay88.sdk.ClientAppSecret"
android : value =" IPAY88-xxxxxxxxxxxxxxxxxxxxxxxxx" />
</application >
</manifest >
2.3 Dependencies (To get a Git project into your build)
Step 1. Add the JitPack repository to your build file
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
.. .
maven { url ' https://jitpack.io' }
}
}
If the above setting doesn't work, add it in your settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositories {
.. .
maven { url ' https://jitpack.io' }
}
}
Step 2. Add the IPay88 Payment SDK dependency
Add it in your module build.gradle inside dependencies:
dependencies {
implementation ' com.github.ipay88-kh:android-payment-sdk:1.0.1'
}
3. Payment Request & Response
3.1.1 Payment Request Object
public class kh .com .ipay88 .sdk .models .IPay88PayRequest
3.1.2 Payment Request Methods
Method Name
Required
Description
setEnvironment(Environment value)
Swtich between SANDBOX (default) & PRODUCION environment. Please refer to 3.1.3 Environment
setMerchantCode(String value)
✓
Merchant Code that provided by IPay88, E.g. KH00001
setMerchantKey(String value)
✓
Merchant Key that provided by IPay88.
setPaymentID(int value)
✓
PaymentId is the value to request payment method to appear on IPay88 landing page. Please refer to Appendix I (1. PaymentId)
setRefNo(String value)
✓
Reference number for merchant reference purposes, should be unique for each transaction.
setAmount(String value)
✓
Final Amount to pay and in 2 decimal point, E.g. 10.90
setCurrency(Currency currency)
✓
Currency of transaction. Please refer to 3.1.4 Currency
setProdDesc(String value)
✓
Simple Product Description. Note: Special characters is not allowed.
setUserName(String value)
✓
Customer name in merchant's system. E.g. John Woo
setUserEmail(String value)
✓
Customer email address in merchant's system with valid email format, E.g. [email protected]
setUserContact(String value)
✓
Customer contact number in merchant's system, E.g. 60123436789
setRemark(String value)
Remark for particular transaction. Note: Special characters is not allowed.
setBackendURL(String value)
✓
Specify a valid merchant callback URL when payment success. E.g. http://www.myshop.com/backend_page.php
public enum Environment {
SANDBOX ,
PRODUCTION
}
public enum Currency {
KHR ,
USD
}
3.2.1 Payment Response Object
public class kh .com .ipay88 .sdk .models .IPay88PayResponse
3.2.2 Payment Response Methods
Method Name
Required
Description
String getMerchantCode()
✓
Merchant Code provided by iPay88 and use to uniquely identify the Merchant. E.g. KH00001
int getPaymentID()
✓
Please refer to Appendix I (1. PaymentId) for possible PaymentId value return to BackendPostURL.
String getRefNo()
✓
The request Reference number for merchant reference purposes, should be unique for each transaction.
String getAmount()
✓
Payment amount with two decimals
String getCurrency()
✓
Currency code that based on standard ISO (KHR or USD)
String getRemark()
Remark for particular transaction.
String getTransID()
✓
iPay88 Transaction ID. E.g. T019988877700
String getAuthCode()
Bank reference number. Note: Sometime bank may not return reference number to gateway.
String getStatus()
✓
Use to indicate payment status “1” – Success OR “0” – Fail
String getErrDesc()
Payment status description. Please refer to Appendix I (3. Error Description)
String getSignature()
✓
SHA1 signature. Please refer to 5. Signature Response
4.1 Create Payment Request Object
// MARK: - Import SDK to your activity
import kh .com .ipay88 .sdk .constants .IPay88Constants ;
import kh .com .ipay88 .sdk .models .IPay88PayRequest ;
import kh .com .ipay88 .sdk .models .IPay88PayResponse ;
import kh .com .ipay88 .sdk .utils .IPay88SDK ;
// MARK: - Create 2 static variables to receive IPay88 payment response
static IPay88PayResponse payResponse ;
static String errorMsg ;
TextView tvStatus ;
// MARK: - IPay88 Checkout
IPay88PayRequest payRequest = new IPay88PayRequest ();
payRequest .setEnvironment (IPay88PayRequest .Environment .SANDBOX );
payRequest .setMerchantCode ("KH00001" );
payRequest .setMerchantKey ("Apple88KEY" );
payRequest .setPaymentID (1 );
payRequest .setRefNo ("ORD1188" );
payRequest .setAmount ("1.00" );
payRequest .setCurrency (IPay88PayRequest .Currency .USD );
payRequest .setProdDesc ("Top Up (SDK)" );
payRequest .setUserName ("Tola KUN" );
payRequest .setUserEmail ("[email protected] " );
payRequest .setUserContact ("017847800" );
payRequest .setRemark ("aOS" );
payRequest .setBackendURL ("http://www.myshop.com/backend_page.php" );
4.2 Create Payment Callback
Create a Java class and implement these 2 interfaces:
public interface kh .com .ipay88 .sdk .utils .IPay88Callback
public interface java .io .Serializable
public class MainActivityCallback implements IPay88Callback , Serializable {
@ Override
public void onResponse (IPay88PayResponse payResponse ) {
MainActivity .payResponse = payResponse ;
}
@ Override
public void onFailure (String message ) {
MainActivity .errorMsg = message ;
}
}
4.3 Invoke Checkout Function
IPay88SDK .checkout (MainActivity .this , payRequest , new MainActivityCallback ());
4.4 Handle Payment Response Object
@ Override
protected void onActivityResult (int requestCode , int resultCode , @ Nullable Intent data ) {
super .onActivityResult (requestCode , resultCode , data );
}
@ Override
protected void onActivityResult (int requestCode , int resultCode , @ Nullable Intent data ) {
super .onActivityResult (requestCode , resultCode , data );
// MARK: - IPay88 Payment Response
if (requestCode == IPay88Constants .PAY_REQUEST_CODE
&& resultCode == Activity .RESULT_OK
&& data != null
&& MainActivity .payResponse != null ) {
String status = MainActivity .payResponse .getStatus ().equals ("1" ) ? "SUCCESS" : "FAILED" ;
String json = IPay88PayResponse .GenerateJSONData (MainActivity .payResponse , true );
tvStatus .setText (status + "\n " + json );
} else if (requestCode == IPay88Constants .PAY_REQUEST_CODE
&& resultCode == Activity .RESULT_CANCELED
&& data != null
&& MainActivity .errorMsg != null ) {
tvStatus .setText (MainActivity .errorMsg );
}
}
If the Merchant request is successful the response message will contain as SHA1 hashed signature.
The hash signature for the response is a hash of the following fields:
1. MerchantKey (Provided by iPay88 and share between iPay88 and merchant only)
2. MerchantCode
3. PaymentId
4. RefNo
5. Amount
6. Currency
7. Status
The fields must be set in the following order, (MerchantKey & MerchantCode & PaymentId & RefNo & Amount & Currency & Status)
For Example:
MerchantKey = "Apple88KEY"
MerchantCode = "KH00001"
PaymentId = "1"
RefNo = "ORD1188"
Amount = "1.00" (Note: Remove the “.” and “,” in the string before hash)
Currency = "KHR"
Status = "1"
The hash would be calculated on the following string:
Apple88KEYKH00001ORD1188100KHR1
The resulting has signature value equals to (using SHA1 algorithm)
KiCecyU86ZOFk15jXwOAvHdw/1M=
Test URL: https://payment.ipay88.com.kh/epayment/testing/TestSignature_response.asp
Set PaymentId = 0, it will show all registered payment methods to the customer.
Payment Method Name
PaymentId (USD)
Logo
Credit Card
1
UnionPay
15
Payment Method Name
PaymentId (USD)
PaymentId (KHR)
Logo
eMoney
9
10
Pi Pay
11
Alipay
233
Wing
235
236
WeChat Pay
240
KHQR
248
249
Payment Method Name
PaymentId (USD)
PaymentId (KHR)
Logo
Acleda XPAY
3
4
Chip Mong Pay
238
239
Campu Direct Debit
242
243
AMK Online Card
246
247
Prince Bank QR
251
252
Currency Code
Description
KHR
Cambodia Riel
USD
US Dollar
Message
Description
Duplicate reference number
Reference number must be unique for each transaction.
Invalid merchant
The merchant code does not exist.
Invalid parameters
Some parameter posted to iPay88 is invalid or empty.
Overlimit per transaction
You exceed the amount value per transaction.
Payment not allowed
The Payment method you requested is not allowed for this merchant code, please contact iPay88 Support to verify what payment method available for the merchant account.
Permission not allow
Your AppId or the shared credentials is not match with the information registered in iPay88 merchant account. Please contact IPay88 team.
IPAY88SDK-Demo.apk