1. Go to this page and download the library: Download nkpay/pix-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/ */
nkpay / pix-sdk example snippets
use NkPay\Pix\PixClient;
use NkPay\Pix\PixConfig;
$client = new PixClient(new PixConfig(
baseUri: 'https://api.sandbox.banrisul.com.br/pix/v2',
tokenUrl: 'https://api.sandbox.banrisul.com.br/oauth/token',
clientId: getenv('PIX_CLIENT_ID'),
clientSecret: getenv('PIX_CLIENT_SECRET'),
pfxPath: __DIR__ . '/certs/certificado.pfx',
pfxPassphrase: getenv('PIX_PFX_PASSPHRASE'), // '' se o .pfx não tiver senha
));
use NkPay\Pix\PixClient;
use NkPay\Pix\PixConfig;
$client = new PixClient(new PixConfig(
baseUri: 'https://api.sandbox.banrisul.com.br/pix/v2',
tokenUrl: 'https://api.sandbox.banrisul.com.br/oauth/token',
clientId: getenv('PIX_CLIENT_ID'),
clientSecret: getenv('PIX_CLIENT_SECRET'),
certPath: __DIR__ . '/certs/certificado.pem',
certKeyPath: __DIR__ . '/certs/chave.key',
// certPassphrase: 'opcional, se a chave for protegida por senha',
));