arbory/omnipay-paysera

Omnipay支付处理库的Paysera网关

v1.1.0 2020-11-13 09:26 UTC

This package is auto-updated.

Last update: 2024-09-13 18:16:08 UTC


README

Omnipay PHP支付处理库的Paysera网关驱动程序

Build Status Coverage Status

安装

Omnipay通过Composer安装。要安装,请使用Composer要求league/omnipayarbory/omnipay-paysera

composer require league/omnipay arbory/omnipay-paysera

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

要求

  • PHP 7.0+
  • Omnipay v3+
  • ext-openssl

基本用法

此软件包提供以下网关

  • Paysera

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

代码示例

use Omnipay\Omnipay;

// Setup payment gateway
$gateway = Omnipay::create('Paysera');
$gateway->setProjectId('123456');
$gateway->setPassword('abcde12345');

// Optionally to determine which order has been paid
$orderId = 1;

// Example card (actually customer) data
$card = [
    'email' => 'john.doe@example.com',
    'billingFirstName' => 'John',
    'billingLastName' => 'Doe',
    'billingPhone' => '+372 12345678',
    'billingCompany' => 'Good Workers Ltd.',
    'billingAddress1' => 'Viru valjak 24',
    'billingCity' => 'Tallinn',
    'billingPostcode' => '123456',
    'billingCountry' => 'EE',
];

// Send purchase request
$response = $gateway->purchase(
    [
        'language' => 'ENG',
        'transactionId' => $orderId,
        'paymentMethod' => 'hanzaee',
        'amount' => '10.00',
        'currency' => 'EUR',
        'returnUrl' => "https://example.com/paysera/return/{$orderId}",
        'cancelUrl' => "https://example.com/paysera/cancel/{$orderId}",
        'notifyUrl' => "https://example.com/paysera/notify/{$orderId}",
        'card' => $card,
    ]
)->send();

if ($response->isRedirect()) {
    return $response->redirect();
}

还应实现notifyUrl的方法。在成功扣费后,Paysera会向此URL发送请求。

use Omnipay\Omnipay;

// Setup payment gateway
$gateway = Omnipay::create('Paysera');
$gateway->setProjectId('123456');
$gateway->setPassword('abcde12345');

// Accept the notification
$response = $gateway->completePurchase()
    ->send();
    
if ($response->isSuccessful()) {
    // Mark the order as paid

    return true;
}

变更日志

有关最近更改的更多信息,请参阅CHANGELOG

贡献

有关详细信息,请参阅CONTRIBUTING

鸣谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件