1. Go to this page and download the library: Download moneymour/api-client-php 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/ */
moneymour / api-client-php example snippets
use Moneymour\ApiClient as MoneymourApiClient;
class ApiClient {
// Get the following information from https://merchant.sandbox.moneymour.com
// For production: https://merchant.moneymour.com
const PRIVATE_KEY = '<YOUR_PRIVATE_KEY>';
const MERCHANT_ID = '<YOUR_MERCHANT_ID>';
const MERCHANT_SECRET = '<YOUR_MERCHANT_SECRET>';
// Build the client
$signatureFactory = new SignatureFactory(self::PRIVATE_KEY);
$client = new MoneymourApiClient(
self::MERCHANT_ID,
self::MERCHANT_SECRET,
$signatureFactory,
MoneymourApiClient::ENVIRONMENT_SANDBOX // or ENVIRONMENT_PRODUCTION when you get ready
);
// Request payload
$payload = [
'orderId' => '123456', // the order id in your system
'amount' => '1080', // must be >= 300 and <= 2000
'email' => '[email protected]',
'phoneNumber' => '+393334444555', // must },
{
"name": "MacBook Pro Charger",
"type": "Electronics",
"price": "80",
"price": "1",
"discount": 0
}
]
}
*/
}
$factory = new SignatureFactory(self::PRIVATE_KEY);
$factory->verify(
$signature, // http request header "Signature"
$expiresAt, // http request header "Expires-at"
$body, // http request body
MoneymourApiClient::ENVIRONMENT_SANDBOX // or ENVIRONMENT_PRODUCTION when you get ready
); // return true or false
bash
$ composer install moneymour/api-client-php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.