NAV
bash javascript

Introducing Bao Kim API

Bao Kim Payment Platform is an open payment platform, Bao Kim provides a full range of APIs that allow users to integrate their application (web / app) with Bao Kim in order to receive payment orders and checks. account, transaction control, automatic trading, ...

For example, users can perform the following tasks with Bao Kim API

Security method

Security Bao Kim API uses the following methods

//PHP JWT example
require_once('vendor/autoload.php');
use \Firebase\JWT\JWT;

class BaoKimAPI {

    /* Bao Kim API key */
    const API_KEY = "x***";
    const API_SECRET = "y***";
    const TOKEN_EXPIRE = 60; //token expire time in seconds
    const ENCODE_ALG = 'HS256';

    private static $_jwt = null;

    /**
     * Refresh JWT
     */
    public static function refreshToken(){

        $tokenId    = base64_encode(mcrypt_create_iv(32));
        $issuedAt   = time()-100000;
        $notBefore  = $issuedAt;
        $expire     = $notBefore + self::TOKEN_EXPIRE;

        /*
         * Payload data of the token
         */
        $data = [
                'iat'  => $issuedAt,         // Issued at: time when the token was generated
                'jti'  => $tokenId,          // Json Token Id: an unique identifier for the token
                'iss'  => self::API_KEY,     // Issuer
                'nbf'  => $notBefore,        // Not before
                'exp'  => $expire,           // Expire
                'form_params' => [                  // request body (post data)
                    //'a' => 'value a',
                    //'b' => 'value b',
                ]
        ];

        /*
         * Encode the array to a JWT string.
         * Second parameter is the key to encode the token.
         *
         * The output string can be validated at http://jwt.io/
         */
        self::$_jwt = JWT::encode(
                $data,      //Data to be encoded in the JWT
                self::API_SECRET, // The signing key
                'HS256'     // Algorithm used to sign the token, see https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40#section-3
        );

        return self::$_jwt;
    }

    /**
     * Get JWT
     */
    public static function getToken(){
        if(!self::$_jwt)
            self::refreshToken();

        try {
            JWT::decode(self::$_jwt, self::API_SECRET, array('HS256'));
        }catch(Exception $e){
            self::refreshToken();
        }

        return self::$_jwt;
    }
}

API endpoint

Bao Kim API endpoint (full path called API) is defined as follows:

Production environment(Live)

Sandbox environment (Test)

In which API_URI is described in the detailed documentation of each API

Sandbox environment (Test)

Start now

To start using Bao Kim API you just need to take the following simple and quick steps

Payment integration

Bao Kim provides processes and APIs that allow to integrate payment of orders / products from websites / e-commerce applications / digital content ... To serve payment processing when customers shop Safe and convenient online.

Before starting, make sure you

Basic integration process

This is the simplest and fastest integration process, but please learn more about the Pro integration process below with more advantages to make the right choice.

Advantages:

Defect:

Quy trình tích hợp cơ bản

Pro integration process (advanced)

Technically, the only difference between Pro integration and basic integration is the Web / App merchant that uses API Bank Payment Method List to load the list of payment methods and display on its interface to users. Select, then send these parameters along with the order to Bao Kim via the Send Order API

The main advantage of Pro integration:

Defect:

Click to view the demo page

Quy trình tích hợp Pro

Payment via Internet Banking (comming soon)

Basically, payment via Internet Banking is only one payment method of the above integrated processes (basic / pro), web / merchant app can simply do not need to handle any more.
However, if you want to be simpler for your customers by displaying your Internet Banking account information on your interface instead of having to redirect to Bao Kim, handle the shortening process below: Quy trình tích hợp thanh toán Internet Banking

Payment by QRCode

Payment by QRCode is only one payment method of the above integrated processes (basic / pro), web / merchant app can simply do not need to handle any more.
For Pro integration, if you want to simplify for customers by displaying QRCode images on your interface instead of having to redirect to Bao Kim, please proceed with the shortened process below: Quy trình tích hợp thanh toán QRCode

Installment payment

Payment by QRCode is only one payment method of the above integrated processes (basic / pro), web / merchant app can simply do not need to handle any more.
Customers before payment need to take one more step to select the issuing bank and the term and installment payment (3/6/9/12 months), please refer to the process below:
Quy trình thanh toán Trả góp

Virtual account payment


          Function get virtual account
          $client = new GuzzleHttp\Client(['timeout' => 20.0]);
          $options['query']['jwt'] = BaoKimAPI::getToken();

          $payload['mrc_uuid'] = "MdJGucKrjcgl5BT3";
          $payload['name'] = "Nguyen Van A";
          $payload['mcr_id'] = "15";

          $response = $client->request("POST", "https://dev-api.baokim.vn/payment/api/v4/create-virtual-account-payment’);
          echo "Response status code: " . $response->getStatusCode();
          echo "Response data: ". $response->getBody()->getContent();
          
>

          Data webhook
          {
          "order":{
          "id":77782,
          "user_id":1000005,
          "mrc_order_id":"5f3e2a0fe5ef3",
          "txn_id":104407,
          "ref_no":null,
          "deposit_id":1221771,
          "merchant_id":10,
          "total_amount":"100000.00",
          "shipping_fee":"0.00",
          "tax_fee":"0.00",
          "mrc_fee":null,
          "description":"Thanh to\u00e1n cho t\u00e0i kho\u1ea3n \u1ea3o 760014844106",
          "items":null,
          "url_success":null,
          "url_cancel":null,
          "url_detail":null,
          "stat":"c",
          "payment_version":"4.0",
          "lang":"vi",
          "bpm_id":301,
          "accept_qrpay":1,
          "accept_bank":1,
          "accept_cc":1,
          "accept_e_wallet":1,
          "email":"1@bk.vn",
          "name":"Dang Le Duc",
          "webhooks":"http:\/\/localhost\/api\/bpn-listener",
          "customer_name":"Nguy\u1ec5n Th\u00e0nh Nam",
          "customer_email":null,
          "customer_phone":null,
          "customer_address":"1",
          "created_at":"2020-08-20 14:46:02",
          "updated_at":"2020-08-20 14:46:02"
          },
          "txn":{
          "user_id":1000005,
          "account_id":1001000079,
          "deposit_id":1221771,
          "amount":92000,
          "freeze_amount":0,
          "fee_amount":"0.00",
          "fee_display":"0.00",
          "description":"Thanh to\u00e1n cho \u0111\u01a1n h\u00e0ng 77782",
          "bank_ref_no":null,
          "ref_no":"PAY_1221771",
          "stat":4,
          "type":5,
          "src_des":"1@bk.vn",
          "updated_at":"2020-08-20 14:46:02",
          "created_at":"2020-08-20 14:46:02",
          "id":104407,
          "mrc_order_id":"5f3e2a0fe5ef3",
          "total_amount":"100000.00"
          },
          "sign":"ce74e15ef621bf3c90ad61cdeedb789dc664dc9ca95f87f6ea0ee1d0c890ba09"
          }
          

Step 1: Create virtual account

Step 2: Receive payment results

Please refer to the procedure below:

Virtual account payment Virtual account payment

Payment via momo e-wallet

Payment via momo e-wallet is only one payment method of the above integrated processes (basic / pro), web / merchant app can simply do not need to handle any more. Quy trình thanh toán qua MoMo

Payment using module Checkout

$line_items = [
[
'name' => 'Product's name 1',
'description' => 'Description 1',
'images' => ['https://example.com/image-item1.png'],
'amount' => 500000,
'currency' => 'vnd',
'quantity' => 1,
],
[
'name' => 'Product's name 2',
'description' => 'Description 2',
'images' => ['https://example.com/image-item2.png'],
'amount' => 100000,
'currency' => 'vnd',
'quantity' => 1,
],
];
//Set up API Key
BaoKimSDK\BaoKim::setKey(your_api_key, your_api_secret);
//create Session
try {
$session = BaoKimSDK\Session::create([
'payment_method_types'    => [1, 2, 3],
'mrc_order_id'   =>  'mrcOrderId_' . time(),
'line_items'  =>  [
    [
        'name' => 'Product's name 1',
        'description' => 'Description 1',
        'images' => [
            'https://example.com/image-item-1.png',
            'https://example.com/image-item-1-1.png'
        ],
        'amount' => 500000,
        'currency' => 'vnd',
        'quantity' => 1,
    ],
    [
        'name' => 'Product's name 2',
        'description' => 'Description 2',
        'images' => ['https://example.com/image-item-2.png'],
        'amount' => 100000,
        'currency' => 'vnd',
        'quantity' => 1,
    ],
    ],
        'success_url' =>  'https://example.com/success',
        'cancel_url' =>  'https://example.com/cancel',
        'webhook_url' =>  'https://example.com/webhook',
        'customer_email' =>  'example@gmail.com',
        'customer_phone' => '09********',
    ]
]
]);
header('Location: ' . $session->payment_url);
exit();
} catch(BaoKimSDK\Exceptions\BaoKimException $e) {
error_log($e->getMessage());
}

Step 1: Install package:

Step 2: Conduct integration

For one-time payments, create a Session with line_items. Line items represent a list of items the customer is purchasing.

Line_items takes the form of an array, refer to the sample code to the right:

$payment_method_types = [1, 2, 3];

payment_method_types is an array (1: Payment by ATM, 2: Payment by QRCode, 3: Payment By Visa)

When your customer successfully completes their payment, they are redirected to the success_url, a page on your website that informs the customer that their payment was successful.

When your customer clicks on your logo in a Checkout Session without completing a payment, Checkout redirects them back to your website by navigating to the cancel_url. Typically, this is the page on your website that the customer viewed prior to redirecting to Checkout.

Create Payment Session


Creating a Checkout Session returns $session include information of session saved in Bảo Kim, and payment_url. You need redirect browser to payment_urlto proceed with the payment

JS library and embed Code

//Nhúng thư viện JS của Bảo Kim lên header của website
<link rel="stylesheet" href="https://cdn.baokim.vn/public/uploads/checkout/baokim.css" />
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script src="https://cdn.baokim.vn/public/uploads/checkout/baokim.js"></script>
//thêm đoạn code sau vào dưới form thanh toán với id là id form checkout.
<div class="btn btn-success" id="check_out"></div>
<script type="text/javascript">
    let baokim = new Baokim(
        'check_out', // id of css
        'WPaHwMXZoCiQ5bgKT0bP5MC05GmOiSG6', // key
        true, // is production
        { //order
            mrc_order_id: `my_order_id_${Math.random().toString(36).substring(2)}_${Date.now()}`,
            total_amount: 20000,
            payment_method_type: 'card',
            description: 'thanh toan dien thoai iphone xs max gia re',
            url_success: 'http://my-merchant.com/callback-success',
            url_detail: 'http://my-merchant.com/callback-cancel',
            webhook_url: 'http://php5.varnish.dev.baokim.vn/webhook-momo.php',
        },
        { // button config
            title: 'Thanh toán voi baokim',
            style: {
                background: '#fff'
            }
        });
    baokim.createBtn();
</script>

On the Merchant payment page, add the following code to the website header and replace the custom parameters with the sample code on the right

Confirm payment results

After the customer successfully pays, Bao Kim will send a Webhook notification to the Web / App merchant, then redirect the client browser according to url_success on order with data. Web / App merchant has 2 ways to confirm payment results of orders:

In both ways, the order is considered a successful payment when:

Webhook Notification

Webhook notification is a notification mechanism for Web/Merchant App when the order is successfully paid via HTTP POST request
How to receive webhook notification?

How many times will the Webhook notification be sent?

Describe data on webhook notification

Method: POST

Header: Content-Type: application/json

Body (see sample data on the right)

