tanjarlan/omnipay-cmbpay

Cmb gateway for Omnipay payment processing library

v1.0.0-beta.2 2021-04-01 03:14 UTC

This package is auto-updated.

Last update: 2024-04-16 08:00:32 UTC


README

CmbPay driver for the Omnipay PHP payment processing library

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

Installation

Omnipay is installed via Composer. To install:

composer require tanjarlan/omnipay-cmbpay

Basic Usage

The following gateways are provided by this package:

  • CmbPay_H5 (Cmb H5 Gateway) 招行支付H5网关
  • Coming soon...

Usage

Create Order doc

//gateways: CmbPay_H5, ...
$gateway    = Omnipay::create('CmbPay_H5');
$gateway->setBranchNo($config['branchNo']);
$gateway->setMerchantNo($config['merchantNo']);
$gateway->setMerchantKey($config['merchantKey']);

$order = [
    'orderNo' => '202104011000000002',
    'amount' => '0.01'
];

$request  = $gateway->purchase($order);
$response = $request->send();

if ($response->isSuccessful()) {
    return $response->redirect();
} else {
    return $response->getMessage();
}

Refund doc

$response = $gateway->refund([
    'orderNo' => '202104011000000002',
    'amount' => '0.01',
    'refundSerialNo' => 'RFD0002'
])->send();

if ($response->isSuccessful()) {
    return 'refund success';
}

return $response->getMessage();