Client SDK for Incert Coupon usage
PHP 7.4 and later.
To install the bindings via Composer, add the following to composer.json
:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/incert/php-sdk.git"
}
],
"require": {
"incert/php-sdk": "^2.0"
}
}
Then run composer install
Download the files and include autoload.php
:
<?php
require_once('/path/to/Client/vendor/autoload.php');
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure API key authorization: authenticateKey
$config = new Incert\Client\Configuration();
$config->setApiKey('X-Api-Key', 'YOUR_API_KEY');
// Set hostname for your API endpoint
// Default Host: https://api-sandbox.myincert.com/api
$config->setHost('YOUR_API_ENDPOINT');
$apiInstance = new Incert\Client\Api\OAuth20ClientCredentialsApi($config);
$accessToken = new \Incert\Client\OAuth20\GrantAccessTokenRequest();
$accessToken->setClientId('YOUR_CLIENT_ID')->setClientSecret('YOUR_CLIENT_SECRET');
try {
$result = $apiInstance->oauthAccessTokenPost($accessToken);
$token = $result->getAccessToken();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling OAuth20ClientCredentialsApi->oauthAccessTokenPost: ', $e->getMessage(), PHP_EOL;
}
All URIs are relative to Incert API Endpoint
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: X-Api-Key
- Location: HTTP header
- Type: Bearer authentication
- Type: API key
- API key parameter name: XTCsid
- Location:
To run the tests, use:
composer install
vendor/bin/phpunit