PHP code example of bmorais / pix
1. Go to this page and download the library: Download bmorais/pix 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/ */
bmorais / pix example snippets
$defaultPíxKey = "CHAVEPIX";
$defaultDescription = mb_strimwidth("DESCRICAO PIX", 0, 19, ""); //ex: Pagamento do pedido
$defaultMerchantName = "NOME PESSOA PIX";
$defaultMerchantCity = "NOME CIDADE";
$defaultTxid = "IDUNICO";
$order = "";
$amount = "100,00";
$pix = new Pix();
// Instancia principal do payload Pix
$obPayload = $pix->setPixKey($defaultPíxKey)
->setDescription($defaultDescription . $order)
->setMerchantName($defaultMerchantName)
->setMerchantCity($defaultMerchantCity)
->setAmount($amount)
->setTxid($defaultTxid);
// Código de pagamento Pix
$payload = $obPayload->getPayload();
$qrcode = $pix->qrcode($payload,400);