POST /teams/{teamId}/billing/payment-methods
Cria método (manual ou via gateway)
- Access: Team admin
- Service:
https://api-billing.axuz.net
Accepted authentication
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`.
Responde POST /teams/{teamId}/billing/ payment-methods. Quando provider não-manual, chama o adapter pra garantir customer + attach do payment_method no gateway e persiste os dados retornados (last4/brand oficiais). Efeitos: chamada externa ao provider (Stripe/MP), INSERT em payment_methods, opcional UPDATE pra marcar como default. Falha do provider aborta antes do INSERT (nunca persiste método parcial). Auditado como billing.payment_method.added.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
teamId | path | string | yes |
Request body
application/json · Required
| Name | Type | Required | Description |
|---|---|---|---|
provider | string | no | default = gateway.Default |
provider_method_id | string | no | |
kind | string | no | |
display_label | string | no | |
brand | string | no | |
last4 | string | no | |
exp_month | integer | null | no | |
exp_year | integer | null | no | |
make_default | boolean | no | |
token | string | no | Stripe Elements tokenisation (pm_*) — repassa ao adapter |
gateway_payload | object | no |
{
"provider": "string",
"provider_method_id": "string",
"kind": "manual",
"display_label": "string",
"brand": "string",
"last4": "string",
"exp_month": 1,
"exp_year": 1,
"make_default": true,
"token": "string",
"gateway_payload": {}
}Responses
201
criado
| Name | Type | Required | Description |
|---|---|---|---|
id | string<uuid> | no |
400
input inválido
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
401
Sem credencial valida
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
403
Sem permissao (nao e owner/admin; token sem escopo; token de integracao em rota nao permitida)
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
429
Limite de requisições excedido.
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
500
erro interno
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
502
falha do gateway
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
503
gateway não configurado
| Name | Type | Required | Description |
|---|---|---|---|
error | string | yes |
Examples
"Try it" is turned off in this reference. Use the examples with your test credential.
curl
curl -sS -X POST 'https://api-billing.axuz.net/teams/TEAM_ID/billing/payment-methods' \
-H "Authorization: Bearer $AXUZ_TOKEN" \
-H "Content-Type: application/json" \
-d '{"provider":"string","provider_method_id":"string","kind":"manual","display_label":"string","brand":"string","last4":"string","exp_month":1,"exp_year":1,"make_default":true,"token":"string","gateway_payload":{}}'Node.js
const res = await fetch("https://api-billing.axuz.net/teams/TEAM_ID/billing/payment-methods", {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.AXUZ_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"provider": "string",
"provider_method_id": "string",
"kind": "manual",
"display_label": "string",
"brand": "string",
"last4": "string",
"exp_month": 1,
"exp_year": 1,
"make_default": true,
"token": "string",
"gateway_payload": {}
}),
});
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",
headers={
"Authorization": f"Bearer {os.environ['AXUZ_TOKEN']}",
},
json={
"provider": "string",
"provider_method_id": "string",
"kind": "manual",
"display_label": "string",
"brand": "string",
"last4": "string",
"exp_month": 1,
"exp_year": 1,
"make_default": True,
"token": "string",
"gateway_payload": {},
},
timeout=30,
)
res.raise_for_status()
print(res.json())