sahilr2050/omnipay-payway 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sahilr2050/omnipay-payway

最新稳定版本:1.1

Composer 安装命令:

composer require sahilr2050/omnipay-payway

包简介

PayWay REST API gateway for Omnipay payment processing library

README 文档

README

WestPac PayWay REST API driver for the Omnipay PHP payment processing library

Latest Stable Version Total Downloads License

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 8.0+. This package implements PayWay REST API support for Omnipay.

This module aims to implement a usable subset of the PayWay REST API (a product of Westpac Bank). The API is extensive, so the initial aim is to implement the following features:

  • Create and maintain customers
  • Create single-use tokens (Credit Card, Bank Account)
  • Take payments using tokenised credit card details (aiding PCI compliance)
  • Schedule regular payments

These initial features have now been implemented.

See the official PayWay documentation for full details.

Installation

Install the module using composer.

composer require sahilr2050/omnipay-payway

Usage

Take Payment

To take a one-time credit card payment.

<?php

include 'vendor/autoload.php';

use Exception;
use Omnipay\Common\CreditCard;
use Omnipay\Omnipay;

$gateway = Omnipay::create('PaywayRest_DirectDebit');

$gateway->setApiKeyPublic('REPLACE');
$gateway->setApiKeySecret('REPLACE');
$gateway->setMerchantId('REPLACE');
$gateway->setTestMode(true);

try {
    $response = $gateway->createSingleUseCardToken([
        'card' => new CreditCard([
            'firstName' => 'First Name',
            'lastName' => 'Last Name',
            'number' => '4564710000000004',
            'expiryMonth' => '02',
            'expiryYear' => '2019',
            'cvv' => '847',
        ]),
    ])->send();

    $singleUseTokenId = $response->getData('singleUseTokenId');

    if (empty($singleUseTokenId)) {
        // handle error
    }

    $request = $gateway->purchase([
        'singleUseTokenId' => $singleUseTokenId,
        'customerNumber' => 'AB1245',
        'principalAmount' => '10.00',
        'currency' => 'AUD',
        'orderNumber' => 12,
    ]);

    $response = $request->send();

    if ($response->isSuccessful()) {
        // update order
    }
} catch (Exception $e) {
    // handle error
}

// Example for creating single-use token with Bank Account
$response = $gateway->createSingleUseBankToken([
    'bankAccountBsb' => '999999',
    'bankAccountNumber' => '999999999',
    'bankAccountName' => 'Your Name',
])->send();

$singleUseTokenId = $response->getData('singleUseTokenId');

Known Issue

[curl] 60: SSL certificate problem: unable to get local issuer certificate.

Solution

Download CA certificate and place somewhere in your project root.

eg. project/certificate/cacert.pem

In the gateway initialization object do like below.

$gateway = Omnipay::create('PaywayRest_DirectDebit');

$gateway->setApiKeyPublic('REPLACE');
$gateway->setApiKeySecret('REPLACE');
$gateway->setMerchantId('REPLACE');
$gateway->setTestMode(true);

$gateway->setSSLCertificatePath('path/cacert.pem');

Contributing

Contributions are welcome and will be fully credited.

Contributions can be made via a pull request on Github.

Support

If you are having general issues with the package, feel free to report it to us.

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.

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-19