{
...."order": {
........"id": 45458,
........"user_id": "1000005",
........"mrc_order_id": "mrc_1543306400",  //Merchant transaction code, it is unique
........"txn_id": "100000000",  //Transaction ID of orders
........"ref_no": "TRF_10000000",
........"deposit_id": null,
........"merchant_id": null,
........"total_amount": "100000.00",
........"shipping_fee": "0.00",
........"tax_fee": "0.00",
........"mrc_fee": null,
........"description": "thanh toan don hang 1543306400",
........"url_success": "https:\/\/vnexpress.net\/",
........"url_cancel": null,
........"url_detail": null,
........"stat": "c", //Order status: "p" - processing / "c" - "complete"
........"payment_version": "4.0",
........"lang": "vi",
........"bpm_id": 0,
........"accept_qrpay": 0,
........"created_at": "2018-11-27 08:13:22",
........"updated_at": "2018-11-27 08:13:22"
....}
...."txn": {
........"id": 100000000,
........"user_id": 1000005,
........"account_id": 1001000079,
........"opening_balance": "1111968443.45",
........"amount": "10000.00",
........"balance": "1111978443.45",
........"opening_freeze_balance": "562387181.18",
........"freeze_amount": "0.00",
........"freeze_balance": "562387181.18",
........"ref_no": "TRF_10000000",
........"bank_ref_no": "vcb_1543390288",
........"type": null,
........"stat": 4,
........"description": "ut nap tien 1@bk.vn",
........"fee_amount": "0.00",
........"is_processed": 1,
........"src_des": null,
........"created_at": "2018-11-28 07:31:28",
........"updated_at": "2018-11-28 07:31:28"
....}
...."sign": "hmac_hash_xxxyyyzzz" //hash use hmac algorithm with sha256 sign up the data send to merchant to confirm data integrity
}

Check and process steps when receiving webhook notification

  1. Check the received data integrity by checking the accuracy of the sign signature as follows (See the PHP sample code tab on the right, under webhook data description):
    • Use the secret value in the key / secret folder in your API Key
    • Use the hash_hmac algorithm with sha256, sign up the data you receive (except for the $sign field, of course) => $yourSign
    • Compare the signature you created ($yourSign) with the signature you received ($sign), if not the same => incomplete data
//Verify signature on webhook with PHP
//Decode webhook notification data received from Baokim
$jsonWebhookData = '{"order":{order data},"txn":{txn data},"sign":"baokim sign"}';
$webhookData = json_decode($jsonWebhookData, true);

//Get and remove sign field from data
$baokimSign = $webhookData['sign'];
unset($webhookData['sign']);

//Json encode data without sign field and using hash sha256 algorithm to create signature with secret key
$signData = json_encode($webhookData);
$secret = "9623ac03057e433f95d86cf4f3bef5cc";
$mySign = hash_hmac('sha256', $signData, $secret);

//Compare the signature you created with the signature received from Baokim, if result is equal verify is success
if($baokimSign == $mySign)
    echo "Signature is valid"
