PHP code example of vb-payment / esunacq-creditcard

1. Go to this page and download the library: Download vb-payment/esunacq-creditcard 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 / esunacq-creditcard example snippets




    use VeryBuy\Payment\EsunBank\Acq\Request\RequestBuilder;

    $builder = new RequestBuilder($MAC, [
        'ONO' => 'TEST1234567890',      //  訂單編號
        'TA' => 1200,                   //  金額
        'MID' => '',                    //  特店代碼
        'TID' => 'EC000001',            //  刷卡代碼
        'U' => 'path/to/response',      //  回傳 URL
    ]);

    if (! $builder->validate()->hasErrors()) {
        // $formFields 組成 html form 後送出即可
        $formFields = $builder->getFormFields();
    } else {
        $errors = builder->getErrors(); // return array
    }



    use VeryBuy\Payment\EsunBank\Acq\Response\ResponseBuilder;

    $builder = new ResponseBuilder($MAC, [
        'MID' => '',
    ], $_REQUEST);

    if (! $builder->isSuccess()) {
        $builder->getError();
    }