1. Go to this page and download the library: Download devsitarget/sdk-vindi-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/ */
devsitarget / sdk-vindi-php example snippets
use VindiSdk\Environment;
use VindiSdk\Store;
use VindiSdk\Vindi;
$env = Environment::sandbox(); // ou Environment::production()
$store = new Store('PUBLIC_KEY', 'PRIVATE_KEY', $env);
// ID do produto configurado no painel Vindi
$productId = 363801;
$vindi = new Vindi($store, $productId);
use VindiSdk\Customer;
use VindiSdk\Address;
use VindiSdk\Pix\PixRequest;
$customer = new Customer(
id: '123', name: 'Cliente', email: '[email protected]',
document: '12345678900', phone: '11999999999',
address: new Address('Rua A', '100', '01234-567', 'Centro', 'São Paulo', 'SP')
);
$req = new PixRequest(amount: 100.0, currency: 'BRL', customer: $customer, description: 'PIX Pedido 123');
$res = $vindi->createPixCharge($req);
// $res->qrCode contém SVG, $res->pixCopyPaste contém payload COPIA E COLA