1. Go to this page and download the library: Download nita-transfert/sdk 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/ */
nita-transfert / sdk example snippets
Configure API key authorization: ApiKey
$config = Nita\Sdk\Configuration::getDefaultConfiguration()->setApiKey('X-NT-API-KEY', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Nita\Sdk\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-NT-API-KEY', 'Bearer');
// Configure Bearer (JWT) authorization: bearerAuth
$config = Nita\Sdk\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new Nita\Sdk\Api\AchatEnLigneV2Api(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$achatEnLigneModel = new \Nita\Sdk\Model\AchatEnLigneModel(); // \Nita\Sdk\Model\AchatEnLigneModel
try {
$result = $apiInstance->addAchatEnligne($achatEnLigneModel);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling AchatEnLigneV2Api->addAchatEnligne: ', $e->getMessage(), PHP_EOL;
}
use Nita\Sdk\CallbackVerifier;
use Nita\Sdk\NitaCallbackException;
// Anti-rejeu : enregistre le nonce dans un stockage partagé (base, Redis...) ; vrai s'il est nouveau.
$isNewNonce = function (string $nonce, int $ttlSeconds) use ($redis): bool {
return (bool) $redis->set('nita:nonce:' . $nonce, '1', ['nx', 'ex' => $ttlSeconds]);
};
$verifier = new CallbackVerifier(getenv('NITA_HMAC_SECRET'), $isNewNonce);
try {
$payload = $verifier->verify(file_get_contents('php://input'), getallheaders());
} catch (NitaCallbackException $e) {
http_response_code(401);
exit;
}
// $payload['status'], $payload['transaction_id']
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.