else
    echo "Signature is invalid"
  1. Check order payment status, payment transaction, payment amount, order fulfillment

    • Check the payment order status ($order->stat == 'c' // completed). With payment from credit card, there may be an exception of 'r' status (Reviewing, see description below)
    • Check the amount actually received on the payment transaction plus the fee ($txn->amount + $txn->fee_amount) has the sufficient amount of the order ($order->total_amount)
    • Check if the order information ($order) is correct for your order information on the web/app
    • If the above test steps are completely correct, you can be sure that the order has been paid and can complete the order.
  2. Returns the json string with err_code = 0, eg {"err_code": "0", "message": "some message"} to tell Kim that the merchant has received the notification and does not continue to resend it. The maximum length of data returned is 255 characters.

Exceptions to payments from international credit cards:

Data returned on url_success

If the web/app merchant applies payment processing results by 1 Webhook Notification, it is possible to ignore the processing of returned data on url_success and simply display the successful payment page for the customer. If not, verify the data returned on url_success as follows.

Data description on url_success

Name Description
mrc_order_id Merchant unique order code
txn_id Transaction code for payment orders
total_amount Amount of order payment
stat Order status
updated_at Time to record payment
checksum Data security signature (see details below)

Checksum is signed on the pass parameter on url_success using the hash sha256 algorithm, with the secret key as the key key in your API key. How to verify the checksum on url_success please see the steps and sample code on the right tab.

$urlSuccess = 'https://example.com/baokim/payment-success?your_param=your_value&txn_id=10000000&mrc_order_id=yourOrderId&total_amount=20000&updated_at=2019-07-20+09%3A36%3A18&checksum=17c5f89c132c814e5e4647f9eb8398fd3dc0621fe57d1662b72878ee513ad413';

//1. Load data from url_success,
// Remove checksum and all params of merchant (Don't response by Baokim)
$parts = parse_url($urlSuccess);
parse_str($parts['query'], $query);
$checksum = $query['checksum'];
unset($query['checksum']);
unset($query['your_param']);

//2. Sort all data by key
ksort($query);

//3. Create string to make checksum from data sorted
// follow by format key1=value1&key2=value2&...
$signData =  http_build_query($query);

//4. Create and compare checksum
$myChecksum = hash_hmac('sha256', http_build_query($query), $secretKey);
if($checksum == $myChecksum)
echo "Checksum is valid"
else
echo "Checksum is invalid"

Wallet link

Link users of 3rd party applications to Bao Kim wallet for balance management, perform transactions of an electronic wallet right on the 3rd party app.

Link User <=> Wallet

Wallet link process

Process flow link wallet

Process Description

  1. User clicks the link to Bao Kim from Merchant's web.
  2. Merchant displays the phone number input form for the user.
  3. User submit phone
  4. Merchant calls API Send request with associated wallet link ? Jwt = ***
    • Merchant will receive a response ticket
    • User will receive OTPauthentication to the phone number that has been sent
  5. Merchant displays OTP input form
  6. User submit OTP
  7. Merchant calls Associate Authentication API ? Jwt = ***
    • Merchant will receive a response linked_code
  8. Merchant calls associated Linked_code Authentication API ? Jwt = *** to verify linked_code
    • Merchant will receive a response user_id(Bao Kim's User account id) and a code token(Token associated with Bao Kim wallet).
  9. Merchant saved the token corresponding to user_idBao Kim.
  10. Ending the linking process.
  11. Note: Jwt is generated in Bao Kim's key / secret pair specifically for wallet linkage.

Process of unlinking a wallet

Process of unlinking purses flow

Process Description

  1. User click to unlink the wallet from Bao Kim from Merchant's web site.
  2. Merchant calls API Send request to unlink the attached wallet ? Jwt = *** and Headers: Wallet-Token = $ token
    • Merchant will receive a response ticket
    • User will receive OTPauthentication to the phone number that has been sent
  3. Merchant displays OTP input form
  4. User submit OTP
  5. The Merchant calls the Authentication API unlinked with? Jwt = *** and Headers: Wallet-Token = $ token
    • Merchant will receive a response mrc_uuidandbk_uuid
  6. Merchant processed delete token corresponding to bk_uuidBao Kim.
  7. Ending the linking process.
  8. Note: Jwt is generated in Bao Kim's key / secret pair specifically for wallet linkage.

    Demo of Bao Kim wallet link

    Click to see Demo page

Save an ATM card to your wallet

Procedure

Process of ATM flow inter-card

Process Description

  1. User click the link ATM feature.
  2. Merchant calls API List of Payment Methods to get the Bank list, showing the list to the User.
  3. User selects Bank.
  4. Display the confirmation screen with terms.
  5. User click confirm.
  6. Merchant calls API to send request for tag link .
    • Merchant will get $responsein there result, dataKey, napasKey.
  7. Merchant creates the HTML as the right column and embeds it in the web / mobile application to display the card information form.
    • In which parameters have the following values:
    • clientIP = $response->data->client_id
    • deviceId = $response->data->user_id
    • orderId = $response->data->order->id
    • dataKey = $response->data->dataKey
    • napasKey = $response->data->napasKey
    • apiOperation = $response->data->apiOperation
    • orderAmount = $response->data->order->amount
    • orderCurrency = $response->data->order->currency
    • orderReference = $response->data->order->reference
//Code Js nhúng vào ứng dụng Web/Mobile:
<form id="merchant-form" action="https://yourwebsite.com/post_back_url?merchantId=BAOKIMICE" method="POST"></form>
    <div id="napas-widget-container"></div>
    <script type="text/javascript" id="napas-widget-script" src="https://dps-staging.napas.com.vn/api/restjs/resources/js/napas.hostedform.min.js"
            merchantId="BAOKIMCE"
            clientIP="client_ip"
            deviceId="user_id"
            environment="MobileApp"
            cardScheme="AtmCard"
            enable3DSecure="false"
            orderId="order_id"
            dataKey="dataKey"
            napasKey="napasKey"
            apiOperation="PAY_WITH_RETURNED_TOKEN"
            orderAmount="10000"
            orderCurrency="VND"
            orderReference="reference"
            channel="6014"
            sourceOfFundsType="CARD"
            language="vi">
    </script>
  1. User enter card information and Submit to Bank.
    • Test card information:
    • Verify on Bank page: 9704020000000016- NGUYEN VAN A-03/07
    • Validation on Napas page: 9704000000000018- NGUYEN VAN A-03/07
    • OTP is 'otp'.
    • Error card: 9704020000000018
  2. After successfully adding the tag, the Website will redirectreturn the Merchant url above actionin the embed code.
  3. Merchant displays results.
  4. User receives result.
  5. End process.

    Add money to your wallet

    Procedure

    The process of adding money to a flow wallet

    Process Description

  6. User click the recharge feature to the wallet.
  7. The Merchant calls the Card List API associated with query_params conn_type = 2 to get a list of associated User's Bank cards, showing the list to the User.
  8. User select Card, enter amount and Submit.
  9. Merchant calls API Recharge wallet .
    • Merchant will receive $responseincluding result, dataKey, napasKeyand parameters needed.
  10. Merchant creates the HTML as the right column and embeds it in the web / mobile application to display the card information form.
    • In which parameters have the following values:
    • clientIP = $response->data->client_id
    • deviceId = $response->data->user_id
    • orderId = $response->data->order->id
    • dataKey = $response->data->dataKey
    • napasKey = $response->data->napasKey
    • apiOperation = $response->data->apiOperation
    • orderAmount = $response->data->order->amount
    • orderCurrency = $response->data->order->currency
    • orderReference = $response->data->order_reference
//Code Js nhúng vào ứng dụng Web/Mobile:
<form id="merchant-form" action="https://yourwebsite.com/post_back_url?merchantId=BAOKIMICE" method="POST"></form>
<div id="napas-widget-container"></div>
<script type="text/javascript" id="napas-widget-script" src="https://dps-staging.napas.com.vn/api/restjs/resources/js/napas.hostedform.min.js"
        merchantId="BAOKIMCE"
        clientIP="client_ip"
        deviceId="user_id"
        environment="MobileApp"
        cardScheme="AtmCard"
        enable3DSecure="false"
        orderId="order_id"
        dataKey="dataKey"
        napasKey="napasKey"
        apiOperation="PAY_WITH_RETURNED_TOKEN"
        orderAmount="10000"
        orderCurrency="VND"
        orderReference="reference"
        channel="6014"
        sourceOfFundsType="CARD"
        language="vi">
</script>
  1. User enter OTPconfirmation.
    • OTP is 'otp'.
  2. After successfully adding the tag, the Website will redirectreturn the Merchant url above actionin the embed code.
  3. Merchant displays results.
  4. User receives result.
  5. End process.

Wallet money transfer => wallets

Procedure

Process of transferring money from flow wallet

Process Description

  1. User selects Money transfer.
  2. Merchant displays the Money Transfer Form.
  3. User enters remittance information (Recipient / Amount / Description) and Submit.
  4. Merchant calls API Send money transfer request .
    • Merchant received responseis ticket.
    • User will receive OTP code and send it to the phone number.
  5. Merchant displays OTP authentication form.
  6. User enters OTP and Submit.
  7. The Merchant calls the transfer authentication API .
    • Merchant received information responseincluding transfermoney transfer txninformation, transaction information of Bao Kim.
  8. Merchant displays Results.
  9. User receives result.
  10. End process.

Withdraw money from wallet => bank

Procedure

Process of withdrawing money from wallet flow

Process Description

  1. User select Withdraw
  2. The Merchant calls the Card / Card List API to get a list of the User's card / Bank account added, showing the list to the User.
  3. User selects card / account, enter amount and Submit.
  4. Merchant calls API Request withdrawals .
    • Merchant received responseis ticket.
    • User will receive OTP code and send it to the phone number.
  5. Merchant displays OTP authentication form.
  6. User enters OTP and Submit.
  7. Merchant calls withdrawal authentication API .
    • Merchant received information responseincluding withdrawalwithdrawal order txninformation, transaction information of Bao Kim.
  8. Merchant displays Results.
  9. User receives result.
  10. End process.

Add a receiving account

The process of adding a receiving account

  1. User selects to add a new receiving account. 2.Merchant calls Bank List API to get support from Bao Kim Bank list.
    • Merchant receives a responselist of Bank information.
  2. The Merchant displays the Bank list and the Form to enter the payment account information.
  3. User select Bank, enter account information.
  4. Merchant calls API to add new Bank account
    • Merchant receives responsebank account information stored in Bao Kim.
  5. Merchant displays results.
  6. User receives result.
  7. End process.

Payment via wallet

Procedure

The process of withdrawing payment via wallet flow

Process Description

  1. User selects Payment option via wallet.
  2. Merchant calls API to send payment request via wallet
    • Merchant received responseis ticket.
    • The user receives OTP and sends it to the phone number
  3. Merchant displays OTP Input Form.
  4. User nhập & submit OTP.
  5. Merchant calls OTP authentication API to pay from wallet
    • Merchant received responseincluded transfer, txnandorder
  6. Merchant displays results based on status order.
  7. User receives result.
  8. End process.

Payment via affiliate card

Procedure

The process of payment via link flow card

Process Description

  1. User selects the Payment option with the link card.
  2. The Merchant calls the Card List API associated with query_params conn_type = 2 to get a list of associated User's Bank cards, showing the list to the User.
  3. User select Card, enter amount and Submit.
  4. Merchant calls API Submit payment request from Link card .
    • Merchant will receive $responseincluding result, dataKey, napasKeyand parameters needed.
  5. Merchant creates the HTML as the right column and embeds it in the web / mobile application to display the card information form.
    • In which parameters have the following values:
    • clientIP = $response->data->client_id
    • deviceId = $response->data->user_id
    • orderId = $response->data->order->id
    • dataKey = $response->data->dataKey
    • napasKey = $response->data->napasKey
    • apiOperation = $response->data->apiOperation
    • orderAmount = $response->data->order->amount
    • orderCurrency = $response->data->order->currency
    • orderReference = $response->data->order_reference
//Code Js nhúng vào ứng dụng Web/Mobile:
<form id="merchant-form" action="https://yourwebsite.com/post_back_url?merchantId=BAOKIMICE" method="POST"></form>
<div id="napas-widget-container"></div>
<script type="text/javascript" id="napas-widget-script" src="https://dps-staging.napas.com.vn/api/restjs/resources/js/napas.hostedform.min.js"
        merchantId="BAOKIMCE"
        clientIP="client_ip"
        deviceId="user_id"
        environment="MobileApp"
        cardScheme="AtmCard"
        enable3DSecure="false"
        orderId="order_id"
        dataKey="dataKey"
        napasKey="napasKey"
        apiOperation="PAY_WITH_RETURNED_TOKEN"
        orderAmount="10000"
        orderCurrency="VND"
        orderReference="reference"
        channel="6014"
        sourceOfFundsType="CARD"
        language="vi">
</script>
  1. User enter OTPconfirmation.
    • OTP is 'otp'.
  2. After successfully adding the tag, the Website will redirectreturn the Merchant url above actionin the embed code.
  3. Merchant checks the order result by order_id received in step 4, showing the result.
  4. User receives result.
  5. End process.
    Constant / Const Code Description
    ERR_NONE 0 Successful (no errors)
    ERR_SYSTEM 1 System error
    ERR_VALIDATION 2 Error validate data/parameters
    ERR_OBJECT_NOT_FOUND 3 Error finding object (account/transaction/order ...)
    ERR_ACCOUNT_LOCKED 4 Account error is locked
    ERR_UNAUTHORIZED 5 Error not allowed to execute transactions (login, 2FA authentication error)
    ERR_INVALID_AMOUNT 6 Error of incorrect transaction amount
    ERR_DUPLICATED_ACTION 7 Error with repeating transactions (eg payment of 2 times ...)
    ERR_INTERNAL_SERVICE 8 Internal system error
    ERR_INSUFFICIENT_BALANCE 9 Error of insufficient account balance to execute transactions
    ERR_EXCEED_MAX_DAILY_AMOUNT 10 Transaction amount error exceeds the daily limit
    ERR_VERIFY_FAILED 11 Transaction verification error
    ERR_CONFIG_FEE_NOT_FOUND 12 Error of charging configuration
    ERR_ACCOUNT_NOT_FOUND 13 Error not found trading account
    ERR_AMOUNT_TOO_SMALL 14 Error amount is too small for the limit
    ERR_AMOUNT_TOO_BIG 15 Error amount is too large for the limit
    ERR_USER_NOT_VERIFIED 16 Error user has not verified account
    ERR_TRANSACTION_REFUNDED 18 Repeat refund error (when making a refund)
    ERR_TRANSACTION_NOT_COMPLETE 17 Incomplete transaction status error
    ERR_BANK_ACCOUNT_EXISTED 19 Bank account already exists on the system
    ERR_BANK_CARD_NOT_FOUND 20 No Bank card found
    ERR_TRANSFER_ON_BANK 21 Error transferring money to bank card
    ERR_BANK_ACCOUNT_NAME_NOT_MATCH 22 Bank account name does not match the name of Wallet
    ERR_BANK_ACCOUNT_NOT_FOUND 23 No Bank Account found
    ERR_OTHER 24 Other error (unknown)
    ERR_REFUND_NOT_ALLOWED 25 Transaction type cannot be refunded
    ERR_BANK_CARD_EXISTED 27 Bank card already exists on the system

    Get Postman Collection

    Error code table

    Constants / Const Mã / Code Described description
    ERR_NONE 0 Success (no errors)
    ERR_SYSTEM 1 System error
    ERR_VALIDATION 2 Error validating data / parameters
    ERR_OBJECT_NOT_FOUND 3 Error not finding object (account / transaction / order ...)
    ERR_ACCOUNT_LOCKED 4 Account error locked
    ERR_UNAUTHORIZED 5 Error not allowed to make transactions (login, 2FA authentication errors)
    ERR_INVALID_AMOUNT 6 Error of incorrect transaction amount
    ERR_DUPLICATED_ACTION 7 Repeated transaction errors (eg double payment ...)
    ERR_INTERNAL_SERVICE 8 Internal system error
    ERR_INSUFFICIENT_BALANCE 9 Error of account balance not enough to make transactions
    ERR_EXCEED_MAX_DAILY_AMOUNT 10 Error of transaction amount exceeding the daily limit
    ERR_VERIFY_FAILED 11 Error verifying transactions
    ERR_CONFIG_FEE_NOT_FOUND 12 Error in charging configuration
    ERR_ACCOUNT_NOT_FOUND 13 Error of not finding trading account
    ERR_AMOUNT_TOO_SMALL 14 Error amount is too small compared to the limit
    ERR_AMOUNT_TOO_BIG 15 Error amount is too large for the limit
    ERR_USER_NOT_VERIFIED 16 User error has not verified the account
    ERR_TRANSACTION_REFUNDED 18 Repeated refund error (when making refunds)
    ERR_TRANSACTION_NOT_COMPLETE 17 Error of unfinished transaction status
    ERR_BANK_ACCOUNT_EXISTED 19 Bank account already exists on the system
    ERR_BANK_CARD_NOT_FOUND 20 Bank card not found
    ERR_TRANSFER_ON_BANK 21 Error transferring money to Bank Card
    ERR_BANK_ACCOUNT_NAME_NOT_MATCH 22 Bank account name does not match the wallet name
    ERR_BANK_ACCOUNT_NOT_FOUND 23 Bank Account not found
    ERR_OTHER 24 Other error (unknown)
    ERR_REFUND_NOT_ALLOWED 25 The transaction type is not refundable
    ERR_BANK_CARD_EXISTED 27 Bank Card already exists on the system
    ERR_LINKED_USER_EXIST 47 Wallet link already exists
    ERR_MRC_NOT_FOUND 48 No Merchant found
    ERR_LINKED_CODE_INVALID 49 The link verification code is incorrect
    ERR_TICKET_FALSE 51 Ticket is malformed
    ERR_LINKED_TOKEN_INVALID 52 The link token is invalid
    ERR_LINKED_USER_VERIFIED 53 The link has been validated. Cannot be performed again
    ERR_TICKET_EXPIRED 61 Ticket has expired. Please try again
    ERR_LINKED_CODE_EXPIRED 62 Linked code has expired. Please try again
    ERR_TOKEN_UNAUTHORIZATION 63 Token Unauthorization
    ERR_AUTHENTICATION_BANK_CARD 180 Card validation error

Get Postman Collection

Account API

Account APIs

Account detail

[API Get user's Bao Kim wallet account details]

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/account/detail" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/account/detail",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/account/detail", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "id": 1001000079,
        "user_id": 1000005,
        "type": 1,
        "balance": "1110852443.45",
        "freeze_balance": "562387181.18",
        "stat": 0,
        "last_act_id": 27496,
        "created_at": "2010-04-22 07:18:50",
        "updated_at": "2018-07-02 00:28:59"
    }
}

HTTP Request

GET api/v4/account/detail

Bank API

Bank List

List of supported Kim Bao banks, Web / App merchant can use this API to display the list of Banks on its application.

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/bank/list" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/bank/list",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();
$options['query']['lb_available'] = 'n7MLUpXbuDdVPkJH';
$options['query']['offset'] = 'QVBwq59mGak708EL';
$options['query']['limit'] = 'z5PhQdJwJDrixGFL';

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/bank/list", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": "thành công",
    "count": 1,
    "data": [
        {
            "id": "105",
            "name": "VPBank - Ngân hàng Việt Nam Thịnh Vượng",
            "short_name": "VPBank",
            "logo": "uploads\/banks\/vietcombank.png",
            "lb_available": 0
        },
        {
            "id": "87",
            "name": "Techcombank - Ngân hàng Kỹ thương Việt Nam",
            "short_name": "Techcombank",
            "logo": "uploads\/banks\/techcombank.png",
            "lb_available": 0
        }
    ]
}

HTTP Request

GET api/v4/bank/list

Query Parameters

Parameter Status Description
lb_available optional Search by bank list that supports wallet links (1: support, 0: no support)
offset optional Get the word record
limit optional Maximum number of records

Bank Account API

APIs for managing Bank Accounts

List of Bank Accounts

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/bank-account/list" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/bank-account/list",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/bank-account/list", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": [
        {
            "id": 982,
            "user_id": 1000005,
            "bank_id": 1,
            "holder": "Firzen Le",
            "number": "xxxx xxxx xxxx 1111",
            "branch": "Ha Noi",
            "province_id": 31,
            "is_default": 0,
            "is_active": 1,
            "verify_stat": "w",
            "verify_branch": "u",
            "description": null,
            "created_at": "2017-09-21 04:14:53",
            "updated_at": "2017-09-21 04:14:53"
        }
    ]
}

HTTP Request

GET api/v4/bank-account/list

