Bohudur Android SDK
Developer-friendly Android payment SDK for Bohudur Payment Gateway.
Easily create, execute, and query payments inside Android apps with minimal code.
Features
- Simple builder-style API
- Secure API key authentication
- Hosted checkout flow
- Execute & query payments
- Query payment status anytime
- Webhook support (server-side)
- Volley-based networking
- Java & Android Studio ready
Requirements
- Minimum SDK: 21+
- Target SDK: 28+
- Java: 8+
- Internet permission
xml
<uses-permission android:name="android.permission.INTERNET"/>Installation
Step 1: Add JitPack
settings.gradle
gradle
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}Step 2: Add Dependency
gradle
dependencies {
implementation 'com.github.bohudur:bohudur-android-sdk:1.2.2'
}Initialization
js
import bohudur.payment.sdk.Bohudur;
String API_KEY = "YOUR_API_KEY";
Bohudur bohudur = new Bohudur(this, API_KEY);ts
import bohudur.payment.sdk.Bohudur
val apiKey = "YOUR_API_KEY"
val bohudur = Bohudur(this, apiKey)Create a Payment
java
bohudur.setFullName("Jane Doe");
bohudur.setEmail("user@gmail.com");
bohudur.setAmount(10);
bohudur.setReturnType(Bohudur.Type.GET());
bohudur.request(new PaymentResponse() {
@Override
public void onPaymentSuccess(SuccessResponse response) {
// Payment executed successfully
}
@Override
public void onPaymentCancelled(FailureResponse response) {
// Payment cancelled or failed
}
});kotlin
bohudur.setFullName("Jane Doe")
bohudur.setEmail("user@gmail.com")
bohudur.setAmount(10.0)
bohudur.setReturnType(Bohudur.Type.GET())
bohudur.request(
onPaymentSuccess = { response ->
println("Payment executed successfully: ${response.amount}")
},
onPaymentCancelled = { failure ->
println("Payment failed: ${failure.message}")
}
)Lambda Expression
java
bohudur.request(response -> {
// onPaymentSuccess
System.out.println("Success: " + response.getAmount());
}, failure -> {
// onPaymentCancelled
System.out.println("Failed: " + failure.getMessage());
});kotlin
bohudur.request(
onPaymentSuccess = { response ->
println("Success: ${response.amount}")
},
onPaymentCancelled = { failure ->
println("Failed: ${failure.message}")
}
)What Happens Internally
- Payment session is created
- Hosted checkout page is opened
- User completes or cancels payment
- SDK executes payment automatically
- Callback returns success or failure
Webhooks (Server-Side)
java
bohudur.setWebhookSuccessUrl("https://example.com/success.php")
bohudur.setWebhookCancelUrl("https://example.com/cancel.php");kotlin
bohudur.setWebhookSuccessUrl("https://example.com/success.php")
bohudur.setWebhookCancelUrl("https://example.com/cancel.php")Webhook payloads are sent via POST (JSON). Always verify webhook data using the Query API.
Metadata
To attach any extra data to the payment, use metadata. You can add as many key-value pairs as needed.
java
bohudur.addMetadata("order_id", "ORD-1001");
bohudur.addMetadata("user_id", 5541);
bohudur.addMetadata("platform", "android");kotlin
bohudur.addMetadata("order_id", "ORD-1001")
bohudur.addMetadata("user_id", 5541)
bohudur.addMetadata("platform", "android")Success Response
java
public void onPaymentSuccess(SuccessResponse response) {
response.getAmount();
response.getEmail();
response.getPaymentCurrency();
response.getStatus(); // EXECUTED
}kotlin
fun onPaymentSuccess(response: SuccessResponse) {
println(response.amount)
println(response.email)
println(response.paymentCurrency)
println(response.status) // EXECUTED
}Available Getters
| Method | Description |
|---|---|
getFullName() | Customer name |
getEmail() | Customer email |
getAmount() | Original amount |
getConvertedAmount() | Converted amount |
getTotalAmount() | Total charged |
getTransactionFee() | Transaction fee |
getDefaultCurrency() | Account currency |
getPaymentCurrency() | Paid currency |
getCurrencyValue() | Conversion rate |
getCreatedTime() | Creation time |
getPaymentTime() | Payment time |
getReceipt() | Receipt Download URL |
getPaymentInfo() | Gateway info |
getMetadata() | Custom metadata |
getStatus() | EXECUTED |
Payment Info By Gateways
json
{
"payment_info": {
"id": 1,
"gateway": "bkash",
"method": "Send Money",
"number": "01XXXXXXXXX",
"amount": 100,
"trx": "TRX123ABC456",
"time": "01/01/2026 12:00",
"m0": "Bkash Send Money"
}
}json
{
"payment_info": {
"id": 1,
"gateway": "nagad",
"method": "Send Money",
"number": "01XXXXXXXXX",
"amount": 100,
"trx": "TRX123ABC456",
"time": "01/01/2026 12:00",
"m0": "Nagad Send Money"
}
}json
{
"payment_info": {
"id": 1,
"gateway": "rocket",
"method": "Send Money",
"number": "01XXXXXXXXX",
"amount": 100,
"trx": "TRX123ABC456",
"time": "01/01/2026 12:00",
"m0": "Rocket Send Money"
}
}json
{
"payment_info": {
"id": 1,
"gateway": "upay",
"method": "Send Money",
"number": "01XXXXXXXXX",
"amount": 100,
"trx": "TRX123ABC456",
"time": "01/01/2026 12:00",
"m0": "Upay Send Money"
}
}json
{
"payment_info": {
"id": 1,
"gateway": "mcash",
"method": "Send Money",
"number": "01XXXXXXXXX",
"amount": 100,
"trx": "TRX123ABC456",
"time": "01/01/2026 12:00",
"m0": "mCash Send Money"
}
}json
{
"paymentID": "TRX_PAYMENT_ID_EXAMPLE",
"trxID": "TRX123ABC456",
"transactionStatus": "Completed",
"amount": "100",
"currency": "BDT",
"intent": "sale",
"paymentExecuteTime": "2026-01-01T12:00:00 GMT+0600",
"merchantInvoiceNumber": "invoice_demo_12345",
"payerType": "Customer",
"payerReference": "CUSTOMER_REF",
"customerMsisdn": "01XXXXXXXXX",
"payerAccount": "01XXXXXXXXX",
"maxRefundableAmount": "100",
"statusCode": "0000",
"statusMessage": "Successful",
"m0": "Bkash Merchant"
}json
{
"status": "VALID",
"tran_date": "2026-01-01 12:00:00",
"tran_id": "SSLCZ_DEMO_TRANSACTION",
"val_id": "VALIDATION_ID_EXAMPLE",
"amount": "100.00",
"store_amount": "97.50",
"currency": "BDT",
"bank_tran_id": "BANK_TRANSACTION_ID",
"card_type": "NAGAD-Nagad",
"card_no": "",
"card_issuer": "Nagad",
"card_brand": "MOBILEBANKING",
"card_category": "MOBILE",
"card_sub_brand": "",
"card_issuer_country": "Bangladesh",
"card_issuer_country_code": "BD",
"currency_type": "BDT",
"currency_amount": "100.00",
"currency_rate": "1.0000",
"base_fair": "0.00",
"value_a": "",
"value_b": "",
"value_c": "",
"value_d": "",
"emi_instalment": "0",
"emi_amount": "0.00",
"emi_description": "",
"emi_issuer": "Nagad",
"account_details": "",
"risk_title": "Safe",
"risk_level": "0",
"discount_percentage": "0",
"discount_amount": "0.00",
"discount_remarks": "",
"APIConnect": "DONE",
"validated_on": "2026-01-01 12:00:10",
"gw_version": "",
"offer_avail": 1,
"card_ref_id": "CARD_REFERENCE_ID_EXAMPLE",
"isTokeizeSuccess": 0,
"campaign_code": "",
"m0": "SSLCommerz"
}json
{
"id": "pi_demo_payment_intent",
"object": "payment_intent",
"amount": 10000,
"amount_capturable": 0,
"amount_details": {
"tip": []
},
"amount_received": 10000,
"application": null,
"application_fee_amount": null,
"automatic_payment_methods": null,
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic_async",
"client_secret": "pi_demo_payment_intent_secret_example",
"confirmation_method": "automatic",
"created": 1767225600,
"currency": "usd",
"customer": null,
"customer_account": null,
"description": "Demo Payment",
"excluded_payment_method_types": null,
"last_payment_error": null,
"latest_charge": "ch_demo_charge_id",
"livemode": false,
"managed_payments": {
"enabled": false
},
"metadata": [],
"next_action": null,
"on_behalf_of": null,
"payment_details": {
"customer_reference": null,
"order_reference": "ORDER_REFERENCE_EXAMPLE"
},
"payment_method": "pm_demo_payment_method",
"payment_method_configuration_details": null,
"payment_method_options": {
"card": {
"installments": null,
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"presentment_details": {
"presentment_amount": 12000,
"presentment_currency": "bdt"
},
"processing": null,
"receipt_email": "customer@example.com",
"review": null,
"setup_future_usage": null,
"shared_payment_granted_token": null,
"shipping": null,
"source": null,
"statement_descriptor": null,
"statement_descriptor_suffix": null,
"status": "succeeded",
"transfer_data": null,
"transfer_group": null,
"m0": "Stripe"
}json
{
"uid": 123456789,
"counterpartyId": 987654321,
"orderId": "ORDER_ID_EXAMPLE",
"orderType": "CRYPTO_BOX",
"transactionId": "TRANSACTION_ID_EXAMPLE",
"transactionTime": 1767225600000,
"amount": "10.00",
"currency": "USDT",
"walletType": 1,
"walletTypes": [
"1"
],
"fundsDetail": [
{
"currency": "USDT",
"amount": "10.00"
"walletAssetCost": {
"1": "10.00"
}
}
],
"payerInfo": {
"name": "John Doe",
"type": "USER",
"email": "customer@example.com",
"countryCode": 880,
"phoneNumber": "01XXXXXXXXX",
"mobileCode": "BD",
"unmaskData": false
},
"receiverInfo": {
"binanceId": 123456789,
"accountId": 987654321,
"unmaskData": false
},
"totalPaymentFee": "0",
"m0": "Binance Personal"
}Failure Response
java
public void onPaymentCancelled(FailureResponse response) {
response.getMessage();
response.getErrorCode();
response.getStatus(); // failed
}kotlin
fun onPaymentCancelled(response: FailureResponse) {
println(response.message)
println(response.errorCode)
println(response.status) // failed
}Failure Fields
| Method | Description |
|---|---|
getMessage() | Error message |
getErrorCode() | API error code |
getStatus() | failed |
Query Payment Status
java
bohudur.query("PAYMENT_KEY", new QueryResponse() {
@Override
public void onPaymentFound(SuccessResponse response) {
// PENDING / COMPLETED / EXECUTED
}
@Override
public void onPaymentError(FailureResponse response) {
// Invalid or not found
}
});kotlin
bohudur.query("PAYMENT_KEY",
onPaymentFound = { response ->
println("Payment status: ${response.status}")
},
onPaymentError = { failure ->
println("Query failed: ${failure.message}")
}
)Lambda Expression
java
bohudur.query("PAYMENT_KEY",
success -> {
System.out.println("Payment status: " + success.getStatus());
},
failure -> {
System.out.println("Query failed: " + failure.getMessage());
}
);kotlin
bohudur.query("PAYMENT_KEY",
onPaymentFound = { response ->
println("Payment status: ${response.status}")
},
onPaymentError = { failure ->
println("Query failed: ${failure.message}")
}
)Possible Status Values
| Status | Meaning |
|---|---|
| PENDING | User hasn’t paid yet |
| COMPLETED | Payment done, not executed |
| EXECUTED | Payment finalized |
| CANCELLED | User cancelled |
Error Codes
The SDK follows Bohudur API v2 error codes, including:
3000–3018→ Create payment errors3050–3055→ Query errors3100–3109→ Execute errors
Always handle failures gracefully.
Support
- Telegram: t.me/bohudur
- Facebook: Group
- YouTube: youtube.com/@bohudurpay
