Registration - API E-Wallet (Direct Debit) SNAP
About Registration - API E-Wallet (Direct Debit) SNAP
This API uses to request registration before executing payment using the E-Wallet payment method with Direct Debit Host to Host Feature based on the SNAP standard.
Registration - API E-Wallet (Direct Debit) SNAP
Please request the access token firsthand before doing the authentication through the Request Access Token API - SNAP section.
Service Code | 54 |
|---|---|
API Endpoint | |
HTTP Method | POST |
Description | Request Direct Debit transaction for authentication payment |
Content-type | application/json |
Request Header Parameter for Registration - API E-Wallet (Direct Debit) SNAP
Parameter | Type | Length | Required | Description | Example |
|---|---|---|---|---|---|
Content-Type | String | 127 | Mandatory | Content type, value always application/json | |
Authorization | String | Variable | Mandatory | Bearer “accessToken” | |
X-TIMESTAMP | String | 25 | Mandatory | Using ISO 8601 as timestamp format. Transaction date time, in format YYYYMMDDTHH:mm:ss+07:00. Time must be in GMT+7 (Jakarta time). 2022-03-21T10:11:40+07:00. | |
X-SIGNATURE | String | Variable | Mandatory | Signature will be generated by Merchant. | |
X-PARTNER-ID | String | 20 | Mandatory | Unique Partner ID, Partner ID = Client ID | |
X-EXTERNAL-ID | String | 40 | Mandatory | Unique messaging Reference ID generated by Merchant. Numeric String. Reference number that should be unique in every transaction. | |
CHANNEL-ID | String | 5 | Mandatory | Unique Channel Merchant Credential ID Number. Client ID + "01" = Channel ID "IONPAYTEST" + "01" = "IONPAYTEST01" | IONPAYTEST01 |
Request Body Parameter for Registration - API E-Wallet (Direct Debit) SNAP
Parameter | Type | Required | Length | Description or Example |
|---|---|---|---|---|
partnerReferenceNo | String | Mandatory | 40 | Transaction ID from Merchant |
merchantId | String | Mandatory | 10 | Merchant Identifier that is unique per each Merchant |
subMerchantId | String | Optional | 32 | Sub-Merchant Identifier |
externalStoreId | String | Optional | 32 | Unique Identifier of Shop ID in Client system |
amount | Array of JSON Object | Mandatory | Variable | Amount Information "amount":{ "value":"12345678.00", "currency":"IDR" }, |
value | String | Mandatory | 12 | Transaction amount, including thecents |
currency | String | Mandatory | 3 | Currency code based on ISO |
urlParams | Array of JSON Object | Mandatory | Variable | Notify URL that Merchant must send the payment notification. "urlParams":[ {...}, {...} ] |
url | String | Mandatory | 512 | Indicates the URL of the Client’s app to redirect back to once payment has been completed in Merchant. Merchant accepts HTTP links and URL scheme formats. |
type | String | Mandatory | 32 | Indicates the type of the sent url. Only accepts ‘PAY_RETURN” and ‘PAY_NOTIFY” value |
isDeeplink | String | Mandatory | 1 | Indicates whether the URL is a deep link or not, only accepts ‘Y’ value |
validUpTo | String | Optional | 25 | The time when the payment will be automatic only expired. ISO 8601, in YYYY-MMDDTHH format. mm:ss+07:00. Time must be in GMT+7 (Jakarta time). |
pointOfInitiation | String | Optional | 20 | Used for getting more info regarding source of request of the User |
additionalInfo | Array of JSON Object | Optional | Variable | Additional information "additionalInfo":{...} |
mitraCd | String | Mandatory | 4 | |
goodsNm | String | Mandatory | 200 | Goods Name |
billingNm | String | Mandatory | 100 | Buyer Name |
billingPhone | String | Mandatory | 20 | Buyer Phone Number |
billingEmail | String | Optional | 40 | Buyer E-mail |
callBackUrl | String | Mandatory | 500 | Payment result forward URL (on browser) |
dbProcessUrl | String | Mandatory | 500 | Payment Notification URL (Async Notification) |
cartData | String | Mandatory | 4000 | {Format_JSON_String} { "count": "2", "item": [ {...}, {...} ] } |
msId | String | Optional | 20 | Merchant Seller ID |
msFee | String | Optional | 7 | Merchant Seller Fee |
msFeeType | String | Optional | 2 | Merchant Seller Fee Type |
mbFee | String | Optional | 7 | Merchant Balance Fee |
mbFeeType | String | Optional | 2 | Merchant Balance Fee Type |
Response Parameter for Registration - API E-Wallet (Direct Debit) SNAP
Parameter | Type | Required | Length | Description or Example |
|---|---|---|---|---|
responseCode | String | Mandatory | 7 | Refer to General Response Code and Message - API SNAP list |
responseMessage | String | Mandatory | 150 | Refer to General Response Code and Message - API SNAP list |
partnerReferenceNo | String | Mandatory | 40 | Merchant transaction identifier |
referenceNo | String | Mandatory | 40 | Original transaction identifier on service provider system |
appRedirectUrl | String | Optional | 2048 | Returns an URL scheme to payment page in native app For ShopeePay, this value will be deprecated |
webRedirectUrl | String | Optional | 2048 | Partner checkout URL |
additionalInfo | String | Optional | Variable | Additional information "additionalInfo": { ...} |
redirectToken | String | Optional | 255 | Partner checkout token |
Sample Parameter for Registration - API E-Wallet (Direct Debit) SNAP
Request Parameter
protected $useProd = false;
protected $useCloud = false;
protected $payment_host_to_host_endpoint = "/api/v1.0/debit/payment-host-to-host";
protected $client_id = "TNICEEW051";
PROTECTED $key = "_PRIVATE_KEY_MERCHANT";
PROTECTED $client_secret = "_CLIENT_SECRET_MERCHANT";
PROTECTED $access_token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJJT05QQVlURVNUIiwiaXNzIjoiTklDRVBBWSIsIm5hbWUiOiJCUklOIiwiZXhwIjoiMjAyNC0wMi0xMVQwODowOTozNVoifQ==.aIybLX36dYwfFvW7dcoenXkOe2EAwIYq84ZtPuIf3K8=";
PROTECTED $store_id = "239840198240795109";
$url = HttpUtil::getNicepayDomain($this->useProd, $this->useCloud) . $this->payment_host_to_host_endpoint;
$helper = new Helpers();
$http_method = "POST";
$x_time_stamp = "2024-12-31T10:11:40+07:00";
$partner_id = "TNICEEW051";
$client_secret = $this->client_secret;
$access_token = $this->access_token;
$store_id = $this->store_id;
$external_id = "tXid202402111402271707638099";
$channel_id = "TNICEEW051";
$body = [
"partnerReferenceNo" => "2020102900000000000001",
"merchantId" => $partner_id,
"subMerchantId" => "310928924949487",
"amount" => [
"value" => "12345678.00",
"currency" => "IDR"
],
"urlParams" => [
[
"url" => "https://test1.bi.go.id/v1/test",
"type" => "PAY_NOTIFY",
"isDeeplink" => "Y"
],
[
"url" => "https://test2.bi.go.id/v1/test",
"type" => "PAY_RETURN",
"isDeeplink" => "Y"
]
],
"externalStoreId" => $store_id,
"validUpTo" => "2020-12-23T07:44:11+07:00",
"pointOfInitiation" => "Mobile App",
"additionalInfo" => [
"mitraCd" => "DANA",
"goodsNm" => "Merchant Goods 1",
"billingNm" => "Buyer Name",
"billingPhone" => "02112345678",
"billingEmail" => "[email protected]",
"callBackUrl" => "http://www.merchant.com/callback",
"dbProcessUrl" => "http://www.merchant.com/notification",
"cartData" => '{"count":"2","item":[{"img_url":"http://img.aaa.com/ima1.jpg","goods_name":"Item 1 Name","goods_detail":"Item 1 Detail","goods_amt":"0.00","goods_quantity":"1"},{"img_url":"http://img.aaa.com/ima2.jpg","goods_name":"Item 2 Name","goods_detail":"Item 2 Detail","goods_amt":"12345678.00","goods_quantity":"1"}]}',
"msId" => "",
"msFee" => "",
"msFeeType" => "",
"mbFee" => "",
"mbFeeType" => ""
]
];
$string_to_sign = $helper->generateStringToSign(
$http_method,
$this->payment_host_to_host_endpoint,
$access_token,
$body,
$x_time_stamp
);
$signature = $helper->hmacSHA512Encoded(
$string_to_sign,
$client_secret,
OPENSSL_ALGO_SHA512
);
$header = $helper->generateHeader(
$access_token,
$x_time_stamp,
$signature,
$partner_id,
$external_id,
$channel_id
);
try {
$response = HttpUtil::postJsonRequestWithHeader($url, $body, $header);
} catch (Exception $e) {
// Handle exception
}Response Parameter
{
"responseCode": "2005400",
"responseMessage": "Successful",
"partnerReferenceNo": "2020102900000000000001",
"referenceNo": "TNICEEW05105202210141451109841",
"webRedirectUrl": "https://pjsp.com/universal?bizNo=REF993883&...",
"additionalInfo": {
"redirectToken": " df548fff93e82aad9174c657820a85aa5d10042535157c7e89f52499"
}
}