API to add new Bank account

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/bank-account/create"     -d "user_id"="17" \
    -d "bank_id"="13" \
    -d "holder"="4HxH8Fp10iLceuKk" \
    -d "number"="mpjf3BJ2tF43ygUU" \
    -d "branch"="VxSy3ddk4jGcGFA9" \
    -d "province_id"="cKPBiFPH22I3INFT" \
    -d "is_active"="1" \
    -d "description"="49638MoRM3I08N2P" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/bank-account/create",
    "method": "POST",
    "data": {
        "user_id": 17,
        "bank_id": 13,
        "holder": "4HxH8Fp10iLceuKk",
        "number": "mpjf3BJ2tF43ygUU",
        "branch": "VxSy3ddk4jGcGFA9",
        "province_id": "cKPBiFPH22I3INFT",
        "is_active": 1,
        "description": "49638MoRM3I08N2P"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['user_id'] = "17";
$payload['bank_id'] = "13";
$payload['holder'] = "4HxH8Fp10iLceuKk";
$payload['number'] = "mpjf3BJ2tF43ygUU";
$payload['branch'] = "VxSy3ddk4jGcGFA9";
$payload['province_id'] = "cKPBiFPH22I3INFT";
$payload['is_active'] = "1";
$payload['description'] = "49638MoRM3I08N2P";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/bank-account/create", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "user_id": 1016006,
        "bank_id": "1",
        "holder": "Nguyen Van Dong",
        "number": "07110000216088",
        "branch": null,
        "province_id": null,
        "description": null,
        "is_active": "1",
        "updated_at": "2019-03-20 10:03:23",
        "created_at": "2019-03-20 10:03:23",
        "id": 990
    }
}

HTTP Request

POST api/v4/bank-account/create

Body Parameters

Parameter Type Status Description
user_id integer required Bao Kim account code
bank_id integer required Bank code
holder string required Account Holder
number string required Account number
branch string optional Branch
province_id string optional Province ID
is_active integer required Verification status
description string optional Note

Bank Card API

APIs for managing Bank Cards

Bank Card List

[List of Bank Cards of the user]

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/bank-card/list" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/bank-card/list",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();
$options['query']['conn_type'] = 'vjNOF5BsndrEtYmL';

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/bank-card/list", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": [
        {
            "id": "ID thẻ, sử dụng khi thực hiện giao dịch nạp, rút về thẻ",
            "user_id": 1000005,
            "bank_id": 131,
            "deposit_bpm_id": 154,
            "withdraw_bpm_id": 155,
            "card_type": null,
            "owner_name": "Firzen Le",
            "short_name": null,
            "code": "số thẻ",
            "cvv_code": null,
            "token": null,
            "expiration_date": "12-12",
            "verification": 1,
            "alias": "ABBank - Ngân hàng An Bình - 2661",
            "created_at": "2017-08-30 09:15:55",
            "updated_at": "2017-08-30 09:16:24"
        }
    ]
}

HTTP Request

GET api/v4/bank-card/list

Query Parameters

Parameter Status Description
conn_type optional Card type (1: cash card, 2: affiliated card)

Bank Payment API

Bank Payment Method List

List of payment methods supported by Bao Kim banks, Web / App merchant can use this API to display payment methods on their applications This list is classified by "type" field as follows: :

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/bpm/list" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/bpm/list",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/bpm/list", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 76,
    "data": [
        {
            "id": 9,
            "name": "Thẻ ATM DongA Bank",
            "bank_id": 82,
            "type": 1,
            "complete_time": "Ngay lập tức",
            "bank_name": "DongA Bank - Ngân hàng Đông Á",
            "bank_short_name": "DongA Bank",
            "bank_logo": "https:\/\/cdn.baokim.vn\/public\/uploads\/banks\/82.png"
        },
        {
            "id": 40,
            "name": "Thẻ ATM Vietinbank",
            "bank_id": 81,
            "type": 1,
            "complete_time": "ngay lập tức",
            "bank_name": "VietinBank - Ngân hàng Công Thương",
            "bank_short_name": "Vietin Bank",
            "bank_logo": "https:\/\/cdn.baokim.vn\/public\/uploads\/banks\/81.png"
        }
    ]
}

HTTP Request

GET api/v4/bpm/list

Fee API

Calculate GD fee

Charge GD for users

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/fee/calculate-fee" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/fee/calculate-fee",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();
$options['query']['txn_type'] = '8LUaQPeRfRTvzCDj';
$options['query']['amount'] = 'wA6GUEvDe91tEPEi';

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/fee/calculate-fee", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": "thành công",
    "count": 1,
    "data": {
        "fee_amount": 50000,
        "fee_payer": 1
    }
}

HTTP Request

GET api/v4/fee/calculate-fee

Query Parameters

Parameter Status Description
txn_type required GD type
amount required Deposits (because fees may be affected by deposits).

Link an API wallet

[Bank Card Link API]

Headers: Wallet-Token : $token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/linked-atm-card"     -d "bpm_id"="7" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/linked-atm-card",
    "method": "POST",
    "data": {
        "bpm_id": 7
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['bpm_id'] = "7";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/linked-atm-card", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "apiOperation": "DATA_KEY",
        "order": {
            "amount": "10000",
            "currency": "VND",
            "id": "BK_1586849701",
            "reference": "CASHIN1330642"
        },
        "result": "SUCCESS",
        "dataKey": "cT0IN6xSIuqwRg5M8ZuyUVN\/G7fOpEz3TjPqZMvJn5Ydi+zqGS2T6B1XwpVKrh3+SzxyGchCv5lcjkQKfSJs27j3HcWwPqD5HGkecpEs87EoMg\/XUD2M3XWgQzM8P9dP6WKyR9EnoBhuPhkb5eCCiqqJxwZWxBa2rtKTw66nkxno3GzmrluzR1+KV5mUPyGZ7KHccptdkmDmIuqi4dPfUF\/xPtx99lANT1qDwYoDNcBt8Pnd22IxWOrxHTyEqTQBIbnDxjXIaX5RMuUXxMHk7MSeAMbRPSltDfG2mENewCORWCLXCCi1IB3hslN9buFpyevaBAa5o0UcTgS9EvGTcYeyCiW4EdelyN1hWeYOzNvZNTfCwzKdbDAuyRvxqC\/L0W8CGk4npgh60xPptfSRdDQ0W7xeJwNWptxGraO6fdEmhalXaPJjXK+br5tBWWBTea8\/RG7++XHuhe\/DfeJnMw==",
        "napasKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArbP6iFl0Z9pDHv5ni\/fhl4ME6AfP16E5zmrHYftaBlcvq1bWRwk1TH23OrYQ6n6jEGIbmrVXzIM00lk723\/ZHtvbyZld8r5TcEh5M+h\/jIu3\/J9gqNYGTo9jLJ0DvRdSfzbDWJqPImPfcGJDRPTrEtckqmd8HvkU6J3MCPrg0IOGTYplUmw6DZ25g1SpBSb1CAWGqP36nqyxNZ4hNJ08agHQbRc\/ICHUb\/8+\/UjDETX96SYVn+GBKbrMM\/NcgiJV7UXbEmQ9OEiM3BbI5srhCOt0oYoCp0sJcpLcLbRlpdC7\/nV44KPty1rkZ32KlBufz3UVggXpHPz0k0yxYTvl\/wIDAQAB:MIICtTCCAZ0CBgFoko89+DANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNUZXN0IENBIENlcnRpZmljYXRlMB4XDTE5MDEyODAzNDQ0N1oXDTE5MDEyOTAzNDQ0N1owHjEcMBoGA1UEAxMTVGVzdCBDQSBDZXJ0aWZpY2F0ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK2z+ohZdGfaQx7+Z4v34ZeDBOgHz9ehOc5qx2H7WgZXL6tW1kcJNUx9tzq2EOp+oxBiG5q1V8yDNNJZO9t\/2R7b28mZXfK+U3BIeTPof4yLt\/yfYKjWBk6PYyydA70XUn82w1iajyJj33BiQ0T06xLXJKpnfB75FOidzAj64NCDhk2KZVJsOg2duYNUqQUm9QgFhqj9+p6ssTWeITSdPGoB0G0XPyAh1G\/\/Pv1IwxE1\/ekmFZ\/hgSm6zDPzXIIiVe1F2xJkPThIjNwWyObK4QjrdKGKAqdLCXKS3C20ZaXQu\/51eOCj7cta5Gd9ipQbn891FYIF6Rz89JNMsWE75f8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAFXK48p71S87EmrnCm5Yvv42Oxzh0B18\/q4jn891xS1abFRkW2jdCvpc3IUQL6gy+JFQcY2NSaLhIYgBafmcngiBFt4kkTqUuwSdIWudl3jYkO58SOYKdxW8jbXM5KwTujpb0gYBpf1u5828RmEq6YEog\/yx\/hYQOFQlfIBBZFNmUJ7U5TDCFL2wT5MqPg2cfb1DirveD3sLSIUc90IJM3eUXfzXqkwdrCKDZRSuV3TMHChi1IRio2fg7zesi9HliFueaekkvynnwXoG41LKaMSBMM\/Mdrb2tm29jVYnlYJ8Coj+dOjWhU2y83dFi5DGr8a3ftWOc+rEz2zlOUKRF7Q==",
        "user_id": 1000005,
        "client_ip": "118.70.233.72"
    }
}

HTTP Request

POST api/v4/linked-wallet/linked-atm-card

Body Parameters

Parameter Type Status Description
bpm_id integer required Payment Method ID

Top Up Card

[API recharge into a wallet]

Headers: Wallet-Token : $token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/topup-wallet"     -d "amount"="4" \
    -d "card_id"="13" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/topup-wallet",
    "method": "POST",
    "data": {
        "amount": 4,
        "card_id": 13
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['amount'] = "4";
$payload['card_id'] = "13";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/topup-wallet", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "apiOperation": "PURCHASE_OTP",
        "merchantId": "BAOKIMCE",
        "order": {
            "amount": "100550",
            "creationTime": "2020-04-14T16:04:19.589Z",
            "currency": "VND",
            "id": "ORD_BK_1586855062"
        },
        "response": {
            "acquirerCode": "11",
            "gatewayCode": "PENDING_FOR_OTP"
        },
        "result": "SUCCESS",
        "sourceOfFunds": {
            "provided": {
                "card": {
                    "brand": "SML",
                    "nameOnCard": "NGUYEN VAN A",
                    "issueDate": "0307",
                    "number": "970400xxxxxx0018",
                    "scheme": "OTHERS"
                }
            },
            "type": "CARD"
        },
        "transaction": {
            "acquirer": {
                "id": "835640836",
                "transactionId": "835640836"
            },
            "amount": "100550",
            "currency": "VND",
            "id": "1205628",
            "type": "PAYMENT"
        },
        "version": "1",
        "channel": "1234",
        "dataKey": "cT0IN6xSIuqwRg5M8ZuyUVN\/G7fOpEz3TjPqZMvJn5Ydi+zqGS2T6B1XwpVKrh3+SzxyGchCv5lcjkQKfSJs2788Ogjmro4SrpI46q+TIUxXdoSHnVCt7\/Bc3yiuKxoIM8wuGVOiOHC\/ubQzF1z7kqZwLE0yfhVy3No64aRSJ4ps509SwfK4AFpLve+XZHUMh1P6dwjz6\/sWhL0jainf+pqZu2ByS9WagIVL8HjnZKRif0R6iyi2kpZvmFoP9AekFdSfILFQ58tGeSYgHjcKUIc+5OJtrxT7FceE4Dgqr7IqJXQzcjZjtBGyST595dGcVqeuJfDy6tSMqhptIRDMPyLlAlzVi8dEJb0+X4jVEs3kRTIagGf1R0yA01YDJf41Jao83k0YJxVTgxBuSvlLhAV9LEx7d1GzwhDSOkDRDg\/pyErtBXNznx5Vr6IfOKYv+JPz030U3WZIU5SGKXbsfQ==",
        "napasKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArbP6iFl0Z9pDHv5ni\/fhl4ME6AfP16E5zmrHYftaBlcvq1bWRwk1TH23OrYQ6n6jEGIbmrVXzIM00lk723\/ZHtvbyZld8r5TcEh5M+h\/jIu3\/J9gqNYGTo9jLJ0DvRdSfzbDWJqPImPfcGJDRPTrEtckqmd8HvkU6J3MCPrg0IOGTYplUmw6DZ25g1SpBSb1CAWGqP36nqyxNZ4hNJ08agHQbRc\/ICHUb\/8+\/UjDETX96SYVn+GBKbrMM\/NcgiJV7UXbEmQ9OEiM3BbI5srhCOt0oYoCp0sJcpLcLbRlpdC7\/nV44KPty1rkZ32KlBufz3UVggXpHPz0k0yxYTvl\/wIDAQAB:MIICtTCCAZ0CBgFoko89+DANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNUZXN0IENBIENlcnRpZmljYXRlMB4XDTE5MDEyODAzNDQ0N1oXDTE5MDEyOTAzNDQ0N1owHjEcMBoGA1UEAxMTVGVzdCBDQSBDZXJ0aWZpY2F0ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK2z+ohZdGfaQx7+Z4v34ZeDBOgHz9ehOc5qx2H7WgZXL6tW1kcJNUx9tzq2EOp+oxBiG5q1V8yDNNJZO9t\/2R7b28mZXfK+U3BIeTPof4yLt\/yfYKjWBk6PYyydA70XUn82w1iajyJj33BiQ0T06xLXJKpnfB75FOidzAj64NCDhk2KZVJsOg2duYNUqQUm9QgFhqj9+p6ssTWeITSdPGoB0G0XPyAh1G\/\/Pv1IwxE1\/ekmFZ\/hgSm6zDPzXIIiVe1F2xJkPThIjNwWyObK4QjrdKGKAqdLCXKS3C20ZaXQu\/51eOCj7cta5Gd9ipQbn891FYIF6Rz89JNMsWE75f8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAFXK48p71S87EmrnCm5Yvv42Oxzh0B18\/q4jn891xS1abFRkW2jdCvpc3IUQL6gy+JFQcY2NSaLhIYgBafmcngiBFt4kkTqUuwSdIWudl3jYkO58SOYKdxW8jbXM5KwTujpb0gYBpf1u5828RmEq6YEog\/yx\/hYQOFQlfIBBZFNmUJ7U5TDCFL2wT5MqPg2cfb1DirveD3sLSIUc90IJM3eUXfzXqkwdrCKDZRSuV3TMHChi1IRio2fg7zesi9HliFueaekkvynnwXoG41LKaMSBMM\/Mdrb2tm29jVYnlYJ8Coj+dOjWhU2y83dFi5DGr8a3ftWOc+rEz2zlOUKRF7Q==",
        "user_id": 1000005,
        "client_ip": "118.70.233.72",
        "deposit_id": 125643
    }
}

