PHP code example of carlosmls1 / avangate-php-rest-api-client
1. Go to this page and download the library: Download carlosmls1/avangate-php-rest-api-client 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/ */
carlosmls1 / avangate-php-rest-api-client example snippets
$client = new Client([
'code' => MERCHANT_CODE,
'key' => MERCHANT_APIKEY,
'base_uri' => 'https://api.avangate.com/3.0/'
]);
try {
$response = $client->get('orders/?StartDate=2015-01-01');
$orderListing = json_decode($response->getBody()->getContents());
print_r($orderListing);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$contents = json_decode($e->getResponse()->getBody()->getContents());
var_dump($contents->message);
} catch (\Exception $e) {
var_dump($e->getMessage());
}