Gerar cobrança PIX (QR Code dinâmico)
curl --request POST \
--url https://api.paysurebr.com/v1/pix/qrcode \
--header 'Content-Type: application/json' \
--header 'ci: <api-key>' \
--data '
{
"external_id": "order-12345",
"value_cents": 10000,
"postbackUrl": "https://seu-site.com/webhooks/paysure",
"generator_name": "João da Silva",
"generator_document": "12345678900",
"description": "Pedido #12345",
"expiration_seconds": 3600,
"splits": [
{
"clientId": "parceiro1",
"value": 5
}
]
}
'import requests
url = "https://api.paysurebr.com/v1/pix/qrcode"
payload = {
"external_id": "order-12345",
"value_cents": 10000,
"postbackUrl": "https://seu-site.com/webhooks/paysure",
"generator_name": "João da Silva",
"generator_document": "12345678900",
"description": "Pedido #12345",
"expiration_seconds": 3600,
"splits": [
{
"clientId": "parceiro1",
"value": 5
}
]
}
headers = {
"ci": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {ci: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_id: 'order-12345',
value_cents: 10000,
postbackUrl: 'https://seu-site.com/webhooks/paysure',
generator_name: 'João da Silva',
generator_document: '12345678900',
description: 'Pedido #12345',
expiration_seconds: 3600,
splits: [{clientId: 'parceiro1', value: 5}]
})
};
fetch('https://api.paysurebr.com/v1/pix/qrcode', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paysurebr.com/v1/pix/qrcode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'external_id' => 'order-12345',
'value_cents' => 10000,
'postbackUrl' => 'https://seu-site.com/webhooks/paysure',
'generator_name' => 'João da Silva',
'generator_document' => '12345678900',
'description' => 'Pedido #12345',
'expiration_seconds' => 3600,
'splits' => [
[
'clientId' => 'parceiro1',
'value' => 5
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"ci: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.paysurebr.com/v1/pix/qrcode"
payload := strings.NewReader("{\n \"external_id\": \"order-12345\",\n \"value_cents\": 10000,\n \"postbackUrl\": \"https://seu-site.com/webhooks/paysure\",\n \"generator_name\": \"João da Silva\",\n \"generator_document\": \"12345678900\",\n \"description\": \"Pedido #12345\",\n \"expiration_seconds\": 3600,\n \"splits\": [\n {\n \"clientId\": \"parceiro1\",\n \"value\": 5\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ci", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.paysurebr.com/v1/pix/qrcode")
.header("ci", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_id\": \"order-12345\",\n \"value_cents\": 10000,\n \"postbackUrl\": \"https://seu-site.com/webhooks/paysure\",\n \"generator_name\": \"João da Silva\",\n \"generator_document\": \"12345678900\",\n \"description\": \"Pedido #12345\",\n \"expiration_seconds\": 3600,\n \"splits\": [\n {\n \"clientId\": \"parceiro1\",\n \"value\": 5\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paysurebr.com/v1/pix/qrcode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ci"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_id\": \"order-12345\",\n \"value_cents\": 10000,\n \"postbackUrl\": \"https://seu-site.com/webhooks/paysure\",\n \"generator_name\": \"João da Silva\",\n \"generator_document\": \"12345678900\",\n \"description\": \"Pedido #12345\",\n \"expiration_seconds\": 3600,\n \"splits\": [\n {\n \"clientId\": \"parceiro1\",\n \"value\": 5\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"qrcode": {
"reference_code": "PSR-9c8f7a1e-4d2b-4e6a-8c9f-1a2b3c4d5e6f",
"external_reference": "order-12345",
"content": "00020126580014br.gov.bcb.pix..."
}
}{
"message": "Invalid credentials or inactive"
}{
"message": "<string>",
"ms": 123
}Cash-in
Gerar QR Code PIX
Cria uma nova cobrança PIX e retorna o BR Code (copia-e-cola) que o pagador usa.
Quando o pagador efetua o pagamento, enviamos um webhook para postbackUrl com status paid.
POST
/
v1
/
pix
/
qrcode
Gerar cobrança PIX (QR Code dinâmico)
curl --request POST \
--url https://api.paysurebr.com/v1/pix/qrcode \
--header 'Content-Type: application/json' \
--header 'ci: <api-key>' \
--data '
{
"external_id": "order-12345",
"value_cents": 10000,
"postbackUrl": "https://seu-site.com/webhooks/paysure",
"generator_name": "João da Silva",
"generator_document": "12345678900",
"description": "Pedido #12345",
"expiration_seconds": 3600,
"splits": [
{
"clientId": "parceiro1",
"value": 5
}
]
}
'import requests
url = "https://api.paysurebr.com/v1/pix/qrcode"
payload = {
"external_id": "order-12345",
"value_cents": 10000,
"postbackUrl": "https://seu-site.com/webhooks/paysure",
"generator_name": "João da Silva",
"generator_document": "12345678900",
"description": "Pedido #12345",
"expiration_seconds": 3600,
"splits": [
{
"clientId": "parceiro1",
"value": 5
}
]
}
headers = {
"ci": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {ci: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_id: 'order-12345',
value_cents: 10000,
postbackUrl: 'https://seu-site.com/webhooks/paysure',
generator_name: 'João da Silva',
generator_document: '12345678900',
description: 'Pedido #12345',
expiration_seconds: 3600,
splits: [{clientId: 'parceiro1', value: 5}]
})
};
fetch('https://api.paysurebr.com/v1/pix/qrcode', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paysurebr.com/v1/pix/qrcode",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'external_id' => 'order-12345',
'value_cents' => 10000,
'postbackUrl' => 'https://seu-site.com/webhooks/paysure',
'generator_name' => 'João da Silva',
'generator_document' => '12345678900',
'description' => 'Pedido #12345',
'expiration_seconds' => 3600,
'splits' => [
[
'clientId' => 'parceiro1',
'value' => 5
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"ci: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.paysurebr.com/v1/pix/qrcode"
payload := strings.NewReader("{\n \"external_id\": \"order-12345\",\n \"value_cents\": 10000,\n \"postbackUrl\": \"https://seu-site.com/webhooks/paysure\",\n \"generator_name\": \"João da Silva\",\n \"generator_document\": \"12345678900\",\n \"description\": \"Pedido #12345\",\n \"expiration_seconds\": 3600,\n \"splits\": [\n {\n \"clientId\": \"parceiro1\",\n \"value\": 5\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("ci", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.paysurebr.com/v1/pix/qrcode")
.header("ci", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_id\": \"order-12345\",\n \"value_cents\": 10000,\n \"postbackUrl\": \"https://seu-site.com/webhooks/paysure\",\n \"generator_name\": \"João da Silva\",\n \"generator_document\": \"12345678900\",\n \"description\": \"Pedido #12345\",\n \"expiration_seconds\": 3600,\n \"splits\": [\n {\n \"clientId\": \"parceiro1\",\n \"value\": 5\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paysurebr.com/v1/pix/qrcode")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["ci"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_id\": \"order-12345\",\n \"value_cents\": 10000,\n \"postbackUrl\": \"https://seu-site.com/webhooks/paysure\",\n \"generator_name\": \"João da Silva\",\n \"generator_document\": \"12345678900\",\n \"description\": \"Pedido #12345\",\n \"expiration_seconds\": 3600,\n \"splits\": [\n {\n \"clientId\": \"parceiro1\",\n \"value\": 5\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"qrcode": {
"reference_code": "PSR-9c8f7a1e-4d2b-4e6a-8c9f-1a2b3c4d5e6f",
"external_reference": "order-12345",
"content": "00020126580014br.gov.bcb.pix..."
}
}{
"message": "Invalid credentials or inactive"
}{
"message": "<string>",
"ms": 123
}Cria uma nova cobrança PIX e retorna o BR Code (copia-e-cola) que o pagador pode escanear ou colar no app do banco dele.
Fluxo completo
1
Você faz POST /v1/pix/qrcode
Envie
external_id, value_cents, postbackUrl e dados opcionais do pagador.2
Recebe HTTP 201 com BR Code
Use
qrcode.content (BR Code copia-e-cola) pra gerar o QR visual no seu frontend.3
Cliente paga via app do banco dele
Pagador escaneia o QR ou cola o código. Banco processa o PIX.
4
Paysure envia webhook com status paid
Você recebe POST em
postbackUrl com cashin.status = "paid". Credite o produto/serviço no seu sistema.Authorizations
Body
application/json

