Voltar ao site
Links de pagamento

Criar link de pagamento

POST/v1/payment-links

Cria um link de checkout hospedado. Com customer → uso único (maxPayments 1). Sem customer → uso múltiplo com teto maxPayments (padrão 1). Captura automática, sem split, itens, caução ou repasse de tarifa. externalReference é o dedupe recomendado quando a chave se perde.

X-Merchant-Id é obrigatório com credencial de organização; com credencial de merchant é opcional (ausente = o próprio merchant).

Authorization

kodanoOAuth payments:links:write
headerAuthorizationBearer <token>

Token obtido no Zitadel do ambiente (POST /oauth/v2/token), fora do host da API, e enviado em Authorization: Bearer <access_token>.

  • Sandbox: https://kodano-uat-p55zt6.us1.zitadel.cloud/oauth/v2/token
  • Produção: https://kodano-prod-qe8hbt.us1.zitadel.cloud/oauth/v2/token

Use sempre o tokenUrl devolvido na emissão da credencial. Duas variantes: private_key_jwt (preferida; grant urn:ietf:params:oauth:grant-type:jwt-bearer com assertion RS256 assinada pela chave da credencial, iss = sub = userId, aud = authority do Zitadel, kid = keyId) e client_secret (grant client_credentials). O OpenAPI só modela a segunda.

O parâmetro scope do token é OIDC, não os escopos da API: openid urn:zitadel:iam:org:project:id:<projectId da API>:aud urn:zitadel:iam:user:resourceowner. Sem o :aud a API responde 401 AUTH.TOKEN_INVALID; sem resourceowner, 403 AUTH.TENANT_MISMATCH.

Os 28 escopos abaixo são os entitlements concedidos à credencial pelos produtos de integração (produto:recurso:ação; write não implica read), avaliados a cada requisição; não são pedidos no token. O tenant vem da organização do token; o merchant, de X-Merchant-Id. Revogar a credencial nega os tokens já emitidos em até 60 s.

Scope: payments:links:write

Header Parameters

X-Merchant-Id*string

Merchant da operação (mrc_ + Guid sem hífens, minúsculo). Obrigatório com credencial de organização (ausente → 400 MERCHANT.HEADER_REQUIRED); com credencial de merchant é opcional (ausente = o próprio merchant). Malformado, repetido, inexistente ou de outro tenant → 403 MERCHANT.FORBIDDEN (nunca 404). Vazio = ausente.

Match^mrc_[0-9a-f]{32}$
Idempotency-Key*string

UUID, retido por 24 h a partir da primeira chamada. Escopo: (tenant, merchant, rota-template, chave). Mesma chave e mesmo corpo → resposta original (2xx ou 4xx) com X-Idempotent-Replay: true; corpo ou path concreto diferente → 409 IDEMPOTENCY.CONFLICT; em execução ou desfecho desconhecido → 409 IDEMPOTENCY.IN_PROGRESS com resourceId e Retry-After: 2. Ausente ou não-UUID → 422 IDEMPOTENCY.KEY_REQUIRED.

Formatuuid
X-Correlation-Id?string

Opcional, sempre ecoado na resposta e repetido em correlationId do Problem. Ausente ou inválido → o serviço gera UUID v7.

Match^[A-Za-z0-9._-]{1,64}$

Request Body

application/json
  1. body
amount*integer
Range100 <= value <= 100000000
currency*"BRL"

Único valor na v1.

Value in"BRL"
name?string
Lengthlength <= 255
description?string
Lengthlength <= 255
methods*array<>
Items1 <= items <= 3
maxPayments?integer
Range1 <= value <= 10000
Default1
maxInstallments?integer

Só com CARD em methods.

Range1 <= value <= 12
expiresAt?string

Entre agora + 5 min e agora + 180 dias; ausente = sem vencimento.

Formatdate-time
customer?|

{ id } ou cliente inline; os dois juntos → VALIDATION.ONE_OF.

externalReference?string
Lengthlength <= 100
successUrl?string
Formaturi
Lengthlength <= 255
failureUrl?string
Formaturi
Lengthlength <= 255
metadata?

Até 20 chaves ^[A-Za-z0-9_.-]{1,40}$, valores string ≤ 500; devolvido tal qual.

Propertiesproperties <= 20

Response Body

Link criado (ou replay).

application/json
  1. response
id*string

ord_ + 28 caracteres.

Match^ord_
url*string

Checkout hospedado e anônimo, fora do host da API.

Formaturi
status*PaymentLinkStatus
Value in"ACTIVE""COMPLETED""EXPIRED""CANCELED"
amount*integer
Range100 <= value <= 100000000
currency*"BRL"

Único valor na v1.

Value in"BRL"
name*|
Lengthlength <= 255
description*|
Lengthlength <= 255
methods*array<>
Items1 <= items <= 3
maxPayments*integer

Sempre 1 com customer.

Range1 <= value <= 10000
paymentsCount*integer

Pode passar de maxPayments.

maxInstallments*|
Range1 <= value <= 12
expiresAt*|

null = sem vencimento.

Formatdate-time
customer*|null
externalReference*string

Única por merchant; gerada quando omitida.

Lengthlength <= 100
successUrl*|
Lengthlength <= 255
failureUrl*|
Lengthlength <= 255
metadata*|null
createdAt*string
Formatdate-time
updatedAt*string
Formatdate-time
Example Request
curl -X POST 'https://api.sandbox.kodano.com.br/v1/payment-links' \  -H 'X-Merchant-Id: mrc_0f8fad5bd9cb469fa16570867728950e' \  -H 'Idempotency-Key: 4b2e8c1a-9d7f-4e3b-a6c5-0f1e2d3c4b5a' \  -H 'X-Correlation-Id: erp-7f3a-0010' \  -H 'Content-Type: application/json' \  -d '{  "amount": 15990,  "currency": "BRL",  "name": "Plano anual",  "description": "Assinatura anual do plano Pro",  "methods": [    "PIX",    "CARD"  ],  "maxPayments": 1,  "maxInstallments": 3,  "expiresAt": "2026-10-23T13:00:00Z",  "customer": {    "id": "cus_8kQ2mZ7xW1pL4nR0"  },  "externalReference": "pedido-123",  "successUrl": "https://loja.example.com/obrigado",  "failureUrl": "https://loja.example.com/pagamento-falhou",  "metadata": {    "orderRef": "123"  }}'
Example Response
{  "id": "ord_2mK9xQ7vR4tL8nW1pZ6cY3bH5jD0",  "url": "https://pay.kodano.com.br/8b1f6c0e-3d2a-4f7b-9c1e-5a6d7e8f9a0b",  "status": "ACTIVE",  "amount": 15990,  "currency": "BRL",  "name": "Plano anual",  "description": "Assinatura anual do plano Pro",  "methods": [    "PIX",    "CARD"  ],  "maxPayments": 1,  "paymentsCount": 0,  "maxInstallments": 3,  "expiresAt": "2026-10-23T13:00:00Z",  "customer": {    "id": "cus_8kQ2mZ7xW1pL4nR0",    "name": "Ana Souza",    "document": "123******09"  },  "externalReference": "pedido-123",  "successUrl": "https://loja.example.com/obrigado",  "failureUrl": "https://loja.example.com/pagamento-falhou",  "metadata": {    "orderRef": "123"  },  "createdAt": "2026-10-16T13:00:00Z",  "updatedAt": "2026-10-16T13:00:00Z"}