PHP code example of onex / allinpay

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

    

onex / allinpay example snippets


// 普通调用
$merchantRequest = new Onex\Allinpay\Requests\MerchantRequest();
$merchantRequest->setSysid(null);
$merchantService = new \Onex\Allinpay\Port\MerchantService($allinpay, $merchantRequest);
$respone = $merchantService->queryReserveFundBalance()
var_dump($respone);
/* 
return array(5) {
  ["status"]=>
  string(7) "success"
  ["status_code"]=>
  int(200)
  ["error"]=>
  int(0)
  ["code"]=>
  int(0)
  ["data"]=>
  array(4) {
    ["sysid"]=>
    string(19) "1902271423530473681"
    ["sign"]=>
    string(172) "CB6v9E9tkgb30gRuCTBYatEh/9o0KT63DZyUSz+0wugViLTNY5Apu9Q8ocBnYNafRX9mRXloqGoaFhEu4gdfZu761FMHPZghOZZsJmKsTx8abx5DEv4gPGpYLcPb0taALuGBOz+f8h6Nhyhjaycct209sFX+lhTx+pla2Ek8Uvw="
    ["signedValue"]=>
    string(102) "{"balance":0,"account_name":"yuntest20181121-退款户","account_no":"200604000005721000","def_clr":0}"
    ["status"]=>
    string(2) "OK"
  }
}
*/

// 普通调用
app('allinpay.merchant.request')->setSysid(null);
$respone = app('allinpay')->merchant()->queryReserveFundBalance()
var_dump($respone);
/* 
return array(5) {
  ["status"]=>
  string(7) "success"
  ["status_code"]=>
  int(200)
  ["error"]=>
  int(0)
  ["code"]=>
  int(0)
  ["data"]=>
  array(4) {
    ["sysid"]=>
    string(19) "1902271423530473681"
    ["sign"]=>
    string(172) "CB6v9E9tkgb30gRuCTBYatEh/9o0KT63DZyUSz+0wugViLTNY5Apu9Q8ocBnYNafRX9mRXloqGoaFhEu4gdfZu761FMHPZghOZZsJmKsTx8abx5DEv4gPGpYLcPb0taALuGBOz+f8h6Nhyhjaycct209sFX+lhTx+pla2Ek8Uvw="
    ["signedValue"]=>
    string(102) "{"balance":0,"account_name":"yuntest20181121-退款户","account_no":"200604000005721000","def_clr":0}"
    ["status"]=>
    string(2) "OK"
  }
}
*/

"php": ">=7.1",
"monolog/monolog": "^1.23"