PHP code example of vb-payment / esunbank-vaccount

1. Go to this page and download the library: Download vb-payment/esunbank-vaccount 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/ */

    

vb-payment / esunbank-vaccount example snippets




    use VeryBuy\Payment\EsunBank\VirtualAccount\VerifyType;
    use VeryBuy\Payment\EsunBank\VirtualAccount\VirtualAccountBuilder;

    $companyId = 99123; // 特店代號

    $builder = new VirtualAccountBuilder($companyId, [
        'type' => VerifyType::NONE_BASE,    // builder 類別
        'length' => 14,                     // 虛擬帳號長度
        'number' => '393988912',            // (14碼)自訂碼 length:9 ; (13碼)自訂碼 length:8
    ]);

    $vaccount = $builder->make();


    use VeryBuy\Payment\EsunBank\VirtualAccount\Response\ResponseVerifier;

    $verifier = new ResponseVerifier({response encrypted string});

    $verifier->getTradedAt();       // 交易時間
    $verifier->getPaidAt();         // 付款時間
    $verifier->getVirtualAccount(); // 取得被付款虛擬帳號
    $verifier->getAmount();         // 付款金額