1. Go to this page and download the library: Download mlocati/nexi-xpay 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/ */
mlocati / nexi-xpay example snippets
use MLocati\Nexi\XPay\Configuration;
// For test environment
$configuration = new Configuration\FromArray([
'alias' => 'YOUR ALIAS FOR TEST',
'macKey' => 'YOUR MAC KEY FOR TEST',
'environment' => 'test',
]);
// For production environment
$configuration = new Configuration\FromArray([
'alias' => 'YOUR ALIAS FOR PRODUCTION',
'macKey' => 'YOUR MAC KEY FOR PRODUCTION',
]);
use MLocati\Nexi\XPay\Client;
$client = new Client($configuration);
use MLocati\Nexi\XPay\Client;
$myHttpClient = new My\Custom\HttpClient();
$client = new Client($configuration, $myHttpClient);
use MLocati\Nexi\XPay\Dictionary\Currency;
use MLocati\Nexi\XPay\Dictionary\Language;
use MLocati\Nexi\XPay\Entity\SimplePay\Request;
$language = Language::ID_ENG;
$currency = Currency::ID_EUR;
$amount = 123.45;
$internalOrderID = 'internal-order-id';
$request = new Request();
$request
->setLanguageId($language)
->setImportoAsDecimal($amount)
->setDivisa($currency)
->setCodTrans($internalOrderID)
->setUrl('http://your.website/callback')
->setUrl_back('http://your.website/payment-canceled')
;
// Store somewhere your $internalOrderID, for example with $_SESSION['order-id'] = $internalOrderID
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.