1. Go to this page and download the library: Download klebervmv/bs2pay 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/ */
klebervmv / bs2pay example snippets
use Adiq\AdiqPaymentSDK;
$sdk = new AdiqPaymentSDK(
'seu-client-id',
'seu-client-secret',
'sandbox', // sandbox | homologation | production
[
'timeout' => 30000, // ms
'verifySsl' => true,
'logSensitiveData' => false,
]
);
try {
$payment = $sdk->payments->create([
'payment' => [...],
'cardInfo' => [...],
'sellerInfo' => ['orderNumber' => 'ORDER-001', ...],
]);
} catch (\Adiq\Exceptions\NetworkException $e) {
// Verifica se a transação chegou a ser registrada na ADIQ
try {
$existing = $sdk->payments->getByOrderNumber('ORDER-001', date('Ymd'));
if ($existing->isApproved()) {
// Já aprovada — não reenvie, apenas use o paymentId retornado
} else {
// Não existe / falhou — seguro reenviar
}
} catch (\Adiq\Exceptions\NotFoundException $e) {
// Não chegou ao servidor; seguro reenviar
}
}
use Adiq\Utils\Logger;
$logger = new Logger('debug', false, __DIR__ . '/logs/adiq.log');
$sdk = new AdiqPaymentSDK($id, $secret, 'sandbox', ['logger' => $logger]);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.