BCA KlikPay Landing Page Development Guideline
To enable this payment method, you can see this guideline ↗. Additionally you will need to fulfill additional technical requirements below as required by BCA team according to their guidelines.
This article will explain additional technical requirement to integrate with BCA KlikPay payment method. This implementation is mandatory and applies to both integration using SNAP Pop Up and/or Core API.
The customer payment journey for BCA KlikPay will be as follows:
- Customer will be redirected to BCA KlikPay site to complete the transaction.
- Customer follows the steps on BCA KlikPay site. Once the payment is done, the customer will be redirected back to Merchant’s site.
The target finish redirect URL that will be used can be configured by Merchant through the Merchant Adminstration Portal (MAP), by going to the Settings > Configuration > Finish Redirection URL tabs on the left side of the dashboard.
As transaction identifier, ?id=<the-transaction-id>
will be included as url Query String upon redirect.
For example: If the finish redirect URL of merchant is www.mywebstore.com/finish-payment
, customer will be redirected to url below:
https://www.mywebstore.com/finish-payment?id=d2fd2b3e-a5ea-4f65-b62e-40443539fce4
After the finish redirect, merchant’s site have to display the result (success/failure message) of transaction directly on that page. Which require Merchant to get the latest transaction status via get Transaction Status API (https://api-docs.midtrans.com/#get-transaction-status) by using the transaction_id
provided on the finish redirect.
Please display confirmation message in text-format based on the resulted transaction_status
to customer. If the transaction_status
is settlement display some message like “payment success”. Otherwise show message like “payment failed.”
These sample code show how’s the logic work in php. Please adjust the code with your tech stack.
<?php
require_once dirname(__FILE__) . '/pathToMidtransLibrary/Midtrans.php';
\Midtrans\Config::$serverKey = '<your server key>';
\Midtrans\Config::$isProduction = false;
$transactionId = $_GET['id']; // from `id` url query string
$statusResponse = \Midtrans\Transaction::status($orderId);
if($statusResponse->transaction_status == "settlement")
{
echo "payment success";
}
else {
echo "payment failed";
}
You will also need to make sure your implementation can handle Cancel & Expire scenario properly. Here is how to test cancel and expiry scenario in SANDBOX environment.
CANCEL Scenario testing flow:
- Create transaction from your website and redirected to Midtrans simulator,
- Login to MAP, go to menu TRANSACTIONS,
- Go to the BCA KlikPay Order ID,and the transaction status should be PENDING. Click the Order ID to open the details, then click CANCEL,
- Continue payment on the simulator,
- Click return to merchant’s website.
- The expected result is merchant’s website should display payment failure message.
EXPIRE Scenario testing flow:
- Create transaction and redirected to Midtrans’ BCA Klikpay simulator,
- Call Midtrans expire API using the current Order ID,
- Continue payment on the simulator,
- Click return to merchant’s website.
- The expected result is merchant’s website should display payment failure message.
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