2017 © Pedro Peláez
 

library omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

image

lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  • Thursday, July 5, 2018
  • by waisir
  • Repository
  • 16 Watchers
  • 208 Stars
  • 34,415 Installations
  • PHP
  • 7 Dependents
  • 3 Suggesters
  • 65 Forks
  • 3 Open issues
  • 41 Versions
  • 14 % Grown

The README.md

Omnipay: WechatPay

WechatPay driver for the Omnipay PHP payment processing library, (*1)

Build Status Latest Stable Version Total Downloads, (*2)

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements WechatPay support for Omnipay., (*3)

Installation

Omnipay is installed via Composer. To install:, (*4)

composer require lokielse/omnipay-wechatpay

Basic Usage

The following gateways are provided by this package:, (*5)

  • WechatPay (Wechat Common Gateway) 微信支付通用网关
  • WechatPay_App (Wechat App Gateway) 微信APP支付网关
  • WechatPay_Native (Wechat Native Gateway) 微信原生扫码支付支付网关
  • WechatPay_Js (Wechat Js API/MP Gateway) 微信网页、公众号、小程序支付网关
  • WechatPay_Pos (Wechat Micro/POS Gateway) 微信刷卡支付网关
  • WechatPay_Mweb (Wechat H5 Gateway) 微信H5支付网关

Usage

Create Order doc

//gateways: WechatPay_App, WechatPay_Native, WechatPay_Js, WechatPay_Pos, WechatPay_Mweb
$gateway    = Omnipay::create('WechatPay_App');
$gateway->setAppId($config['app_id']);
$gateway->setMchId($config['mch_id']);
$gateway->setApiKey($config['api_key']);

$order = [
    'body'              => 'The test order',
    'out_trade_no'      => date('YmdHis').mt_rand(1000, 9999),
    'total_fee'         => 1, //=0.01
    'spbill_create_ip'  => 'ip_address',
    'fee_type'          => 'CNY'
];

/**
 * @var Omnipay\WechatPay\Message\CreateOrderRequest $request
 * @var Omnipay\WechatPay\Message\CreateOrderResponse $response
 */
$request  = $gateway->purchase($order);
$response = $request->send();

//available methods
$response->isSuccessful();
$response->getData(); //For debug
$response->getAppOrderData(); //For WechatPay_App
$response->getJsOrderData(); //For WechatPay_Js
$response->getCodeUrl(); //For Native Trade Type

Notify doc

$gateway    = Omnipay::create('WechatPay');
$gateway->setAppId($config['app_id']);
$gateway->setMchId($config['mch_id']);
$gateway->setApiKey($config['api_key']);

$response = $gateway->completePurchase([
    'request_params' => file_get_contents('php://input')
])->send();

if ($response->isPaid()) {
    //pay success
    var_dump($response->getRequestData());
}else{
    //pay fail
}

Query Order doc

$response = $gateway->query([
    'transaction_id' => '1217752501201407033233368018', //The wechat trade no
])->send();

var_dump($response->isSuccessful());
var_dump($response->getData());

Close Order doc

$response = $gateway->close([
    'out_trade_no' => '201602011315231245', //The merchant trade no
])->send();

var_dump($response->isSuccessful());
var_dump($response->getData());

Refund doc

$gateway->setCertPath($certPath);
$gateway->setKeyPath($keyPath);

$response = $gateway->refund([
    'transaction_id' => '1217752501201407033233368018', //The wechat trade no
    'out_refund_no' => $outRefundNo,
    'total_fee' => 1, //=0.01
    'refund_fee' => 1, //=0.01
])->send();

var_dump($response->isSuccessful());
var_dump($response->getData());

QueryRefund doc

$response = $gateway->queryRefund([
    'refund_id' => '1217752501201407033233368018', //Your site trade no, not union tn.
])->send();

var_dump($response->isSuccessful());
var_dump($response->getData());

Shorten URL (for WechatPay_Native) doc

$response = $gateway->shortenUrl([
    'long_url' => $longUrl
])->send();

var_dump($response->isSuccessful());
var_dump($response->getData());
var_dump($response->getShortUrl());

Query OpenId (for WechatPay_Pos) doc

$response = $gateway->queryOpenId([
    'auth_code' => $authCode
])->send();

var_dump($response->isSuccessful());
var_dump($response->getData());
var_dump($response->getOpenId());

For general usage instructions, please see the main Omnipay repository., (*6)

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found., (*7)

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to., (*8)

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request., (*9)

The Versions

05/07 2018

dev-master

9999999-dev https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/07 2018

dev-analysis-XWm3oJ

dev-analysis-XWm3oJ https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/07 2018

v3.0.8

3.0.8.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/07 2018

dev-develop

dev-develop https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/07 2018

dev-analysis-X0Qonn

dev-analysis-X0Qonn https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/07 2018

v3.0.7

3.0.7.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/07 2018

dev-release/v3.0.7

dev-release/v3.0.7 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/07 2018

dev-release/v3.0.6

dev-release/v3.0.6 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/07 2018

v3.0.6

3.0.6.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

13/06 2018

dev-release/v3.0.5

dev-release/v3.0.5 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

13/06 2018

v3.0.5

3.0.5.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

29/05 2018

v3.0.4

3.0.4.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

21/05 2018

v3.0.3

3.0.3.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

24/04 2018

v3.0-beta.1

3.0.0.0-beta1 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

24/04 2018

dev-feature/v3.0-beta.1

dev-feature/v3.0-beta.1 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

24/04 2018

dev-release/v3.0-beta.1

dev-release/v3.0-beta.1 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

30/03 2018

v3.0-alpha.1

3.0.0.0-alpha1 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

25/01 2018

v1.0.23

1.0.23.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

28/09 2017

v1.0.22

1.0.22.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

30/03 2017

v1.0.21

1.0.21.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

05/02 2017

v1.0.20

1.0.20.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

06/12 2016

v1.0.19

1.0.19.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

02/11 2016

v1.0.18

1.0.18.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

10/10 2016

v1.0.17

1.0.17.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

29/07 2016

v1.0.16

1.0.16.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

13/07 2016

v1.0.15

1.0.15.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

04/07 2016

v1.0.14

1.0.14.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

29/03 2016

v1.0.13

1.0.13.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

09/03 2016

v1.0.12

1.0.12.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

07/03 2016

v1.0.11

1.0.11.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

22/02 2016

v1.0.10

1.0.10.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

04/02 2016

v1.0.9

1.0.9.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

27/01 2016

v1.0.8

1.0.8.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

27/01 2016

v1.0.7

1.0.7.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

27/01 2016

v1.0.6

1.0.6.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

26/01 2016

v1.0.5

1.0.5.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

26/01 2016

v1.0.4

1.0.4.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

26/01 2016

v1.0.3

1.0.3.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

26/01 2016

v1.0.2

1.0.2.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

26/01 2016

v1.0.1

1.0.1.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付

26/01 2016

v1.0.0

1.0.0.0 https://github.com/lokielse/omnipay-wechatpay

Wechat gateway for Omnipay payment processing library

  Sources   Download

MIT

The Requires

 

The Development Requires

php payment pay gateway purchase omnipay app sdk wechat 微信支付