Omnipay: Magnius
Magnius gateway for the Omnipay PHP payment processing library, (*1)
, (*2)
Omnipay is a framework agnostic, multi-gateway payment
processing library for PHP 7.1+. This package implements Magnius support for Omnipay., (*3)
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., (*4)
Install
Via Composer, (*5)
``` bash
$ composer require league/omnipay fruitcake/omnipay-magnius, (*6)
## 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.
```php
$response = $gateway->createCustomer([
'card' => [
'email' => 'barry@fruitcake.nl',
'country' => 'NL',
'city' => 'Eindhoven',
'address1' => 'My Street',
'phone' => '123',
'company' => 'Fruitcake',
]
])->send();
$customerId = $response->getCustomerId();
```
## Example
```php
$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., (*7)
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., (*8)
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., (*9)
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., (*10)
Change log
Please see CHANGELOG for more information what has changed recently., (*11)
Testing
bash
$ composer test, (*12)
Contributing
Please see CONTRIBUTING for details., (*13)
Security
If you discover any security related issues, please email barry@fruitcake.nl instead of using the issue tracker., (*14)
Credits
License
The MIT License (MIT). Please see License File for more information., (*15)