Additional Payment Features - veritrans/veritrans-android GitHub Wiki

Additional Payment Features

Custom Field

Custom field consists of custom_field1, custom_field2 and custom_field3.

These 3 fields will be brought at payment so it will be available at MAP and HTTP notification sent to merchant.

Set up custom field

TransactionRequest transactionRequest = MidtransSDK.getInstance().getTransactionRequest();
transactionRequest.setCustomField1(CUSTOM_FIELD_1);
transactionRequest.setCustomField2(CUSTOM_FIELD_2);
transactionRequest.setCustomField3(CUSTOM_FIELD_3);
MidtransSDK.getInstance().setTransactionRequest(transactionRequest);

Pre Authorization

Pre Authorization is a feature to set credit card transaction type into authorize.

If the transaction type is authorize then merchant need to capture the payment in MAP.

To use this feature you need to add a settings into credit card options in transaction request.

Set up authorize transaction

CreditCard creditCard = new CreditCard();
creditCard.setType(CardTokenRequest.TYPE_AUTHORIZE);

// Set into transaction Request
TransactionRequest transactionRequest = MidtransSDK.getInstance().getTransactionRequest();
transactionRequest.setCreditCard(creditCard);

// Set into SDK instance
MidtransSDK.getInstance().setTransactionRequest(transactionRequest());

Custom VA Number

Mobile SDK Provides a feature that allows to customize VA Number for BCA Bank transfer and Permata Bank Transfer payment methods. The Custom VA number must consist of numbers. To use this feature on Android SDK, you need to set your custom VA number to TransactionRequest object.

Note

  • Custom VA Number for Permata Bank Transfer must be 10 digits

Custom VA Number Permata Bank

// ....

TransactionRequest transactionRequest = MidtransSDK.getInstance().getTransactionRequest();
// custom va number for Permata Bank Transfer must be 10 digits
String PERMATA_VA_NUMBER = "1234512345";
// Set into transaction Request
transactionRequest.setPermataVa(
        new BankTransferRequestModel(PERMATA_VA_NUMBER);
// ...

);

Custom VA Number BCA Bank

// ....

TransactionRequest transactionRequest = MidtransSDK.getInstance().getTransactionRequest();
// custom va number
String BCA_VA_NUMBER = "1234512345";
// Set into transaction Request
transactionRequest.setBcaVa(
        new BankTransferRequestModel(BCA_VA_NUMBER);
);
// ...

);

Other Bank ATM / VA Switcher

For bank transfers beside BCA, Mandiri, BNI, or Permata, Midtrans previously utilized Permata as VA processor. Recently, Midtrans adds support for BNI VA, giving the merchant flexibility to choose which one will be used for other bank transfer. The idea is when one of the processors (either BNI or Permata) is down, merchant can switches to other processor, preventing lose of the sales. In order to use this functionality, merchant should enable both BNI VA and Permata VA. The switch itself is located in Snap Preferences in MAP (Merchant Administrator Portal).

To comply with change in MAP, you need to pay attention to merchant preference JSON when getting payment channel list.

"merchant": {
    "preference": {
      "other_va_processor": "bni_va",
      "display_name": "COCO",
      "finish_url": "http://example.com/finish",
      "error_url": "http://example.com/error",
      "pending_url": "http://example.com/unfinish",
      "logo_url": "https://vtcheckout-sandbox-assets.s3.amazonaws.com/snap/logos/M007743/thumb_retina_COCO.png",
      "ga_tracking_code": "",
      "color_scheme": "navyblue",
      "color_scheme_url": "//d15o910bptsmae.cloudfront.net/snap/assets/v3/navyblue-2097527758fa2c0c03f202ef29470580e0d4321fba687162abeb41677e651b85.css",
      "locale": "en",
      "vtweb_version": "Version 3"
}

The adjustment is done by observing the value of other_va_processor (either bni_va or permata_va) and displays respective instructions.

Get other VA processor

String otherVaProcessor = MidtransSDK.getInstance().getMerchantData().getPreference().getOtherVaProcessor();

Please note that VA number and its expiration need to be adjusted. For example, after confirming payment using other bank transfer, the response will be one of the following.

If other VA processor set to Permata

{
    "status_code": "201",
    "status_message": "Transaksi sedang diproses",
    "transaction_id": "3518b95b-b023-4bda-8fc1-f24ef70285ca",
    "order_id": "test-1513760658",
    "gross_amount": "10000.00",
    "payment_type": "bank_transfer",
    "transaction_time": "2017-12-20 16:04:24",
    "transaction_status": "pending",
    "fraud_status": "accept",
    "permata_va_number": "8778006927987808",
    "permata_expiration": "21 December 16:04 WIB",
    "pdf_url": "http://localhost:3000/snap/v1/transactions/13d969b1-d048-4876-97f2-25cc7c9d4df5/pdf",
    "atm_channel": "atm_networks",
    "finish_redirect_url": "https://google.com?order_id=test-1513760658&status_code=201&transaction_status=pending"
}

If other VA processor set to BNI

{
    "status_code": "201",
    "status_message": "Transaksi sedang diproses",
    "transaction_id": "4f68bc99-4b02-44d4-b8c3-2b7a8ace632b",
    "order_id": "test-1513760612",
    "gross_amount": "10000.00",
    "payment_type": "bank_transfer",
    "transaction_time": "2017-12-20 16:03:35",
    "transaction_status": "pending",
    "fraud_status": "accept",
    "bni_va_number": "9880827220038713",
    "bni_expiration": "21 December 16:03 WIB",
    "pdf_url": "http://localhost:3000/snap/v1/transactions/ebdfad25-fc55-4c88-a8c2-b455bdbfec4a/pdf",
    "finish_redirect_url": "https://google.com?order_id=test-1513760612&status_code=201&transaction_status=pending"
}