1. Go to this page and download the library: Download apility/nets-easy 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/ */
apility / nets-easy example snippets
use Nets\Easy;
use Nets\Easy\Payment;
Easy::setup([
'secret_key' => '00000000000000000000000000000000',
'checkout_key' => '00000000000000000000000000000000',
'merchant_id' => '000000000'
]);
$payment = Payment::create([
'checkout' => [
'url' => 'https://domain.tld/checkout', // The exact URL where your checkout is hosted (except query parameters and fragments)
'termsUrl' => 'https://domain.tld/terms', // Your terms
],
'order' => [
'currency' => 'NOK',
'reference' => '1', // A unique reference for this specific order
'amount' => 10000, // Total order amount in cents
'items' => [
[
'reference' => '1', // A unique reference for this specific item
'name' => 'Test',
'quantity' => 1,
'unit' => 'pcs',
'unitPrice' => 8000, // Price per unit except tax in cents
'taxRate' => 25000 // Taxrate (e.g 25.0 in this case),
'taxAmount' => 2000 // The total tax amount for this item in cents,
'grossTotalAmount' => 10000 // Total for this item with tax in cents,
'netTotalAmount' => 8000 // Total for this item without tax in cents
]
]
]
]);
use Nets\Easy;
use Nets\Easy\Payment;
Easy::setCredentials(...);
$payment = isset($_GET['paymentId']
? Payment::retrieve($_GET['paymentId'])
: Payment::create(...);
$form = $payment->form([
'redirect' => 'https://domain.tld/checkout/complete', // URL to redirect to on payment completion (paymentId query parameter is appended)
'theme' => [ // Optional
'textColor' => 'blue',
'linkColor' => '#bada55',
'buttonRadius' => '50px'
]
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.