What is BKM Express Integration?
BKM Express is a digital payment solution that allows users to make payments without having to enter their card information repeatedly. Using the PayTR infrastructure, you can easily receive payments via BKM Express.
How to Integrate BKM Express?
-
In systems using iFrame API, the BKM Express option automatically appears on the payment screen.
-
In systems using Direct API,
payment_type = "bex"
must be specified when sending the payment request.
Required Variables:
Variable | Description |
---|---|
merchant_id | Merchant number |
merchant_key | Merchant password |
merchant_salt | Merchant secret key |
merchant_oid | Order number |
payment_amount | Total payment amount |
user_ip | User IP address |
User email address | |
payment_type | Must be set to "bex" |
installment_options | Optional installment options |
BKM Express Test User Information:
User Email | Bank |
---|---|
[email protected] | Ziraat Bankası |
[email protected] | Halk Bankası |
[email protected] | VakıfBank |
[email protected] | TEB |
[email protected] | Akbank |
[email protected] | Garanti |
[email protected] | İş Bankası |
[email protected] | Yapı Kredi |
[email protected] | DenizBank |
[email protected], [email protected] | QNB Finansbank |
*Password for all users: 147258
PHP Sample Code Structure:
<?php
$merchant_id = '';
$merchant_key = '';
$merchant_salt = '';
$user_basket = htmlentities(json_encode(array(
array("Sample Product 1", "18.00", 1),
array("Sample Product 2", "33.25", 2),
array("Sample Product 3", "45.42", 1)
)));
$merchant_oid = $_POST['merchant_oid'];
$test_mode = 1;
$user_ip = $_SERVER["REMOTE_ADDR"] ?? '127.0.0.1';
$email = "[email protected]";
$payment_amount = "15.20";
$installment_count = 0;
$payment_type = "bex";
$installment_options = '{"bonus":{"2":20.2,"3":30.9,"4":40.8,"5":50.4,"6":60.4}}';
$hash_str = $merchant_id.$user_ip.$merchant_oid.$email.$payment_amount.$payment_type.$installment_count.$test_mode.$installment_options;
$token = base64_encode(hash_hmac('sha256', $hash_str.$merchant_salt, $merchant_key, true));
$post = [
'merchant_id' => $merchant_id,
'user_ip' => $user_ip,
'merchant_oid' => $merchant_oid,
'email' => $email,
'payment_type' => $payment_type,
'payment_amount' => $payment_amount,
'installment_count' => $installment_count,
'test_mode' => $test_mode,
'user_name' => "TEST NAME",
'user_address' => "USER TEST ADDRESS",
'user_phone' => "05555555555",
'user_basket' => $user_basket,
'debug_on' => 1,
'paytr_token' => $token,
'installment_options' => $installment_options
];
$ch = curl_init('https://www.paytr.com/odeme');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
$response = @curl_exec($ch);
if (curl_errno($ch)) {
echo curl_error($ch);
curl_close($ch);
exit;
}
curl_close($ch);
exit($response);
?>
Conclusion:
With BKM Express integration, you can both offer your customers easy payment options and manage your collections faster and more securely. If you follow all the steps completely, taking payments using BKM Express with the PayTR infrastructure becomes extremely simple.