PHP code example of ansuns / pay
1. Go to this page and download the library: Download ansuns/pay 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/ */
ansuns / pay example snippets
use Ansuns\Pay\Pay;
$payConfig = [
'org_id' => '', // 机构号
'public_key' => '', // 代理商公钥
'private_key' => '', // 代理商私钥
'merc_id' => '', // 商户号
];
$pay = new Pay(['chinaebi' => $payConfig]);
$opition['trancde'] = 'P05';
$opition['title'] = '测试支付';
$opition['notify_url'] = "https://www.xxx.com/pay_notify_url"; // 回调地址
$opition['pay_amount'] = 100;
$opition['mer_order_no'] = time();
$pay = new Pay(['chinaebi' => $payConfig]);
$res = $pay->driver('chinaebi')->gateway('pos')->apply($opition);