夜鹰/omnipay-epay

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

dev-master / 1.2.x-dev 2020-09-02 10:02 UTC

This package is auto-updated.

Last update: 2024-09-29 05:55:54 UTC


README

ePay.bg 驱动程序,用于 Omnipay PHP 支付处理库

Omnipay 是一个与框架无关的多网关支付处理库,适用于 PHP 5.3+。此包实现了对 Omnipay 的 Epay、EasyPay、Bpay 等更多保加利亚在线支付提供商的支持。

安装

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 文档