sudiptpa / omnipay-esewa

Omnipay支付处理库的eSewa API驱动程序。

v1.0.1 2020-07-14 11:43 UTC

This package is auto-updated.

Last update: 2024-09-04 12:18:03 UTC


README

Omnipay PHP支付处理库的eSewa驱动程序

Omnipay 是一个不依赖于框架、多网关的PHP支付处理库。此包实现了Omnipay的eSewa支持。

StyleCI Latest Stable Version Total Downloads GitHub license

安装

Omnipay通过Composer安装。要安装,只需使用Composer要求league/omnipaysudiptpa/omnipay-esewa

composer require league/omnipay sudiptpa/omnipay-esewa

基本用法

购买

    use Omnipay\Omnipay;
    use Exception;

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

    $gateway->setMerchantCode('epay_payment');
    $gateway->setTestMode(true);

    try {
        $response = $gateway->purchase([
            'amount' => 100,
            'deliveryCharge' => 0,
            'serviceCharge' => 0,
            'taxAmount' => 0,
            'totalAmount' => 100,
            'productCode' => 'ABAC2098',
            'returnUrl' => 'https://merchant.com/payment/1/complete',
            'failedUrl' => 'https://merchant.com/payment/1/failed',
        ])->send();

        if ($response->isRedirect()) {
            $response->redirect();
        }
    } catch (Exception $e) {
        return $e->getMessage();
    }

付款成功并重定向回商家网站后,您现在需要通过另一个API请求验证付款。

验证付款

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

    $gateway->setMerchantCode('epay_payment');
    $gateway->setTestMode(true);

    $response = $gateway->verifyPayment([
        'amount' => 100,
        'referenceNumber' => 'GDFG89',
        'productCode' => 'gadfg-gadf',
    ])->send();

    if ($response->isSuccessful()) {
        // Success
    }

    // Failed

Laravel集成

请遵循eSewa在线支付网关集成并按照步骤指南进行。

官方文档

请遵循官方文档以了解参数及其描述。

贡献

贡献是 欢迎 的,并将完全 认可

贡献可以通过Github上的拉取请求进行。

支持

如果您在使用Omnipay Esewa时遇到一般性问题,请发送电子邮件到sudiptpa@gmail.com以获得快速支持。

如果您认为您找到了一个错误,请使用GitHub问题跟踪器报告它,或者更好的是,分支库并提交一个拉取请求。

许可证

此软件包是开源软件,根据MIT许可证授权。