| 1 |
# MONEI PHP SDK |
| 2 |
|
| 3 |
The MONEI API is organized around [](https://en.wikipedia.org/wiki/Representational_State_TransferREST](https://en.wikipedia.org/wiki/Representational_State_Transfer](https://en.wikipedia.org/wiki/Representational_State_Transfer). 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. |
| 4 |
|
| 5 |
This library is intended to help you develop an integration around our API, by using the MONEI PHP Client and it's methods. |
| 6 |
|
| 7 |
## Docs in our portal |
| 8 |
|
| 9 |
**You can find the complete information and details in [](https://docs.monei.net/api/our documentation portal](https://docs.monei.net/api/](https://docs.monei.net/api/).** |
| 10 |
|
| 11 |
## Requirements |
| 12 |
|
| 13 |
PHP 5.5 and later |
| 14 |
|
| 15 |
## Installation & Usage |
| 16 |
|
| 17 |
### Composer |
| 18 |
|
| 19 |
To install the bindings via [](http://getcomposer.org/Composer](http://getcomposer.org/](http://getcomposer.org/), run the following command: |
| 20 |
|
| 21 |
```bash |
| 22 |
composer require monei/monei-php-sdk |
| 23 |
``` |
| 24 |
|
| 25 |
Or add the following to `composer.json`: |
| 26 |
|
| 27 |
```json |
| 28 |
{ |
| 29 |
"require": { |
| 30 |
"monei/monei-php-sdk": "^0.1.3" |
| 31 |
} |
| 32 |
} |
| 33 |
``` |
| 34 |
|
| 35 |
Then run `composer install` |
| 36 |
|
| 37 |
### Manual Installation |
| 38 |
|
| 39 |
Download the files and include `autoload.php`: |
| 40 |
|
| 41 |
```php |
| 42 |
require_once('/path/to/MONEI PHP SDK/vendor/autoload.php'); |
| 43 |
``` |
| 44 |
|
| 45 |
## Tests |
| 46 |
|
| 47 |
To run the unit tests: |
| 48 |
|
| 49 |
```bash |
| 50 |
composer install |
| 51 |
./vendor/bin/phpunit |
| 52 |
``` |
| 53 |
|
| 54 |
|
| 55 |
## Authorization |
| 56 |
|
| 57 |
The MONEI API uses API key to authenticate requests. You can view and manage your API key in the [](https://dashboard.monei.net/settings/apiMONEI Dashboard](https://dashboard.monei.net/settings/api](https://dashboard.monei.net/settings/api). |
| 58 |
|
| 59 |
For more information about this process, please refer to [](https://docs.monei.net/api/#section/Authenticationour documentation portal](https://docs.monei.net/api/#section/Authentication](https://docs.monei.net/api/#section/Authentication). |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
## Getting Started |
| 64 |
|
| 65 |
Please follow the [](#installation--usageinstallation procedure](#installation--usage](#installation--usage) and then run the following: |
| 66 |
|
| 67 |
```php |
| 68 |
<?php |
| 69 |
require_once(__DIR__ . '/vendor/autoload.php'); |
| 70 |
|
| 71 |
// Instantiate the client using the API key |
| 72 |
$monei = new Monei\MoneiClient('YOUR_API_KEY'); |
| 73 |
|
| 74 |
try { |
| 75 |
$result = $monei->payments->create([ |
| 76 |
'amount' => 1250, // 12.50€ |
| 77 |
'orderId' => '100100000001', |
| 78 |
'currency' => 'EUR', |
| 79 |
'description' => 'Items decription', |
| 80 |
'customer' => [ |
| 81 |
'email' => 'john.doe@monei.net', |
| 82 |
'name' => 'John Doe' |
| 83 |
] |
| 84 |
]); |
| 85 |
print_r($result); |
| 86 |
} catch (Exception $e) { |
| 87 |
echo 'Error while creating payment: ', $e->getMessage(), PHP_EOL; |
| 88 |
} |
| 89 |
|
| 90 |
?> |
| 91 |
``` |
| 92 |
|
| 93 |
## Documentation for API Endpoints |
| 94 |
|
| 95 |
For more detailed information about this library and the full list of methods, please refer to [our documentation portal](https://docs.monei.net/api/). |
| 96 |
|