PHP code example of jetfueltw / verypay-php
1. Go to this page and download the library: Download jetfueltw/verypay-php 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/ */
jetfueltw / verypay-php example snippets
composer
$payment = new DigitalPayment($merchantId, $secretKey, $merchantPrivateKey, $gatewayPublicKey);
$result = $payment->order($tradeNo, $channel, $amount, $notifyUrl, $returnUrl);
Post Data:
[
'merNo' => 'XXXXXXXXXXXXXXX', // 商家號
'netway' => 'XXXXX', // 支付通道
'orderNum' => '20180109023351XXXXX', // 商家產生的唯一訂單號
'amount' => 100, //消費金額 (分)
'goodsName' => 'XXXXXX', //商品名稱
'payResult' => 'XX', // 支付狀態,00 表示成功
'payDate' => , // 支付時間,格式:yyyyMMddHHmmss
'sign' => '1C1E6B6DCD8DC9F70565AFXXXXXXXXXX', // 簽名(字母大寫)
]
$tradeQuery = new TradeQuery($merchantId, $secretKey, $merchantPrivateKey, $gatewayPublicKey);
$result = $tradeQuery->find($tradeNo, $channel, $amount, $payDate);
Result:
[
'merNo' => 'XXXXXXXXXXXXXXX', // 商家號
'msg' => '查询成功'; // 狀態描述
'stateCode' => 'XX', // 00 表示成功
'orderNum' =>'20180109023351XXXXX', // 商家產生的唯一訂單號
'payStateCode' => 'XX', // 支付狀態 00 支付成功、01 支付失敗、03 簽名錯誤、04 其他錯誤、05 未知、06 初始、50 網絡異常、99 未支付
'sign' => '1C1E6B6DCD8DC9F70565AFXXXXXXXXXX', // 簽名(字母大寫)
]
$tradeQuery = new TradeQuery($merchantId, $secretKey, $merchantPrivateKey, $gatewayPublicKey);
$result = $tradeQuery->isPaid($tradeNo, $channel, $amount, $payDate);