HTTP Request

POST api/v4/linked-wallet/topup-wallet

Body Parameters

Parameter Type Status Description
amount integer required Deposit amount
card_id integer required Card ID saved

Submit a money transfer request

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/request-transfer"     -d "to_user"="LMQXr3AU93CdqKBi" \
    -d "amount"="15329009.6" \
    -d "description"="sSal4Ma9wuplg0om" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/request-transfer",
    "method": "POST",
    "data": {
        "to_user": "LMQXr3AU93CdqKBi",
        "amount": 15329009.6,
        "description": "sSal4Ma9wuplg0om"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['to_user'] = "LMQXr3AU93CdqKBi";
$payload['amount'] = "15329009.6";
$payload['description'] = "sSal4Ma9wuplg0om";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/request-transfer", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "ticket": "eyNmVESFNPcHdKK3JMdEQ5WDZxUmZQb3BNcjJ6N04rZWlXeVNwekViTzF4UWJTNk02VldzRzdBK3BKeU9ZdkFsekh0YXF5d0lCZlZDb3NYaUpoZmJsb3c9PQ=="
    }
}

HTTP Request

POST api/v4/linked-wallet/request-transfer

Body Parameters

Parameter Type Status Description
to_user string required Recipients (email / phone)
amount number required Amount of money
description string required Description

Confirm OTP money transfer

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-transfer"     -d "otp"="111671.9988" \
    -d "ticket"="DSKJ6vxVVg0ytE6Z" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-transfer",
    "method": "POST",
    "data": {
        "otp": 111671.9988,
        "ticket": "DSKJ6vxVVg0ytE6Z"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['otp'] = "111671.9988";
$payload['ticket'] = "DSKJ6vxVVg0ytE6Z";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-transfer", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "transfer": {
            "from_account_id": 1001033358,
            "to_account_id": 1001033402,
            "amount": "10000",
            "description": "Mo ta chuyen tien",
            "fee_from": 0,
            "fee_to": 100,
            "stat": 1,
            "order_id": null,
            "updated_at": "2020-04-20 10:36:14",
            "created_at": "2020-04-20 10:36:14",
            "id": 1993
        },
        "txn": {
            "user_id": 1330642,
            "account_id": 1001033358,
            "amount": -10000,
            "fee_amount": 0,
            "fee_display": 100,
            "description": "Mo ta chuyen tien",
            "ref_no": "TRF_1993",
            "stat": 4,
            "type": 5,
            "src_des": "haumv174@gmail.com",
            "updated_at": "2020-04-20 10:36:14",
            "created_at": "2020-04-20 10:36:14",
            "id": 59291,
            "mrc_order_id": null,
            "total_amount": null
        }
    }
}

HTTP Request

POST api/v4/linked-wallet/confirm-transfer

Body Parameters

Parameter Type Status Description
otp number required Otp code
ticket string required My ticket

Xác thực ví doanh nghiệp bằng tài khoản ngân hàng

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/identify-wallet-enterprise" \
    -H "Content-Type: application/json" \
    -d "holder"="dolor" \
    -d "bank_id"="8" \
    -d "bank_account"="ut" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/identify-wallet-enterprise",
    "method": "POST",
    "data": {
        "holder": "dolor",
        "bank_id": 8,
        "bank_account": "ut"
    },
    "headers": {
        "Content-Type": "application/json",
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['holder'] = "dolor";
$payload['bank_id'] = "8";
$payload['bank_account'] = "ut";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/identify-wallet-enterprise", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

[
    {
        "status": 200,
        "content": "{\n\"code\": 0,\n\"msg\": [],\n\"count\": 0,\n\"data\": {\n  \"user_id\": 1000005,\n  \"bank_id\": \"105\",\n  \"withdraw_bpm_id\": 240,\n  \"holder\": \"DANG VAN DUC\",\n  \"branch\": null,\n  \"province_id\": null,\n  \"description\": null,\n  \"verify_stat\": \"v\",\n  \"is_active\": 0,\n  \"updated_at\": \"2018-12-18 05:31:15\",\n  \"created_at\": \"2018-12-18 05:31:15\"\n}\n}"
    }
]

HTTP Request

POST api/v4/linked-wallet/identify-wallet-enterprise

Body Parameters

Parameter Type Status Description
holder string required Tên người in trên thẻ
bank_id integer required bank_id từ https://developer.baokim.vn/payment/#bank-api
bank_account string required Số tài khoản atm

Submit a withdrawal request

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/request-withdrawal"     -d "card_id"="17" \
    -d "bank_account_id"="4" \
    -d "amount"="7195998.0418" \
    -d "description"="LqGpJ5apk1rRLg2k" \
    -d "type"="5" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/request-withdrawal",
    "method": "POST",
    "data": {
        "card_id": 17,
        "bank_account_id": 4,
        "amount": 7195998.0418,
        "description": "LqGpJ5apk1rRLg2k",
        "type": 5
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['card_id'] = "17";
$payload['bank_account_id'] = "4";
$payload['amount'] = "7195998.0418";
$payload['description'] = "LqGpJ5apk1rRLg2k";
$payload['type'] = "5";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/request-withdrawal", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "ticket": "eyNmVESFNPcHdKK3JMdEQ5WDZxUmZQb3BNcjJ6N04rZWlXeVNwekViTzF4UWJTNk02VldzRzdBK3BKeU9ZdkFsekh0YXF5d0lCZlZDb3NYaUpoZmJsb3c9PQ=="
    }
}

HTTP Request

POST api/v4/linked-wallet/request-withdrawal

Body Parameters

Parameter Type Status Description
card_id integer optional required_without: bank_account_id Receiving Account ID
bank_account_id integer optional required_without:card_id ID Thẻ Nhận tiền
amount number required Amount of money
description string required Description
type integer required 0: Account, 1: Card

Confirm OTP withdrawal

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-withdrawal"     -d "otp"="4313.941" \
    -d "ticket"="SJlzNJcgEKr0uLzw" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-withdrawal",
    "method": "POST",
    "data": {
        "otp": 4313.941,
        "ticket": "SJlzNJcgEKr0uLzw"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['otp'] = "4313.941";
$payload['ticket'] = "SJlzNJcgEKr0uLzw";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-withdrawal", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "withdrawal": {
            "user_id": 1000005,
            "account_id": 1001000079,
            "card_id": 475,
            "description": "rut tien ve the vcb",
            "stat": 6,
            "amount": "10000",
            "fee_amount": 50000,
            "net_amount": -40000,
            "updated_at": "2018-12-18 05:31:15",
            "created_at": "2018-12-18 05:31:15",
            "id": 454
        },
        "txn": {
            "user_id": 1000005,
            "account_id": 1001000079,
            "amount": -60000,
            "fee_amount": 50000,
            "fee_display": 50000,
            "description": "rut tien ve the vcb",
            "ref_no": 454,
            "stat": 4,
            "updated_at": "2018-12-18 05:31:15",
            "created_at": "2018-12-18 05:31:15",
            "id": 27815
        }
    }
}

HTTP Request

POST api/v4/linked-wallet/confirm-withdrawal

Body Parameters

Parameter Type Status Description
otp number required Otp code
ticket string required My ticket

Add card / receiving account

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/add-withdrawal-option"     -d "bank_id"="22150.21557" \
    -d "number"="34.37" \
    -d "type"="4377482.019804" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/add-withdrawal-option",
    "method": "POST",
    "data": {
        "bank_id": 22150.21557,
        "number": 34.37,
        "type": 4377482.019804
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['bank_id'] = "22150.21557";
$payload['number'] = "34.37";
$payload['type'] = "4377482.019804";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/add-withdrawal-option", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "user_id": 1330642,
        "bank_id": "117",
        "number": "9704060129837294",
        "own_name": "NGUYEN VAN NAPAS TEST ONLINE IBFT 247 VN",
        "type": "1",
        "withdraw_bpm_id": 184,
        "stat": 0
    }
}

HTTP Request

POST api/v4/linked-wallet/add-withdrawal-option

Body Parameters

Parameter Type Status Description
bank_id number required Bank Id
number number required Card number / Account number
type number required 0: Account, 1: Card

List of cards / accounts to receive money

Headers: Wallet-Token: $wallet_token

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/linked-wallet/get-list-withdrawal-option" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/get-list-withdrawal-option",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/linked-wallet/get-list-withdrawal-option", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "account_type": [
            {
                "id": 927,
                "bank_id": 110,
                "ownName": "Firzen Le",
                "number": "123123 xxx xxx 3123",
                "stat": 0
            },
            {
                "id": 928,
                "bank_id": 110,
                "ownName": "Firzen Le",
                "number": "123123 xxx xxx 1231",
                "stat": 0
            },
            {
                "id": 929,
                "bank_id": 110,
                "ownName": "Firzen Le",
                "number": "123123 xxx xxx 3123",
                "stat": 0
            }
        ],
        "card_type": [
            {
                "id": 731,
                "bank_id": 18,
                "ownName": "LE DUC DANG",
                "number": "970436 xxx xxx 5014",
                "stat": 1
            },
            {
                "id": 732,
                "bank_id": 18,
                "ownName": "LE DUC DANG",
                "number": "970411 xxx xxx 2096",
                "stat": 1
            },
            {
                "id": 733,
                "bank_id": 18,
                "ownName": "LE DUC DANG",
                "number": "970411 xxx xxx 2180",
                "stat": 1
            }
        ]
    }
}

HTTP Request

GET api/v4/linked-wallet/get-list-withdrawal-option

API of Recharge Transaction Details

