PHP code example of hinet / omnipay-shenzhoufu

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

    

hinet / omnipay-shenzhoufu example snippets


composer 

$gateway = Omnipay::create('Shenzhoufu');
$gateway->setPartnerId(config('payment.shenzhoufu.partner'));
$gateway->setApiKey(config('payment.shenzhoufu.apikey'));
$gateway->setNotifyUrl(config('payment.shenzhoufu.notifyUrl'));
$order = [
     'orderId'      => '201612141621487926',
     'amount'         => 1*100, //=0.01
];
$request  = $gateway->purchase($order);
$response = $request->send();
if($response->isSuccessful()){
     echo '<img src="'.$response->getQrcode().'">';
}else{
     $response->getMessage();
}

$gateway = Omnipay::create('Shenzhoufu');
$options = [
        'request_params'=> $_REQUEST,
];
$response = $gateway->completePurchase($options)->send();
if ($response->isSuccessful() && $response->getTransactionReference()) {
    //支付成功后操作
    exit($response->getOrderID());
} else {
    //支付失败通知.
    exit('支付失败');
}