1. Go to this page and download the library: Download pagnow/sdk-php 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/ */
pagnow / sdk-php example snippets
use Pagnow\PagNow;
// The apikey identifies your tenant — no tenantId needed.
// baseUrl defaults to https://v2.pagnow.com (the live API host).
$pagnow = new PagNow(['apiKey' => getenv('PAGNOW_API_KEY')]);
$charge = $pagnow->payments->create([
'amount' => 1990, // cents
'currency' => 'BRL',
'paymentMethods' => ['PIX'],
'customer' => [
'name' => 'João Silva',
'document' => '52998224725',
'email' => '[email protected]',
],
'idempotencyKey' => "pedido-{$orderId}",
]);
echo $charge['pixCopyPaste'];
// Status, refund (full/partial), cancel:
$status = $pagnow->payments->retrieve($charge['id']);
$pagnow->payments->refund($charge['id'], ['idempotencyKey' => "refund-{$charge['id']}"]);
$pagnow->payments->cancel($charge['id']);