Headers: Wallet-Token: $wallet_token

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/linked-wallet/get-txn-detail" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/get-txn-detail",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/linked-wallet/get-txn-detail", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "id": 59781,
        "user_id": 1991990,
        "account_id": 1001033883,
        "opening_balance": "10019900.00",
        "amount": "9000000.00",
        "balance": "19019900.00",
        "opening_freeze_balance": "0.00",
        "freeze_amount": "0.00",
        "freeze_balance": "0.00",
        "ref_no": "DEP_1206321",
        "bank_ref_no": "835643443",
        "type": 1,
        "stat": 4,
        "description": null,
        "fee_amount": "0.00",
        "fee_display": "100760.00",
        "is_processed": 1,
        "src_des": "Vietcombank",
        "encrypted_id": null,
        "deposit_id": 1206321,
        "created_at": "2020-04-24 00:39:11",
        "updated_at": "2020-04-24 00:39:11",
        "mrc_order_id": null,
        "total_amount": null
    }
}

HTTP Request

GET api/v4/linked-wallet/get-txn-detail

Send payment request via wallet

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/request-payment-by-wallet"     -d "mrc_order_id"="4MNI8eFqDPy0AddG" \
    -d "amount"="63.742" \
    -d "description"="e2th2sr5GbTryrCW" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/request-payment-by-wallet",
    "method": "POST",
    "data": {
        "mrc_order_id": "4MNI8eFqDPy0AddG",
        "amount": 63.742,
        "description": "e2th2sr5GbTryrCW"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['mrc_order_id'] = "4MNI8eFqDPy0AddG";
$payload['amount'] = "63.742";
$payload['description'] = "e2th2sr5GbTryrCW";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/request-payment-by-wallet", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "ticket": "eyNmVESFNPcHdKK3JMdEQ5WDZxUmZQb3BNcjJ6N04rZWlXeVNwekViTzF4UWJTNk02VldzRzdBK3BKeU9ZdkFsekh0YXF5d0lCZlZDb3NYaUpoZmJsb3c9PQ=="
    }
}

HTTP Request

POST api/v4/linked-wallet/request-payment-by-wallet

Body Parameters

Parameter Type Status Description
mrc_order_id string required Code orders
amount number required Amount of money
description string required Describe the order

Confirm OTP payment via wallet

Headers: Wallet-Token: $wallet_token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-payment-by-wallet"     -d "otp"="3.35602909" \
    -d "ticket"="v6xNKGSadOugXm3o" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-payment-by-wallet",
    "method": "POST",
    "data": {
        "otp": 3.35602909,
        "ticket": "v6xNKGSadOugXm3o"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['otp'] = "3.35602909";
$payload['ticket'] = "v6xNKGSadOugXm3o";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/confirm-payment-by-wallet", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "msg": [],
    "count": 0,
    "data": {
        "transfer": {
            "from_account_id": 1001033358,
            "to_account_id": 1001033402,
            "amount": "10000",
            "description": "",
            "fee_from": 0,
            "fee_to": 100,
            "stat": 1,
            "order_id": null,
            "updated_at": "2020-04-20 10:36:14",
            "created_at": "2020-04-20 10:36:14",
            "id": 1993
        },
        "txn": {
            "user_id": 1330642,
            "account_id": 1001033358,
            "amount": -10000,
            "fee_amount": 0,
            "fee_display": 100,
            "description": "",
            "ref_no": "TRF_1993",
            "stat": 4,
            "type": 5,
            "src_des": "haumv174@gmail.com",
            "updated_at": "2020-04-20 10:36:14",
            "created_at": "2020-04-20 10:36:14",
            "id": 59291,
            "mrc_order_id": null,
            "total_amount": null
        },
        "order": {
            "id": 61442,
            "user_id": 1000005,
            "mrc_order_id": "Payment_wallet_01",
            "txn_id": 59291,
            "ref_no": null,
            "deposit_id": null,
            "merchant_id": null,
            "total_amount": "100000.00",
            "shipping_fee": "0.00",
            "tax_fee": "0.00",
            "mrc_fee": null,
            "description": "Thanh toann tu vi",
            "items": null,
            "url_success": null,
            "url_cancel": null,
            "url_detail": null,
            "stat": "c",
            "payment_version": "4.0",
            "lang": "vi",
            "bpm_id": 0,
            "accept_qrpay": 1,
            "accept_bank": 1,
            "accept_cc": 1,
            "email": "1@bk.vn",
            "name": "Dang Le Duc",
            "webhooks": null,
            "customer_name": "NGUYEN VAN A",
            "customer_email": "nguyenvana@gmail.com",
            "customer_phone": "0399999999",
            "customer_address": null,
            "created_at": "2020-05-14 13:49:09",
            "updated_at": "2020-05-14 13:49:29"
        }
    }
}

HTTP Request

POST api/v4/linked-wallet/confirm-payment-by-wallet

Body Parameters

Parameter Type Status Description
otp number required Otp code
ticket string required My ticket

Payment from affiliate card

[Payment API from affiliate card]

Headers: Wallet-Token : $token

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/linked-wallet/request-payment-by-atm"     -d "mrc_order_id"="C58Gr1bC9IRgUh9r" \
    -d "amount"="6" \
    -d "card_id"="15" \
    -d "description"="tcbDhhuyDbTliamq" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/linked-wallet/request-payment-by-atm",
    "method": "POST",
    "data": {
        "mrc_order_id": "C58Gr1bC9IRgUh9r",
        "amount": 6,
        "card_id": 15,
        "description": "tcbDhhuyDbTliamq"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['mrc_order_id'] = "C58Gr1bC9IRgUh9r";
$payload['amount'] = "6";
$payload['card_id'] = "15";
$payload['description'] = "tcbDhhuyDbTliamq";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/linked-wallet/request-payment-by-atm", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "apiOperation": "PURCHASE_OTP",
        "merchantId": "BAOKIMCE",
        "order": {
            "amount": "100550",
            "creationTime": "2020-04-14T16:04:19.589Z",
            "currency": "VND",
            "id": "ORD_BK_1586855062"
        },
        "response": {
            "acquirerCode": "11",
            "gatewayCode": "PENDING_FOR_OTP"
        },
        "result": "SUCCESS",
        "sourceOfFunds": {
            "provided": {
                "card": {
                    "brand": "SML",
                    "nameOnCard": "NGUYEN VAN A",
                    "issueDate": "0307",
                    "number": "970400xxxxxx0018",
                    "scheme": "OTHERS"
                }
            },
            "type": "CARD"
        },
        "transaction": {
            "acquirer": {
                "id": "835640836",
                "transactionId": "835640836"
            },
            "amount": "100550",
            "currency": "VND",
            "id": "1205628",
            "type": "PAYMENT"
        },
        "version": "1",
        "channel": "1234",
        "dataKey": "cT0IN6xSIuqwRg5M8ZuyUVN\/G7fOpEz3TjPqZMvJn5Ydi+zqGS2T6B1XwpVKrh3+SzxyGchCv5lcjkQKfSJs2788Ogjmro4SrpI46q+TIUxXdoSHnVCt7\/Bc3yiuKxoIM8wuGVOiOHC\/ubQzF1z7kqZwLE0yfhVy3No64aRSJ4ps509SwfK4AFpLve+XZHUMh1P6dwjz6\/sWhL0jainf+pqZu2ByS9WagIVL8HjnZKRif0R6iyi2kpZvmFoP9AekFdSfILFQ58tGeSYgHjcKUIc+5OJtrxT7FceE4Dgqr7IqJXQzcjZjtBGyST595dGcVqeuJfDy6tSMqhptIRDMPyLlAlzVi8dEJb0+X4jVEs3kRTIagGf1R0yA01YDJf41Jao83k0YJxVTgxBuSvlLhAV9LEx7d1GzwhDSOkDRDg\/pyErtBXNznx5Vr6IfOKYv+JPz030U3WZIU5SGKXbsfQ==",
        "napasKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArbP6iFl0Z9pDHv5ni\/fhl4ME6AfP16E5zmrHYftaBlcvq1bWRwk1TH23OrYQ6n6jEGIbmrVXzIM00lk723\/ZHtvbyZld8r5TcEh5M+h\/jIu3\/J9gqNYGTo9jLJ0DvRdSfzbDWJqPImPfcGJDRPTrEtckqmd8HvkU6J3MCPrg0IOGTYplUmw6DZ25g1SpBSb1CAWGqP36nqyxNZ4hNJ08agHQbRc\/ICHUb\/8+\/UjDETX96SYVn+GBKbrMM\/NcgiJV7UXbEmQ9OEiM3BbI5srhCOt0oYoCp0sJcpLcLbRlpdC7\/nV44KPty1rkZ32KlBufz3UVggXpHPz0k0yxYTvl\/wIDAQAB:MIICtTCCAZ0CBgFoko89+DANBgkqhkiG9w0BAQUFADAeMRwwGgYDVQQDExNUZXN0IENBIENlcnRpZmljYXRlMB4XDTE5MDEyODAzNDQ0N1oXDTE5MDEyOTAzNDQ0N1owHjEcMBoGA1UEAxMTVGVzdCBDQSBDZXJ0aWZpY2F0ZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAK2z+ohZdGfaQx7+Z4v34ZeDBOgHz9ehOc5qx2H7WgZXL6tW1kcJNUx9tzq2EOp+oxBiG5q1V8yDNNJZO9t\/2R7b28mZXfK+U3BIeTPof4yLt\/yfYKjWBk6PYyydA70XUn82w1iajyJj33BiQ0T06xLXJKpnfB75FOidzAj64NCDhk2KZVJsOg2duYNUqQUm9QgFhqj9+p6ssTWeITSdPGoB0G0XPyAh1G\/\/Pv1IwxE1\/ekmFZ\/hgSm6zDPzXIIiVe1F2xJkPThIjNwWyObK4QjrdKGKAqdLCXKS3C20ZaXQu\/51eOCj7cta5Gd9ipQbn891FYIF6Rz89JNMsWE75f8CAwEAATANBgkqhkiG9w0BAQUFAAOCAQEAFXK48p71S87EmrnCm5Yvv42Oxzh0B18\/q4jn891xS1abFRkW2jdCvpc3IUQL6gy+JFQcY2NSaLhIYgBafmcngiBFt4kkTqUuwSdIWudl3jYkO58SOYKdxW8jbXM5KwTujpb0gYBpf1u5828RmEq6YEog\/yx\/hYQOFQlfIBBZFNmUJ7U5TDCFL2wT5MqPg2cfb1DirveD3sLSIUc90IJM3eUXfzXqkwdrCKDZRSuV3TMHChi1IRio2fg7zesi9HliFueaekkvynnwXoG41LKaMSBMM\/Mdrb2tm29jVYnlYJ8Coj+dOjWhU2y83dFi5DGr8a3ftWOc+rEz2zlOUKRF7Q==",
        "user_id": 1000005,
        "client_ip": "118.70.233.72",
        "deposit_id": 125643,
        "order_id": 6123
    }
}

HTTP Request

POST api/v4/linked-wallet/request-payment-by-atm

Body Parameters

Parameter Type Status Description
mrc_order_id string required Code orders
amount integer required Payment amount
card_id integer required Card ID saved
description string required Describe the order

Order API

The Order API provides APIs for the integration of order / product billing from sales websites / apps / digital content ...

You need to be aware of the Bao Kim payment integration process provided before making any payment integration

Send Order

