The MONEI API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
This library is intended to help you develop an integration around our API, by using the MONEI PHP Client and it's methods.
You can find the complete information and details in our documentation portal.
PHP 7.2 and later
To install the bindings via Composer, run the following command:
composer require monei/monei-php-sdk
Or add the following to composer.json
:
{
"require": {
"monei/monei-php-sdk": "^1.2.0"
}
}
Then run composer install
Download the files and include autoload.php
:
require_once('/path/to/MONEI PHP SDK/vendor/autoload.php');
To run the unit tests:
composer install
./vendor/bin/phpunit
The MONEI API uses API key to authenticate requests. You can view and manage your API key in the MONEI Dashboard.
For more information about this process, please refer to our documentation portal.
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Instantiate the client using the API key
$monei = new Monei\MoneiClient('YOUR_API_KEY');
try {
$result = $monei->payments->create([
'amount' => 1250, // 12.50€
'orderId' => '100100000001',
'currency' => 'EUR',
'description' => 'Items decription',
'customer' => [
'email' => '[email protected]',
'name' => 'John Doe'
]
]);
print_r($result);
} catch (Exception $e) {
echo 'Error while creating payment: ', $e->getMessage(), PHP_EOL;
}
?>
For more detailed information about this library and the full list of methods, please refer to our documentation portal.