<?php

require_once __DIR__ . '/../../AvangateJsonrpcClient.php';
use AvangateJsonrpcClient as Client;
/**
 * Initialize client
 */
Client::setBaseUrl('https://api.avangate.com/rpc/3.0/');
Client::setCredentials('APITEST', 'SECRET_KEY');
/**
 * Prepare call
 */
$customerObject = (object) ['FirstName' => 'John', 'LastName' => 'Jsonrpc', 'Email' => '*****@*****.**', 'Company' => 'A', 'FiscalCode' => '12345', 'Phone' => '021-000-222', 'Fax' => '021-000-000', 'Address1' => 'DP10A', 'Address2' => 'CBP, b3', 'Zip' => '123456', 'City' => 'Atlanta', 'State' => 'Georgia', 'CountryCode' => 'US', 'Language' => 'en'];
$addedAvangateCustomerReference = Client::createCustomer($customerObject);
echo 'Customer reference: ' . $response . PHP_EOL;
// output:
// Customer reference: 141589723
/**
 * Get added details:
 */
$customerObject = Client::getCustomerInformation($addedAvangateCustomerReference);
echo json_encode($customerObject, JSON_PRETTY_PRINT);
// output:
// {
//     "AvangateCustomerReference": "141589723",
//     "ExternalCustomerReference": null,
//     "FirstName": "John",
//     "LastName": "Jsonrpc",
//     "Company": "A",
//     "FiscalCode": "12345",
//     "Address1": "DP10A",