Paysera网关用于Omnipay支付处理库

v1.0.0 2024-04-30 13:47 UTC

This package is auto-updated.

Last update: 2024-09-30 14:53:02 UTC


README

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

Packagist Version Software License

安装

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

composer require league/omnipay karan-darji/omnipay-paysera

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

需求

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

基本用法

本包提供以下网关

  • Paysera

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

代码示例

use Omnipay\Omnipay;

// Setup payment gateway
$gateway = Omnipay::create('Paysersa');
$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' => 10,
        '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('Paysersa');
$gateway->setProjectId('123456');
$gateway->setPassword('abcde12345');

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

    return true;
}

变更日志

请参阅CHANGELOG以获取最近更改的更多信息。

贡献

请参阅CONTRIBUTING以获取详细信息。

许可

MIT许可(MIT)。请参阅许可文件以获取更多信息。