Appendix - Under the hood

All the following method calls are used in the Nektria\Recs\MerchantApi\Requests\BaseRequest class. All SDK requests inherit from BaseRequest, and use transparently these methods, transmitting all the parameters that are passed in the constructor.

Create the ReCS API client

<?php
// Require the Composer autoloader.
require 'vendor/autoload.php';

// Instantiate an ReCS client using your API KEY.
$recsClient = new Nektria\Recs\MerchantApi\Client([
    'APIKEY' => 'my-own-api-key'
]);

Run a configured request

For example, the test request.

<?php
// Execute the 'test' method to check the connection with the API
try {
    $recsClient->test();
} catch (Exception $e) {
    echo "There was an error connecting with the API : ".$e->getMessage();
}