Create Landing Page for Direct Debit Payment
On this section we will discuss about create an informative landing page for direct debit payment. These payment channel will redirect our customer to their institution website, then customer will conduct their payment there. The payment channel we cover so far CIMB Clicks, Epay BRI, Line Pay | mandiri e-cash. These payment method only read finish url which can be configured on MAP for either SNAP/VTWEB/COREAPI.
The first step needed is Login to Dashboard ↗. Go to setting -> configuration, and fill in the finish url
For SNAP & Core API
On the Finish url script, we need to obtain the response sent to the finish url script. The sample code below are written in native php. Please adjust to your own environment.
<?php
$raw_response = $_POST['response']; //get the json response
$response = preg_replace('/\\\\/', '', $_POST['raw_response']); //clean up response from backslash
$decoded_response = json_decode($response);
$transaction_status = $decoded_response ->transaction_status;//how to access
?>
Raw response are formatted in JSON, however, in some rare case, sometime there are backslash before the quotation mark (“). Below are the sample of the raw dirty response
{
\"status_code\" : \"200\",
\"status_message\" : \"Success, transaction is found\",
\"transaction_id\" : \"58b48d1c-3e51-46f8-a2fb-ad5fa668f534\",
\"order_id\" : \"34\",
\"gross_amount\" : \"19999998.00\",
\"payment_type\" : \"cimb_clicks\",
\"transaction_time\" : \"2018-01-26 08:57:45\",
\"transaction_status\" : \"settlement\",
\"approval_code\" : \"1516957074590\",
\"signature_key\" : \"30b048ffff95e08c34cf265268224f0b6460d7716b3d70424a7203609a78b335280fe6137a9938cd3af24533fdafcfe8771203f6f30f21fd141a378bba1685fb\"
}
After the response being clean we got this result
{
"status_code" : "200",
"status_message" : "Success, transaction is found",
"transaction_id" : "58b48d1c-3e51-46f8-a2fb-ad5fa668f534",
"order_id" : "34",
"gross_amount" : "19999998.00",
"payment_type" : "cimb_clicks",
"transaction_time" : "2018-01-26 08:57:45",
"transaction_status" : "settlement",
"approval_code" : "1516957074590",
"signature_key" : "30b048ffff95e08c34cf265268224f0b6460d7716b3d70424a7203609a78b335280fe6137a9938cd3af24533fdafcfe8771203f6f30f21fd141a378bba1685fb"
}
Below are the sample of decoded response:
stdClass Object
(
[status_code] => 200
[status_message] => Success, transaction is found
[transaction_id] => 58b48d1c-3e51-46f8-a2fb-ad5fa668f534
[order_id] => 34
[gross_amount] => 19999998.00
[payment_type] => cimb_clicks
[transaction_time] => 2018-01-26 08:57:45
[transaction_status] => settlement
[approval_code] => 1516957074590
[signature_key] => 30b048ffff95e08c34cf265268224f0b6460d7716b3d70424a7203609a78b335280fe6137a9938cd3af24533fdafcfe8771203f6f30f21fd141a378bba1685fb
)
And now, we can use this response for showing message to our customer
For VT WEB
When customer back to your website the url will be redirected to the finish url you set before and we will append with a query string consist of merchant_id, status_code, and transaction_status. You obtain the query string with method $_GET[‘merchant_id’] for example, to get the merchant id. Use these information only for the sake of appearance. DO NOT USE FOR UPDATING DATABASE! As there is possibility to manipulate this query string.
Complete URL sample for deny transaction
https://example.com/finish?merchant_id=MXXXX&order_id=xxxx&status_code=202&transaction_status=deny
Complete URL sample for pending or unpaid transaction
Complete URL sample for success/paid transaction
The sample code on how to retrieve the info are shown below
<?php
$order_id = $_GET['order_id']
$txn_status = $_GET['transaction_status']
?>
Can't find your answer? How about looking at our Tech Docs?
Tech docs
Our API and plug-ins play well with platforms from PHP, Shopify, Woo Commerce to Android and many more.
Learn more