fruitcake/omnipay-magnius

v0.1.2 2018-08-23 12:52 UTC

This package is auto-updated.

Last update: 2024-09-05 18:23:22 UTC


README

Magnius网关是用于Omnipay PHP支付处理库的网关

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

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

此处应放置您的描述。尽量限制在一两段话内,并提及您支持的PSRs,以避免用户和贡献者之间的任何混淆。

安装

通过Composer

$ composer require league/omnipay fruitcake/omnipay-magnius

用法

此包提供以下网关

  • Magnius

以下支付方式已实现

  • ideal
  • paypal
  • sepa (需要客户)

客户

您可以使用 CreateCustomerRequest 创建客户。响应包含一个您可以在请求中使用的 customerReference

$response = $gateway->createCustomer([
   'card' => [
       'email' => 'barry@fruitcake.nl',
       'country' => 'NL',
       'city' => 'Eindhoven',
       'address1' => 'My Street',
       'phone' => '123',
       'company' => 'Fruitcake',
   ]

])->send();

$customerId = $response->getCustomerId();

示例

 $gateway = \Omnipay\Omnipay::create('Magnius');
    $gateway->initialize(array(
        'accountId' => '',
        'apiKey' => '',
        'testMode' => true,
        'organisationId' => null,
    ));

    // Start the purchase
    if(!isset($_GET['transaction_id'])){
        $url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
        $response = $gateway->purchase(array(
            'amount' => "6.84",
            'description' => "Testorder #1234",
            'issuer' => 'ABNANL2A',                  // Get the id from the issuers list
            'paymentMethod' => 'ideal',             // For 'ideal', the Issuer is required
            'transactionId' => 1234,
            'customerId' => $customerId,            // If you have a customerId
            'returnUrl' => $url,
            'notifyUrl' => $url,
        ))->send();

        if ($response->isRedirect()) {
            // redirect to offsite payment gateway
            $response->redirect();
        } elseif ($response->isPending()) {
            // Process started (for example, 'overboeking')
            return "Pending, Reference: ". $response->getTransactionReference();
        } else {
            // payment failed: display message to customer
            return "Error " .$response->getCode() . ': ' . $response->getMessage() . 
            ' Details: '. print_r($response->getDetails(), true);
        }
    }else{
        // Check the status
        $response = $gateway->completePurchase()->send();
        if($response->isSuccessful()){
            $reference = $response->getTransactionReference();  // TODO; Check the reference/id with your database
            return "Transaction '" . $response->getTransactionId() . "' succeeded!";
        }else{
            return "Error " .$response->getCode() . ': ' . $response->getMessage();
        }
    }

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

支持

如果您遇到Omnipay的一般问题,我们建议在 Stack Overflow 上发表帖子。请确保添加 omnipay 标签,以便更容易找到。

如果您想了解发布通告、讨论项目的想法或提出更详细的问题,还可以订阅 邮件列表

如果您认为发现了错误,请使用 GitHub问题跟踪器 报告它,或者最好是分叉库并提交一个pull请求。

变更日志

请参阅 CHANGELOG 了解最近更改的详细信息。

测试

$ composer test

贡献

请参阅 CONTRIBUTING 了解详细信息。

安全

如果您发现任何与安全相关的问题,请通过电子邮件 barry@fruitcake.nl 而不是使用问题跟踪器来报告。

鸣谢

许可证

MIT许可证(MIT)。请参阅 许可证文件 了解更多信息。