PHP code example of gymers / tonglianpay

1. Go to this page and download the library: Download gymers/tonglianpay 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/ */

    

gymers / tonglianpay example snippets



  
use Gymers\TonglianPay\Requests\Request2085;
use Gymers\TonglianPay\TonglianPay;

$config = [
    'inst_id' => '', // 机构编码
    'public_key_path' => '', // 公钥证书路径
    'private_key_path' => '', // 私钥证书路径
    'private_key_password' => '', // 私钥证书密码
    'random_number' => '', // 24位随机数
    'serial_number' => '', // 通联公钥序列号
    'platform_serial_number' => '', // 平台序列号
    'log_path' => '/logs/tonglian.log', // 日志文件
];

$request = new Request2085();  // Request+接口代码
$request->req_trace_num = '';
$request->purchase_type = '4';
$request->pay_mode = 'K';
$request->bnk_id = 'W';
$request->cur_type = '156';
$request->pay_amount = '';
$request->sep_detail = json_encode([[
    'sep_no' => '',
    'sep_acct_type' => '',
    'sep_merch_code' => '',
    'sep_bank_id' => '',
    'sep_acct_num' => '',
    'sep_pay_amount' => '',
    'product_name' => '',
]]);
$request->order_valid_time = '';
$request->pay_auth_code = '';
$request->mcht_no = '';
$request->prod_import_flag = '0';
$request->order_num = '';
$request->resp_url = '';

$response = TonglianPay::config($config)->request('', $request);



use Gymers\TonglianPay\Requests\OrgDownloadReconFile;
use Gymers\TonglianPay\TonglianPay;

$config = [
    'inst_id' => '', // 机构编码
    'public_key_path' => '', // 公钥证书路径
    'private_key_path' => '', // 私钥证书路径
    'private_key_password' => '', // 私钥证书密码
    'random_number' => '', // 24位随机数
    'serial_number' => '', // 通联公钥序列号
    'platform_serial_number' => '', // 平台序列号
    'log_path' => '/logs/tonglian.log', // 日志文件
];

$request = new OrgDownloadReconFile(); // 文件相关接口对应通联接口方法
$request->trans_date = '';
$request->file_type = '';

$response = TonglianPay::config($config)->request('', $request);
file_put_contents('1.zip', $response);