Status da Cobrança
curl --request GET \
--url https://api.example.com/charges/{chargeId}/status \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/charges/{chargeId}/status"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/charges/{chargeId}/status', 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/{chargeId}/status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/charges/{chargeId}/status"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/charges/{chargeId}/status")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/charges/{chargeId}/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "ch_flare_dc7dc11b7f984d2886d2b429",
"status": "pending",
"paid": false
}
Cobranças
Status da Cobrança
Endpoint leve para polling de status de pagamento
GET
/
charges
/
{chargeId}
/
status
Status da Cobrança
curl --request GET \
--url https://api.example.com/charges/{chargeId}/status \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/charges/{chargeId}/status"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/charges/{chargeId}/status', 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/{chargeId}/status",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/charges/{chargeId}/status"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/charges/{chargeId}/status")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/charges/{chargeId}/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"id": "ch_flare_dc7dc11b7f984d2886d2b429",
"status": "pending",
"paid": false
}
Descrição
Retorna apenas o status da cobrança. Ideal para polling — verificar periodicamente se um pagamento foi confirmado, sem carregar todos os dados da cobrança.Use este endpoint em vez de
GET /charges/{id} quando precisar verificar o status frequentemente. Ele é mais leve e rápido.Parâmetros de Path
string
required
ID da cobrança
Headers
string
required
Bearer token de autenticação. Formato:
Bearer sk_live_xxxExemplo de Requisição
curl https://api.flarepayments.com/v1/charges/ch_flare_dc7dc11b7f984d2886d2b429/status \
-H "Authorization: Bearer sk_live_sua_chave_aqui"
// Polling a cada 3 segundos
async function aguardarPagamento(chargeId) {
while (true) {
const res = await fetch(
`https://api.flarepayments.com/v1/charges/${chargeId}/status`,
{ headers: { 'Authorization': 'Bearer sk_live_xxx' } }
);
const { status, paid } = await res.json();
if (paid) {
console.log('Pagamento confirmado!');
break;
}
if (status === 'expired' || status === 'failed') {
console.log('Cobrança expirou ou falhou');
break;
}
await new Promise(r => setTimeout(r, 3000));
}
}
Resposta 200 OK
string
ID da cobrança
string
Status atual:
pending, paid, expired, failedboolean
true se o pagamento foi confirmado{
"id": "ch_flare_dc7dc11b7f984d2886d2b429",
"status": "pending",
"paid": false
}
