API Reference

Segue abaixo alguns modelos disponibilizadas:

$payload = [
  'amount'        => 15,
  'external_id'   => uniqid(), // ID Único da sua transação no seu escopo.
  'payerQuestion' => "", // Descrição da transação
  'payer' => [
    'name'     => "Monkey D. Luffy",
    'document' => "99999999999",
    'email'    => "[email protected]"
   ],
   'postbackUrl'  => "https://your.route" // Rota que será enviado os eventos sobre a transação
];

$curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => 'https://api.bspay.co/v2/pix/qrcode',
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_POSTFIELDS => json_encode($payload),
        CURLOPT_HTTPHEADER => array(
            'Authorization: Bearer seu_token_aqui',
            'Content-Type: application/json'
        ),
    ));

    $response = curl_exec($curl);
use Illuminate\Support\Facades\Http;
use Illuminate\Http\Request;
use Illuminate\Support\Str;

trait BspayApi
{

    public function get_qrcode(Request $request)
    {

            $response = Http::withHeaders([
                'Content-Type: application/json',
                'Authorization' => 'Bearer seu_token_aqui'
            ])->post('https://api.bspay.co/v2/pix/qrcode', [
                'amount'        => $amount,
                'external_id'   => (string) Str::uuid(),
                'payerQuestion' => $payerQuestion,
                'payer' => [
                    'name'     => $user->email,
                    'document' => $document,
                    'email'    => $user->email
                ],
                'postbackUrl'  => $postbackUrl
            ]);

            $response_json = $response->json();

    }
}
{
    "amount": "15",
    "external_id": "",
    "payerQuestion": "",
    "payer": {
        "name": "Monkey D. Luffy",
        "document": "",
        "email": ""
    },
    "postbackUrl": ""
}
Language
Credentials
Header
Click Try It! to start a request and see the response here!