Criar Cobrança
curl --request POST \
--url https://api.example.com/charges \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"amount": 123,
"description": "<string>",
"customer": {
"customer.name": "<string>",
"customer.email": "<string>",
"customer.document": "<string>"
}
}
'import requests
url = "https://api.example.com/charges"
payload = {
"amount": 123,
"description": "<string>",
"customer": {
"customer.name": "<string>",
"customer.email": "<string>",
"customer.document": "<string>"
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
amount: 123,
description: '<string>',
customer: {
'customer.name': '<string>',
'customer.email': '<string>',
'customer.document': '<string>'
}
})
};
fetch('https://api.example.com/charges', 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.example.com/charges",
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([
'amount' => 123,
'description' => '<string>',
'customer' => [
'customer.name' => '<string>',
'customer.email' => '<string>',
'customer.document' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.example.com/charges"
payload := strings.NewReader("{\n \"amount\": 123,\n \"description\": \"<string>\",\n \"customer\": {\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.document\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
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.example.com/charges")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"amount\": 123,\n \"description\": \"<string>\",\n \"customer\": {\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.document\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"amount\": 123,\n \"description\": \"<string>\",\n \"customer\": {\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.document\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "ch_flare_dc7dc11b7f984d2886d2b429",
"object": "charge",
"amount": 10.00,
"amount_cents": 1000,
"currency": "BRL",
"method": "pix",
"status": "pending",
"pix": {
"qr_code": "base64...",
"copy_paste": "00020101021226...",
"payment_link": "https://..."
},
"expires_at": "2026-03-05T19:14:48.549Z",
"created_at": "2026-03-05T18:14:48.552Z",
"livemode": true
}
Cobranças
Criar Cobrança
Cria uma nova cobrança PIX
POST
/
charges
Criar Cobrança
curl --request POST \
--url https://api.example.com/charges \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"amount": 123,
"description": "<string>",
"customer": {
"customer.name": "<string>",
"customer.email": "<string>",
"customer.document": "<string>"
}
}
'import requests
url = "https://api.example.com/charges"
payload = {
"amount": 123,
"description": "<string>",
"customer": {
"customer.name": "<string>",
"customer.email": "<string>",
"customer.document": "<string>"
}
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({
amount: 123,
description: '<string>',
customer: {
'customer.name': '<string>',
'customer.email': '<string>',
'customer.document': '<string>'
}
})
};
fetch('https://api.example.com/charges', 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.example.com/charges",
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([
'amount' => 123,
'description' => '<string>',
'customer' => [
'customer.name' => '<string>',
'customer.email' => '<string>',
'customer.document' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$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.example.com/charges"
payload := strings.NewReader("{\n \"amount\": 123,\n \"description\": \"<string>\",\n \"customer\": {\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.document\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
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.example.com/charges")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"amount\": 123,\n \"description\": \"<string>\",\n \"customer\": {\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.document\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/charges")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"amount\": 123,\n \"description\": \"<string>\",\n \"customer\": {\n \"customer.name\": \"<string>\",\n \"customer.email\": \"<string>\",\n \"customer.document\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "ch_flare_dc7dc11b7f984d2886d2b429",
"object": "charge",
"amount": 10.00,
"amount_cents": 1000,
"currency": "BRL",
"method": "pix",
"status": "pending",
"pix": {
"qr_code": "base64...",
"copy_paste": "00020101021226...",
"payment_link": "https://..."
},
"expires_at": "2026-03-05T19:14:48.549Z",
"created_at": "2026-03-05T18:14:48.552Z",
"livemode": true
}
Descrição
Cria uma nova cobrança PIX. O retorno inclui o QR Code e o código copia-e-cola para apresentar ao cliente.O campo
amount deve ser enviado em centavos (inteiro). Por exemplo, 1000 = R$ 10,00.Headers
string
required
Bearer token de autenticação. Formato:
Bearer sk_live_xxxstring
required
Deve ser
application/jsonstring
Chave única para evitar cobranças duplicadas
Body
integer
required
Valor em centavos (ex:
1000 = R$ 10,00)string
Descrição da cobrança
object
Exemplo de Requisição
curl -X POST https://api.flarepayments.com/v1/charges \
-H "Authorization: Bearer sk_live_sua_chave_aqui" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: pedido-1234" \
-d '{
"amount": 1000,
"description": "Pedido #1234",
"customer": {
"name": "João Silva",
"email": "joao@email.com",
"document": "12345678900"
}
}'
const response = await fetch('https://api.flarepayments.com/v1/charges', {
method: 'POST',
headers: {
'Authorization': 'Bearer sk_live_sua_chave_aqui',
'Content-Type': 'application/json',
'Idempotency-Key': 'pedido-1234'
},
body: JSON.stringify({
amount: 1000,
description: 'Pedido #1234',
customer: {
name: 'João Silva',
email: 'joao@email.com',
document: '12345678900'
}
})
});
const charge = await response.json();
import requests
response = requests.post(
'https://api.flarepayments.com/v1/charges',
headers={
'Authorization': 'Bearer sk_live_sua_chave_aqui',
'Content-Type': 'application/json',
'Idempotency-Key': 'pedido-1234'
},
json={
'amount': 1000,
'description': 'Pedido #1234',
'customer': {
'name': 'João Silva',
'email': 'joao@email.com',
'document': '12345678900'
}
}
)
charge = response.json()
Resposta 201 Created
string
ID da cobrança no formato
ch_flare_xxxstring
Sempre
"charge"float
Valor em Reais
integer
Valor em centavos
string
Moeda (
BRL)string
Método de pagamento (
pix)string
Status da cobrança:
pending, paid, expired, failedobject
string
Data de expiração (ISO 8601)
string
Data de criação (ISO 8601)
boolean
true em produção{
"id": "ch_flare_dc7dc11b7f984d2886d2b429",
"object": "charge",
"amount": 10.00,
"amount_cents": 1000,
"currency": "BRL",
"method": "pix",
"status": "pending",
"pix": {
"qr_code": "base64...",
"copy_paste": "00020101021226...",
"payment_link": "https://..."
},
"expires_at": "2026-03-05T19:14:48.549Z",
"created_at": "2026-03-05T18:14:48.552Z",
"livemode": true
}
Erros
| Status | Código | Descrição |
|---|---|---|
400 | invalid_amount | amount deve ser um inteiro positivo em centavos |
401 | unauthorized | Header Authorization ausente |
401 | invalid_api_key | Chave de API inválida |
429 | rate_limit_exceeded | Limite de 60 req/min excedido |
