PHP code example of taiwan-pay / chb-payment

1. Go to this page and download the library: Download taiwan-pay/chb-payment library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

taiwan-pay / chb-payment example snippets


use TaiwanPay\CHBPayment;

$payment = new CHBPayment([
    'macKey' => $macKey,
    'key' => $key,
    'merID' => $merID,
    'MerchantID' => $MerchantID,
    'TerminalID' => $TerminalID,
    'MerchantName' => $MerchantName
], false);

// get auth data and render form by yourself
$payment->auth($orderNumber, $amount, $type, $resUrl, $createTime, false);

// get auth form and render it
$payment->auth($orderNumber, $amount, $type, $resUrl, $createTime, true);

// get search data and render form by yourself
$payment->search($orderNumber, $amount, $resUrl, false);

// get search form and render it
$payment->search($orderNumber, $amount, $resUrl, true);