PHP code example of crny / swiftpass-pay

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

    

crny / swiftpass-pay example snippets


use SwiftPass\Pay\RawWebPay;
$data = [
    'mch_id' => '7551000001',
    'mchKey' => '9d101c97133837e13dde2d32a5054abb',
    'out_trade_no' => '1234567asd',
    'body' => 'test',
    'total_fee' => 1,
    'mch_create_ip' => '192.168.0.1',
    'notify_url' => 'http://www.baidu.com'
];

$obj = new RawWebPay(true);
$res = $obj->Pay($data);
var_dump($res); //预支付订单数据