fruitcake / omnipay-magnius
Magnius Gateway
Requires
- omnipay/common: ^3
Requires (Dev)
- omnipay/tests: ^3
- phpro/grumphp: ^0.14
- squizlabs/php_codesniffer: ^3
This package is auto-updated.
Last update: 2024-11-05 18:46:54 UTC
README
Magnius gateway for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 7.1+. This package implements Magnius support for Omnipay.
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
Install
Via Composer
$ composer require league/omnipay fruitcake/omnipay-magnius
Usage
The following gateways are provided by this package:
- Magnius
The following paymentMethods are implemented:
- ideal
- paypal
- sepa (requires Customer)
Customers
You can create a Customer using the CreateCustomerRequest
.
The Response contains a customerReference
you can use in your requests.
$response = $gateway->createCustomer([ 'card' => [ 'email' => 'barry@fruitcake.nl', 'country' => 'NL', 'city' => 'Eindhoven', 'address1' => 'My Street', 'phone' => '123', 'company' => 'Fruitcake', ] ])->send(); $customerId = $response->getCustomerId();
Example
$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(); } }
For general usage instructions, please see the main Omnipay repository.
Support
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you want to keep up to date with release announcements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email barry@fruitcake.nl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.