[API Sending order information from user's application to Bao Kim to make payment.]

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/order/send"     -d "mrc_order_id"="bjc4rTXyWC8T1btE" \
    -d "total_amount"="12" \
    -d "description"="Zek69Qc7cQBIxrBC" \
    -d "url_success"="azkgbDSOYozfXO8H" \
    -d "merchant_id"="13" \
    -d "url_detail"="vuos4oOmYYc6DgzS" \
    -d "lang"="bha5WRKzeRtVWsiN" \
    -d "bpm_id"="16" \
    -d "accept_bank"="8Qg56aVAWJrOfABs" \
    -d "accept_cc"="hVJjIY8hgDTx8aFH" \
    -d "accept_qrpay"="S5EdAp8vR7WUajv1" \
    -d "webhooks"="eCiJdJ4EYSyzupie" \
    -d "customer_email"="yCb62208HhXIAdhK" \
    -d "customer_phone"="6IIUBY14k99X3WTx" \
    -d "customer_name"="kaujxUW8g6toyBWv" \
    -d "customer_address"="2WBIBYU0YAOL7Sd7" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/order/send",
    "method": "POST",
    "data": {
        "mrc_order_id": "bjc4rTXyWC8T1btE",
        "total_amount": 12,
        "description": "Zek69Qc7cQBIxrBC",
        "url_success": "azkgbDSOYozfXO8H",
        "merchant_id": 13,
        "url_detail": "vuos4oOmYYc6DgzS",
        "lang": "bha5WRKzeRtVWsiN",
        "bpm_id": 16,
        "accept_bank": "8Qg56aVAWJrOfABs",
        "accept_cc": "hVJjIY8hgDTx8aFH",
        "accept_qrpay": "S5EdAp8vR7WUajv1",
        "webhooks": "eCiJdJ4EYSyzupie",
        "customer_email": "yCb62208HhXIAdhK",
        "customer_phone": "6IIUBY14k99X3WTx",
        "customer_name": "kaujxUW8g6toyBWv",
        "customer_address": "2WBIBYU0YAOL7Sd7"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['mrc_order_id'] = "bjc4rTXyWC8T1btE";
$payload['total_amount'] = "12";
$payload['description'] = "Zek69Qc7cQBIxrBC";
$payload['url_success'] = "azkgbDSOYozfXO8H";
$payload['merchant_id'] = "13";
$payload['url_detail'] = "vuos4oOmYYc6DgzS";
$payload['lang'] = "bha5WRKzeRtVWsiN";
$payload['bpm_id'] = "16";
$payload['accept_bank'] = "8Qg56aVAWJrOfABs";
$payload['accept_cc'] = "hVJjIY8hgDTx8aFH";
$payload['accept_qrpay'] = "S5EdAp8vR7WUajv1";
$payload['webhooks'] = "eCiJdJ4EYSyzupie";
$payload['customer_email'] = "yCb62208HhXIAdhK";
$payload['customer_phone'] = "6IIUBY14k99X3WTx";
$payload['customer_name'] = "kaujxUW8g6toyBWv";
$payload['customer_address'] = "2WBIBYU0YAOL7Sd7";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/order/send", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "order_id": 50911,
        "redirect_url": "\/payment\/?oid=50911&checksum=50f1c60363c29c19b1c18359f1b4cfc655165117",
        "payment_url": "http:\/\/sandbox.baokim.vn\/payment\/?oid=50911&checksum=50f1c60363c29c19b1c18359f1b4cfc655165117",
        "bank_account": {
            "acc_name": "Tên tài khoản ngân hàng",
            "acc_no": "Số tài khoản ngân hàng",
            "bank_name": "Tên ngân hàng",
            "branch": "Chi nhánh",
            "amount": "Số tiền cần chuyển khoản"
        }
    }
}

HTTP Request

POST api/v4/order/send

Body Parameters

Parameter Type Status Description
mrc_order_id string required merchant's order code
total_amount integer required The total amount of the order
description string required Transaction description
url_success string required Url redirect again after successful payment
merchant_id integer optional website id code From website validation
url_detail string optional Line item url (redirects again when the customer cancels order)
lang string optional Language (en / vi)
bpm_id integer optional Payment method ID from bank From API Bank Payment Method List
accept_bank int(0,1) optional Accept payment by ATM card? (Accept: 1, Not accept: 0, default: 1)
accept_cc int(0,1) optional Accept payment by Credit Card? (Accept: 1, Not accept: 0, default: 1)
accept_qrpay int(0,1) optional Accept payment by QR code? (Accept: 1, Not acceptable: 0, default: 0)
webhooks string optional url used to send notifications for sales website, chat, ... when the order is successful, allows notify to multiple urls, separated by
customer_email string optional Email client
customer_phone string optional Customer's phone number
customer_name string optional Customer's full name
customer_address string optional Customer address

Order Detail

[API Get order information details, can be used to check the status of order payment.] Orders are considered to have been successfully paid when there are:

Note: With payment transactions from credit cards, orders may be in 'r' pending status (Reviewing). In this case, the customer has paid but the transaction must wait for the Bank's approval. Bao Kim will not add the wallet balance to Merchant until the bank approves. Delivery immediately or waiting for approval will be determined by Merchant.

List of order statuses:

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/order/detail" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/order/detail",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();
$options['query']['id'] = 'sPpd5aAJlGUTZiFl';
$options['query']['mrc_order_id'] = 'AVsBTzREZGBp8kMq';

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/order/detail", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "id": 45458,
        "user_id": "1000005",
        "mrc_order_id": "mrc_1543306400",
        "txn_id": null,
        "ref_no": null,
        "deposit_id": null,
        "merchant_id": null,
        "total_amount": "100000.00",
        "shipping_fee": "0.00",
        "tax_fee": "0.00",
        "mrc_fee": null,
        "description": "thanh toan don hang 1543306400",
        "url_success": "https:\/\/vnexpress.net\/",
        "url_cancel": null,
        "url_detail": null,
        "stat": "p",
        "payment_version": "4.0",
        "lang": "vi",
        "bpm_id": 0,
        "accept_qrpay": 0,
        "created_at": "2018-11-27 08:13:22",
        "updated_at": "2018-11-27 08:13:22"
    }
}

HTTP Request

GET api/v4/order/detail

Query Parameters

Parameter Status Description
id optional Order ID [semi-optional]
mrc_order_id optional The unique order code created for the merchant [semi-optional]

List Order

[API Get list of user orders, can be used to match orders between applications and Bao Kim.]

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/order/list" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/order/list",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();
$options['query']['mrc_order_id'] = 'zWBq8BEEHysrNRh9';
$options['query']['txn_id'] = 'kBDP1k3zSwXzAHTo';
$options['query']['stat'] = 'fR7y0AeCMxynNkHP';
$options['query']['from_date'] = 'w5d38WM0YZs0kFmy';
$options['query']['to_date'] = '7QyIEouxtNLjWO4b';
$options['query']['per_page'] = 'F7RwKPuK86eaC09O';
$options['query']['page'] = '15';

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/order/list", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "current_page": 2,
        "data": [
            {
                "id": 3,
                "user_id": "100000",
                "mrc_order_id": "71364",
                "txn_id": null,
                "ref_no": "1000033",
                "deposit_id": null,
                "merchant_id": 6,
                "total_amount": "4000.00",
                "shipping_fee": "0.00",
                "tax_fee": "0.00",
                "mrc_fee": null,
                "description": "Mua hàng tại Vatgia.com, mã đơn hàng dienthoaigiatot_20100420153128",
                "url_success": "http:\/\/vatgia.com\/baokim\/return_payment.php",
                "url_cancel": "",
                "url_detail": "http:\/\/vatgia.com\/profile\/?module=order_detail&record_id=71364",
                "stat": null,
                "payment_version": null,
                "lang": "vi",
                "bpm_id": 0,
                "accept_qrpay": 0,
                "created_at": "-0001-11-30 00:00:00",
                "updated_at": "-0001-11-30 00:00:00"
            }
        ]
    }
}

HTTP Request

GET api/v4/order/list

Query Parameters

Parameter Status Description
mrc_order_id optional code orders
txn_id optional Trading code
stat optional order status
from_date optional order from the day
to_date optional order arrival date
per_page optional Total number of lines per page
page optional The page index to retrieve

Cancel Order

[Order cancellation API, use in case you no longer want to receive payment for your order]

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/order/cancel"     -d "id"="10" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/order/cancel",
    "method": "POST",
    "data": {
        "id": 10
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['id'] = "10";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/order/cancel", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "id": 45458,
        "user_id": "1000005",
        "mrc_order_id": "mrc_1543306400",
        "txn_id": null,
        "ref_no": null,
        "deposit_id": null,
        "merchant_id": null,
        "total_amount": "100000.00",
        "shipping_fee": "0.00",
        "tax_fee": "0.00",
        "mrc_fee": null,
        "description": "thanh toan don hang 1543306400",
        "url_success": "https:\/\/vnexpress.net\/",
        "url_cancel": null,
        "url_detail": null,
        "stat": "d",
        "payment_version": "4.0",
        "lang": "vi",
        "bpm_id": 0,
        "accept_qrpay": 0,
        "created_at": "2018-11-27 08:13:22",
        "updated_at": "2018-11-27 08:13:22"
    }
}

HTTP Request

POST api/v4/order/cancel

Body Parameters

Parameter Type Status Description
id integer required code orders

Refund API

API to transfer money to other users

Create refund

Refund API for successful transactions

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/refund/create"     -d "txn_id"="R6gl1VtoLYVS1MOP" \
    -d "description"="goOjjr9VucJmpTkg"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/refund/create",
    "method": "POST",
    "data": {
        "txn_id": "R6gl1VtoLYVS1MOP",
        "description": "zhZBNMPtOPYEpiwj",
        "chanel": "BANK",
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['txn_id'] = "R6gl1VtoLYVS1MOP";
$payload['description'] = "zhZBNMPtOPYEpiwj";
$payload['chanel'] = "BANK";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/refund/create", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "transfer": {
            "user_id": 1000005,
            "account_id": 1001000079,
            "amount": "-99000",
            "fee_amount": -1000,
            "description": "Hoàn tiền giao dịch :32365",
            "ref_no": "REF_32365",
            "stat": 4,
            "type": 7,
            "src_des": hoàn tiền đến giao dịch 32365,
            "updated_at": "2018-12-14 04:00:36",
            "created_at": "2018-12-14 04:00:36",
            "id": 32375
        },
        "txn": {
            "user_id": 1015669,
            "account_id": 1001005056,
            "amount": -100000,
            "fee_amount": 0,
            "description": "Hoàn tiền giao dịch :32365",
            "ref_no": "REF_32365",
            "stat": 4,
            "type": 7,
            "src_des": "hoàn tiền đến giao dịch 32365",
            "updated_at": "2018-12-14 04:00:36",
            "created_at": "2018-12-14 04:00:36",
            "id": 32376
        }
    }
}

HTTP Request

POST api/v4/refund/create

Body Parameters

Parameter Type Status Description
txn_id numeric required Transaction BaoKim
description string required Transaction content
chanel string option Refund channel (BANK,BAOKIM)

Transaction API

Transaction APIs

Transaction list

[API retrieves user transaction history information, can be used in transaction control]

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/txn/list" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/txn/list",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();
$options['query']['txn_id'] = 'aZZUXTIwBFCcxocx';
$options['query']['type'] = 'RnPxcSOPiSFBHQV5';
$options['query']['ref_no'] = '6GMpSYK0Sk4iqzUT';
$options['query']['stat'] = '8x9pAxNBCS1Hds8e';
$options['query']['from_date'] = 'tSUlFVXKZYF4mVuL';
$options['query']['to_date'] = '6h3Wr8dxiAUVeYVR';
$options['query']['page'] = '3';
$options['query']['per_page'] = 'BReRLlR56ssBMKTf';

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/txn/list", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 1537,
    "data": {
        "current_page": 4,
        "data": [
            {
                "id": 10313,
                "user_id": 1000005,
                "account_id": 1001000079,
                "opening_balance": "5308590.00",
                "amount": "-10300.00",
                "balance": "5298290.00",
                "opening_freeze_balance": "525306122.96",
                "freeze_amount": "0.00",
                "freeze_balance": "525306122.96",
                "ref_no": "1026288",
                "bank_ref_no": null,
                "type": null,
                "stat": 4,
                "description": null,
                "fee_amount": "0.00",
                "is_processed": 1,
                "src_des": null,
                "created_at": "2016-02-26 10:09:58",
                "updated_at": "-0001-11-30 00:00:00"
            }
        ]
    }
}

HTTP Request

GET api/v4/txn/list

Query Parameters

Parameter Status Description
txn_id optional Trading code
type optional Transaction types 1: deposit, 3: withdrawal, 5: transfer, 7: refund
ref_no optional Reference code
stat optional transaction status
from_date optional deals from date
to_date optional deals to date
page optional The page index to retrieve
per_page optional Number of records per page

