PHP code example of fruitcake / omnipay-magnius
1. Go to this page and download the library: Download fruitcake/omnipay-magnius library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fruitcake / omnipay-magnius example snippets
$response = $gateway->createCustomer([
'card' => [
'email' => '[email protected] ',
'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 ) . ': ' . $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();
}
}