Axuz Developers

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

NameInTypeRequiredDescription
teamIdpathstringyes

Request body

application/json · Required

NameTypeRequiredDescription
providerstringno

default = gateway.Default

provider_method_idstringno
kindstringno
display_labelstringno
brandstringno
last4stringno
exp_monthinteger | nullno
exp_yearinteger | nullno
make_defaultbooleanno
tokenstringno

Stripe Elements tokenisation (pm_*) — repassa ao adapter

gateway_payloadobjectno
{
  "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

NameTypeRequiredDescription
idstring<uuid>no

400

input inválido

NameTypeRequiredDescription
errorstringyes

401

Sem credencial valida

NameTypeRequiredDescription
errorstringyes

403

Sem permissao (nao e owner/admin; token sem escopo; token de integracao em rota nao permitida)

NameTypeRequiredDescription
errorstringyes

429

Limite de requisições excedido.

NameTypeRequiredDescription
errorstringyes

500

erro interno

NameTypeRequiredDescription
errorstringyes

502

falha do gateway

NameTypeRequiredDescription
errorstringyes

503

gateway não configurado

NameTypeRequiredDescription
errorstringyes

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())