Download the PHP package sbgo/icbc-all-in-one-pay without Composer

On this page you can find all versions of the php package sbgo/icbc-all-in-one-pay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package icbc-all-in-one-pay

工商银行支付API Sdk封装

本类库为开发对接工行扫码付,根据工行原商户文档sdkDemo及自己修改之后的类库,原文档地址

原demo无命名空间支持,且不符合个人使用习惯,本类库对原代码进行修改符合个人使用习惯和composer支持,如遇到使用困难或无法使用可参考下载官方demo

调用二维码被扫支付的大致代码如下:

<?php

require __DIR__ . '/vendor/autoload.php';
use icbc\IcbcConstants;
$appId = '100000000000011000000';
$privateKeyPath = "private.pem";

if(file_exists($privateKeyPath)) {
    $privateKey = file_get_contents($privateKeyPath);
}else{
    echo "读取私钥失败";
    die;
}
//请注意网关公钥需符合公钥格式
$icbcPublicKeyPath = 'API_GATEWAY_REAL.pub';

if(file_exists($icbcPublicKeyPath)) {
    $icbcPublicKey = file_get_contents($icbcPublicKeyPath);
}else{
    echo "读取网关公钥失败";
    die;
}
//以下构造函数第1个参数为appid,第2个参数为RSA密钥对中私钥,第6个参数为API平台网关公钥
$icbcClient = new \icbc\DefaultIcbcClient($appId, $privateKey, IcbcConstants::$SIGN_TYPE_RSA2, IcbcConstants::$CHARSET_UTF8, IcbcConstants::$FORMAT_JSON, $icbcPublicKey, '', '', '', '');
$request = array(
    "serviceUrl" => 'https://gw.open.icbc.com.cn/api/mybank/pay/qrcode/scanned/pay/V2',
    "method" => 'POST',
    "isNeedEncrypt" => false,
    "biz_content" => array(
        "qr_code" => "125001231467799129",
        "mer_id" => "230851010088",
        "out_trade_no" => "X000000009",
        "order_amt" => "1",
        "attach" => "商户附加消息",
        "trade_date" => "20200918",
        "trade_time" => "113535"
    )
);

try {
    //执行调用;msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一
    $resp = $icbcClient->execute($request, 'msgId1', '');
} catch (Exception $e) {
    var_dump($e);die;
}
$respObj = json_decode($resp, true);
if ($respObj["return_code"] == 0) {
    echo $respObj["return_msg"];
} else {
    echo $respObj["return_msg"];
}

All versions of icbc-all-in-one-pay with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
ext-curl Version *
lib-openssl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sbgo/icbc-all-in-one-pay contains the following files

Loading the files please wait ....