POST /v1/teams/{teamId}/billing/invoices/{invoiceId}/charge
Cobra fatura open em payment_method salvo
- Acesso: Admin da equipe
- Serviço:
https://api-billing.axuz.net
Autenticação aceita
sessionCookie— Sessão plena Axuz (cookie de sessão da casa). Sessão restrita é 403 enrollment_required.bearerSession— JWT de acesso da sessão em `Authorization: Bearer`.
Sucesso imediato → 200. Pending (SCA / async) → 202 (webhook confirma). Falha → 502 com o motivo.
Parâmetros
| Nome | Em | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
teamId | path | string | sim | |
invoiceId | path | string | sim |
Corpo da requisição
application/json
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
payment_method_id | string | não | UUID de payment_methods; vazio = default do time |
{
"payment_method_id": "string"
}Respostas
200
pago
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
ok | boolean | não | |
status | string | não | |
provider_id | string | não |
202
pending (aguarda webhook)
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
ok | boolean | não | |
status | string | não | |
provider_id | string | não | |
requires_webhook | boolean | não |
400
input inválido
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
401
Sem credencial valida
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
403
Sem permissao (nao e owner/admin; token sem escopo; token de integracao em rota nao permitida)
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
404
recurso não encontrado
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
409
fatura já paga / não cobrável
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
429
Limite de requisições excedido.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
500
Erro interno. Tente de novo com backoff; reporte o X-Request-Id.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
502
falha do gateway
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
503
gateway não configurado
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
Exemplos
O "Try it" está desligado nesta referência. Use os exemplos com a sua credencial de teste.
curl
curl -sS -X POST 'https://api-billing.axuz.net/v1/teams/TEAM_ID/billing/invoices/INVOICE_ID/charge' \
-H "Authorization: Bearer $AXUZ_TOKEN" \
-H "Content-Type: application/json" \
-d '{"payment_method_id":"string"}'Node.js
const res = await fetch("https://api-billing.axuz.net/v1/teams/TEAM_ID/billing/invoices/INVOICE_ID/charge", {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"payment_method_id": "string"
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());Python
import os
import requests
res = requests.request(
"POST",
"https://api-billing.axuz.net/v1/teams/TEAM_ID/billing/invoices/INVOICE_ID/charge",
headers={
"Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
},
json={
"payment_method_id": "string",
},
timeout=30,
)
res.raise_for_status()
print(res.json())