Transaction detail

[API retrieves details of a transaction]

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/txn/detail" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/txn/detail",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();
$options['query']['txn_id'] = 'OL8UHosf8ve61CUT';

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/txn/detail", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "id": 27585,
        "user_id": 1000005,
        "account_id": 1001000079,
        "opening_balance": "1111968443.45",
        "amount": "10000.00",
        "balance": "1111978443.45",
        "opening_freeze_balance": "562387181.18",
        "freeze_amount": "0.00",
        "freeze_balance": "562387181.18",
        "ref_no": "1040791",
        "bank_ref_no": "vcb_1543390288",
        "type": null,
        "stat": 4,
        "description": "ut nap tien 1@bk.vn",
        "fee_amount": "0.00",
        "is_processed": 1,
        "src_des": null,
        "created_at": "2018-11-28 07:31:28",
        "updated_at": "2018-11-28 07:31:28"
    }
}

HTTP Request

GET api/v4/txn/detail

Query Parameters

Parameter Status Description
txn_id required Trading code

API transfer

API to transfer money to other users

Create transfer

[API Transfer money from Bao Kim wallet to other users]

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/transfer/create"     -d "to_user"="R6gl1VtoLYVS1MOP" \
    -d "amount"="goOjjr9VucJmpTkg" \
    -d "description"="zhZBNMPtOPYEpiwj" \
    -d "verification_code"="9qxdZBuhibsPlWPw" \
    -d "fee_payer"="y0QNmzjVA6hw05ff" \
    -d "txn_mode"="S6sR7Objqw8tiT6n" \
    -d "order_id"="14" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/transfer/create",
    "method": "POST",
    "data": {
        "to_user": "R6gl1VtoLYVS1MOP",
        "amount": "goOjjr9VucJmpTkg",
        "description": "zhZBNMPtOPYEpiwj",
        "verification_code": "9qxdZBuhibsPlWPw",
        "fee_payer": "y0QNmzjVA6hw05ff",
        "txn_mode": "S6sR7Objqw8tiT6n",
        "order_id": 14
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['to_user'] = "R6gl1VtoLYVS1MOP";
$payload['amount'] = "goOjjr9VucJmpTkg";
$payload['description'] = "zhZBNMPtOPYEpiwj";
$payload['verification_code'] = "9qxdZBuhibsPlWPw";
$payload['fee_payer'] = "y0QNmzjVA6hw05ff";
$payload['txn_mode'] = "S6sR7Objqw8tiT6n";
$payload['order_id'] = "14";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/transfer/create", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "transfer": {
            "from_account_id": 1001000079,
            "to_account_id": 1001005056,
            "amount": "20000",
            "description": "no",
            "fee_from": 0,
            "fee_to": 0,
            "stat": 1,
            "updated_at": "2018-12-14 04:00:36",
            "created_at": "2018-12-14 04:00:36",
            "id": 73
        },
        "txn": {
            "user_id": 1000005,
            "account_id": 1001000079,
            "amount": -20000,
            "fee_amount": 0,
            "fee_display": 0,
            "description": "no",
            "ref_no": 73,
            "stat": 4,
            "updated_at": "2018-12-14 04:00:36",
            "created_at": "2018-12-14 04:00:36",
            "id": 27716
        }
    }
}

HTTP Request

POST api/v4/transfer/create

Body Parameters

Parameter Type Status Description
to_user string required email / phone user beneficiary
amount decimal required Amount transferred
description string required Transaction content
verification_code string optional 2FA authentication code (does not apply to users using API Key)
fee_payer int[1,2] optional Paid optional users, 1: transfer user, 2: receiving user, default: 2
txn_mode int[1,2] optional Optional trading mode, 1: live, 2: secure, default: 1
order_id integer optional optional If the order is remittance payment for the order

VAT API

APIs about Bao Kim's value-added services (topup / card code / game card / ...)

List

[API returns the list of supported value-added services Bao Kim. Merchant uses the parameter idin the itemsreturn in this API to use it in the API to buy services]

Example request:

curl -X GET -G "https://api.baokim.vn/payment/api/v4/vat/list" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/vat/list",
    "method": "GET",
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$response = $client->request("GET", "https://api.baokim.vn/payment/api/v4/vat/list", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 3,
    "data": [
        {
            "info": {
                "id": 1,
                "code": "CARD_MOBILE",
                "description": "Thẻ điện thoại",
                "account_recieve": 1015669,
                "stat": 1,
                "created_at": "2019-02-26 03:17:04",
                "updated_at": "-0001-11-30 00:00:00"
            },
            "items": [
                {
                    "id": 1,
                    "service_id": 1,
                    "param": "VIETTEL",
                    "name": "VIETTEL",
                    "discount": "0.00",
                    "partner": "ecopay",
                    "list_amount": "10,20,50,100,200,500",
                    "stat": 1,
                    "created_at": "2019-02-26 03:11:31",
                    "updated_at": "-0001-11-30 00:00:00"
                },
                {
                    "id": 2,
                    "service_id": 1,
                    "param": "VINAPHONE",
                    "name": "VINAPHONE",
                    "discount": "0.00",
                    "partner": "ecopay",
                    "list_amount": "10,20,50,100,200,500",
                    "stat": 1,
                    "created_at": "2019-02-26 03:10:46",
                    "updated_at": "-0001-11-30 00:00:00"
                }
            ]
        },
        {
            "info": {
                "id": 2,
                "code": "TOPUP_MOBILE",
                "description": "Nạp tiền điện thoại",
                "account_recieve": 1015669,
                "stat": 1,
                "created_at": "2019-02-26 03:17:06",
                "updated_at": "-0001-11-30 00:00:00"
            },
            "items": [
                {
                    "id": 5,
                    "service_id": 2,
                    "param": "VIETTEL",
                    "name": "VIETTEL",
                    "discount": "0.00",
                    "partner": "ecopay",
                    "list_amount": "10,20,50,100,200,500",
                    "stat": 1,
                    "created_at": "2019-02-26 03:10:48",
                    "updated_at": "-0001-11-30 00:00:00"
                },
                {
                    "id": 6,
                    "service_id": 2,
                    "param": "VINAPHONE",
                    "name": "VINAPHONE",
                    "discount": "0.00",
                    "partner": "ecopay",
                    "list_amount": "10,20,50,100,200,500",
                    "stat": 1,
                    "created_at": "2019-02-26 03:10:49",
                    "updated_at": "-0001-11-30 00:00:00"
                }
            ]
        }
    ]
}

HTTP Request

GET api/v4/vat/list

Purchase

[API for merchant to buy value-added services of Bao Kim]

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/vat/purchase"     -d "mrc_order_id"="9UtTJmHs0MH5bRMP" \
    -d "service_item_id"="9" \
    -d "amount"="7" \
    -d "phone"="wSp45aiLLp0FjGZ7" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/vat/purchase",
    "method": "POST",
    "data": {
        "mrc_order_id": "9UtTJmHs0MH5bRMP",
        "service_item_id": 9,
        "amount": 7,
        "phone": "wSp45aiLLp0FjGZ7"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['mrc_order_id'] = "9UtTJmHs0MH5bRMP";
$payload['service_item_id'] = "9";
$payload['amount'] = "7";
$payload['phone'] = "wSp45aiLLp0FjGZ7";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/vat/purchase", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "success": 0,
        "mrc_order_id": "101566938",
        "service_item_id": "2",
        "service": "CARD_MOBILE",
        "param": "VINAPHONE",
        "amount": 10000,
        "pin": "",
        "seri": "",
        "transaction_id": "36719",
        "created_at": "2019-05-13 01:01:41"
    }
}

HTTP Request

POST api/v4/vat/purchase

Body Parameters

Parameter Type Status Description
mrc_order_id string required Ordering Code (Created on Merchant's system, unique)
service_item_id integer optional Service code (taken in API Service list)
amount integer required Scratch card value / recharge value (taken in API Service list)
phone string optional Topup phone number (required if purchasing Topup)

Virtual Account

Create Virtual Account

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/create-virtual-account-payment"     
-d "mrc_uui"="R6gl1VtoLYVS1MOP" \ -d "name"="goOjjr9VucJmpTkg" -d "mrc_id"="goOjjr9VucJmpTkg"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/create-virtual-account-payment",
    "method": "POST",
    "data": {
        "mrc_uui": "R6gl1VtoLYVS1MOP",
        "name": "zhZBNMPtOPYEpiwj",
        "mrc_id": "zhZBNMPtOPYExRaTl",
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['txn_id'] = "R6gl1VtoLYVS1MOP";
$payload['description'] = "zhZBNMPtOPYEpiwj";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/create-virtual-account-payment", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {

            "user_id": 1000005,
            "mrc_id": 10,
            "mrc_uuid": "123456789013",
            "virtual_account": "760017873278",
            "updated_at": "2018-12-14 04:00:36",
            "created_at": "2018-12-14 04:00:36",
            "id": 5
    }
}

HTTP Request

POST api/v4/create-virtual-account-payment

Body Parameters

Parameter Type Status Description
mrc_uui text required User_id
name text required User name
mrc_id text required ID Website integration

Withdraw API

API makes withdrawals from wallets => banks

Create Withdrawal

[API makes withdrawals from Bao Kim wallet to Card / Bank Account]

Example request:

curl -X POST "https://api.baokim.vn/payment/api/v4/withdraw/create"     -d "card_id"="20" \
    -d "bank_account_id"="16" \
    -d "amount"="RgD9JcZg3hwu9Ytu" \
    -d "descripton"="m8038me2GP4j8Yl9" \
    -d "verification_code"="hKYzC9fwC8K3GD0S" 
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api.baokim.vn/payment/api/v4/withdraw/create",
    "method": "POST",
    "data": {
        "card_id": 20,
        "bank_account_id": 16,
        "amount": "RgD9JcZg3hwu9Ytu",
        "descripton": "m8038me2GP4j8Yl9",
        "verification_code": "hKYzC9fwC8K3GD0S"
    },
    "headers": {
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});
//pre-requisites: install Guzzle package https://github.com/guzzle/guzzle
$client = new GuzzleHttp\Client(['timeout' => 20.0]);
$options['query']['jwt'] = BaoKimAPI::getToken();

$payload['card_id'] = "20";
$payload['bank_account_id'] = "16";
$payload['amount'] = "RgD9JcZg3hwu9Ytu";
$payload['descripton'] = "m8038me2GP4j8Yl9";
$payload['verification_code'] = "hKYzC9fwC8K3GD0S";
$options['form_params'] = $payload;

$response = $client->request("POST", "https://api.baokim.vn/payment/api/v4/withdraw/create", $options);
echo "Response status code: " . $response->getStatusCode();
echo "Response data: ". $response->getBody()->getContent();

Example response:

{
    "code": 0,
    "message": [],
    "count": 0,
    "data": {
        "withdrawal": {
            "user_id": 1000005,
            "account_id": 1001000079,
            "card_id": 475,
            "description": "rut tien ve the vcb",
            "stat": 6,
            "amount": "10000",
            "fee_amount": 50000,
            "net_amount": -40000,
            "updated_at": "2018-12-18 05:31:15",
            "created_at": "2018-12-18 05:31:15",
            "id": 454
        },
        "txn": {
            "user_id": 1000005,
            "account_id": 1001000079,
            "amount": -60000,
            "fee_amount": 50000,
            "fee_display": 50000,
            "description": "rut tien ve the vcb",
            "ref_no": 454,
            "stat": 4,
            "updated_at": "2018-12-18 05:31:15",
            "created_at": "2018-12-18 05:31:15",
            "id": 27815
        }
    }
}

HTTP Request

POST api/v4/withdraw/create

Body Parameters

Parameter Type Status Description
card_id integer optional required_without: bank_account_id Receiving Account ID
bank_account_id integer optional required_without:card_id ID Thẻ Nhận tiền
amount decimal required Amount of withdrawal
descripton string required Transaction content
verification_code string optional 2FA authentication code, does not apply to authentication transactions via user API Key