Skip to content

MONEI/monei-php-sdk

Repository files navigation

MONEI PHP SDK

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.

Docs in our portal

You can find the complete information and details in our documentation portal.

Requirements

PHP 7.2 and later

Installation & Usage

Composer

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

Manual Installation

Download the files and include autoload.php:

require_once('/path/to/MONEI PHP SDK/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Authorization

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.

Getting Started

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;
}

?>

Documentation for API Endpoints

For more detailed information about this library and the full list of methods, please refer to our documentation portal.