# Download DirectPay Android SDK
# Specifications
DirectPay Mobile SDK (Android): 1.0.1
Minimum Sdk Version: 19
# Installation (Android Studio)
Right click on the project and choose "Project Structure".
On the top of the dialog click on + icon for New Module.
From the New Module dialog click on Import .JAR/.AAR Package and Next.
Select dpsdk.aar from filename and Click Finish.
# Usage
# Additional dependencies
implementation 'com.google.code.gson:gson:2.8.6'
1
# 1.1 Create DPSDK instance
DPSDK dpsdk = new DPSDK(
"API_KEY",
"YOUR_MERCHANT_ID",
"USER_ID",
"USER_NAME",
"+94731234567",
"emailifavailable@user.com"
);
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 1.2 Add Credit/Debit Card
dpsdk..addNewCard(MainActivity.this, new CardAddCallback() {
@Override
public void onSuccess(Card card) {
Log.d("SUCCESS", card.toString());
}
@Override
public void onError(int code, String message) {
Log.e("ERROR", code + " - " + message);
}
});
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# Sample Project
- Get the sample project (opens new window) from github.
# Error Codes
Error callback - error(code, message)
Code | Message |
---|---|
567 | CANNOT_VERIFY_THE_REQUEST |
568 | CANNOT_PROCESS |
569 | INVALID_SERVER_RESPONSE |
570 | SERVICE_UNAVAILABLE |
571 | INTERNAL_ERROR |
600 | USER_ACTION_CLOSE |
601 | TOO_LARGE_RETRY_ATTEMPTS |