PHP code example of jetfueltw / syfpay-php

1. Go to this page and download the library: Download jetfueltw/syfpay-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 / syfpay-php example snippets


composer 

$payment = new DigitalPayment(merchantId, secretKey, merchantPrivateKey, merchantPayPublicKey);
$result = $payment->order($tradeNo, $channel, $amount, $clientIp, $notifyUrl, $returnUrl);

$tradeQuery = new TradeQuery($merchantId, $secretKey, merchantPrivateKey, merchantPayPublicKey);
$result = $tradeQuery->find($tradeNo, $channel, $amount, $payDate);

Result:
[
    'merNo' => 'XXXXXXXXXXXXXXX', // 商家號
    'msg' => 'XXXX'; // 狀態描述
    'stateCode' => 'XX', // 00表示成功
    'orderNum' =>'20180109023351XXXXX', // 商家產生的唯一訂單號
    'payStateCode' => 'XX', // 支付狀態 00:支付成功 01:支付失敗 03:簽名錯誤 04:其他錯誤 05:未知 06:初始 50:網絡異常 99:未支付
    'sign' => '1C1E6B6DCD8DC9F70565AFXXXXXXXXXX', // 簽名(字母大寫)
]

$tradeQuery = new TradeQuery($merchantId, $secretKey, merchantPrivateKey, merchantPayPublicKey);
$result = $tradeQuery->isPaid($tradeNo, $channel, $amount, $payDate);