POST /teams/{teamId}/billing/payment-methods/attach
Stripe Elements — attach pm_* + mirror local
- 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`.
Finishes the Elements flow. Given a pm_* id confirmed on the client side, we attach it to the customer, mirror the card details into our local table, and optionally mark it as default (sets both our row flag + Stripe customer's invoice_settings.default_payment_method).
Parâmetros
| Nome | Em | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
teamId | path | string | sim |
Corpo da requisição
application/json · Obrigatório
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
payment_method_id | string | sim | Stripe pm_* id retornado pelo Elements |
make_default | boolean | não |
{
"payment_method_id": "string",
"make_default": true
}Respostas
201
attached
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
id | string<uuid> | não | |
provider_method_id | string | não | |
brand | string | não | |
last4 | string | não | |
exp_month | integer | não | |
exp_year | integer | não | |
is_default | 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 |
429
Limite de requisições excedido.
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
500
erro interno
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
502
falha do Stripe
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
error | string | sim |
503
Stripe 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/teams/TEAM_ID/billing/payment-methods/attach' \
-H "Authorization: Bearer $AXUZ_TOKEN" \
-H "Content-Type: application/json" \
-d '{"payment_method_id":"string","make_default":true}'Node.js
const res = await fetch("https://api-billing.axuz.net/teams/TEAM_ID/billing/payment-methods/attach", {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"payment_method_id": "string",
"make_default": true
}),
});
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/teams/TEAM_ID/billing/payment-methods/attach",
headers={
"Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
},
json={
"payment_method_id": "string",
"make_default": True,
},
timeout=30,
)
res.raise_for_status()
print(res.json())