gentor/omnipay-epay

Epay Bg网关用于Omnipay支付处理库

dev-master / 1.2.x-dev 2018-06-01 12:32 UTC

This package is auto-updated.

Last update: 2024-09-09 03:34:21 UTC


README

ePay.bg为Omnipay PHP支付处理库提供的驱动程序

Omnipay是一个与框架无关、多网关的PHP 5.3+支付处理库。本包实现了Epay, EasyPay, Bpay以及其他Bugarian在线支付服务商对Omnipay的支持。

安装

Omnipay通过Composer安装。要安装,只需运行

composer require gentor/omnipay-epay

此包提供的以下网关

有关一般使用说明,请参阅主Omnipay仓库。

基本使用

购买

use Omnipay\Omnipay;

$provider = Epay; # Or Easypay
$gateway = Omnipay::create($provider);
$gateway->setMin('Epay Merchant Id');
$gateway->setSignature('Epay Signature');

$response = $gateway->purchase(
    [
        'amount' => '10.00', // BGN
        'transactionId' => 'Unique ID in your system',
        'returnUrl' => 'your.site.com/return',
        'cancelUrl' => 'your.site.com/cancel',
    ]
)->send();

if ($response->isSuccessful()) {
    // only EasyPay get IDN
    echo($response->getRedirectData());
} elseif ($response->isRedirect()) {
    // redirect to epay payment gateway
    $response->redirect();
} else {
    // payment failed: display message to customer
    echo $response->getMessage();
}

Webhook

  • 支付状态监听器
//Use only epay gateway
$gateway = Omnipay::create('Epay');
$gateway->setMin('Epay Merchant Id');
$gateway->setSignature('Epay Signature');

$response = $gateway->acceptNotification()->send();

if ($response->isSuccessful()) {
    $status = $response->getTransactionStatus();
    // Response is required for epay gateway to stop sending data
    echo $response->getData()['notify_text'];
} else {
    // Response is required for epay gateway to stop sending data
    echo $response->getData()['notify_text'];
}

ePay.bg文档