{"openapi":"3.1.0","info":{"title":"Sesalin Pay API","version":"1.0.0","description":"Receber pagamentos Multicaixa Express (EMIS) através da Sesalin. Valores sempre em cêntimos de kwanza (AOA). Guia: /docs"},"servers":[{"url":"https://api.pay.sesalin.com"}],"security":[{"chave":[]}],"components":{"securitySchemes":{"chave":{"type":"http","scheme":"bearer","description":"Chave secreta sk_test_… (teste) ou sk_live_… (produção). Nunca no browser nem na app móvel."}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["type","code","message"],"properties":{"type":{"enum":["invalid_request_error","authentication_error","permission_error","idempotency_error","rate_limit_error","api_error","not_found"]},"code":{"type":"string","examples":["parameter_invalid","return_url_not_allowed","amount_too_small","reference_in_use","idempotency_key_reused","rate_limited"]},"message":{"type":"string"},"param":{"type":"string"}}}}},"CreatePayment":{"type":"object","additionalProperties":false,"required":["amount"],"anyOf":[{"required":["reference"]},{"required":["merchant_reference"]}],"properties":{"reference":{"type":"string","minLength":1,"maxLength":100,"description":"O seu número de encomenda. A mesma referência devolve o mesmo pagamento (sem duplicados); outro valor → 409 reference_in_use."},"amount":{"type":"integer","minimum":10000,"maximum":100000000000,"description":"Cêntimos de AOA (1250000 = 12 500,00 Kz). Mínimo 100 Kz."},"currency":{"const":"AOA","default":"AOA"},"merchant_reference":{"type":"string","minLength":1,"maxLength":100,"description":"Nome antigo de reference (envie só um dos dois)."},"description":{"type":"string","maxLength":500,"description":"Aparece na página de pagamento."},"return_url":{"type":"string","format":"uri","maxLength":2000,"description":"Opcional. https (num domínio autorizado, se a sua conta tiver a lista). Recebe ?payment_id=…&status=… — NÃO é prova de pagamento. Sem ele, o checkout termina na página da Sesalin."},"metadata":{"type":"object","maxProperties":20,"additionalProperties":{"type":"string","maxLength":500},"propertyNames":{"maxLength":40}}}},"Payment":{"type":"object","properties":{"id":{"type":"string","pattern":"^pay_[a-z0-9]{24}$"},"object":{"const":"payment"},"status":{"enum":["created","processing","succeeded","failed","expired","unconfirmed"],"description":"unconfirmed NÃO é final: pode vir a ser succeeded (late_capture) ou failed (not_settled)."},"amount":{"type":"integer"},"currency":{"const":"AOA"},"fee_amount":{"type":"integer","description":"Comissão Sesalin (cêntimos)."},"vat_amount":{"type":"integer","description":"IVA sobre a comissão."},"net_amount":{"type":"integer","description":"O que lhe é repassado."},"merchant_reference":{"type":"string"},"description":{"type":["string","null"]},"metadata":{"type":"object","additionalProperties":{"type":"string"}},"emis_reference":{"type":["string","null"],"description":"Referência SP… enviada à EMIS (útil para o cliente reclamar)."},"late_capture":{"type":"boolean"},"failure_reason":{"type":["string","null"]},"livemode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"paid_at":{"type":["string","null"],"format":"date-time"},"unconfirmed_until":{"type":["string","null"],"format":"date-time"},"checkout_url":{"type":"string","format":"uri","description":"Redireccione o cliente para aqui."},"amount_refunded":{"type":"integer","description":"Soma das devoluções não canceladas (cêntimos)."},"payment_link":{"type":["string","null"],"description":"O link de pagamento (pl_…) que criou este pagamento, ou null."},"customer":{"type":["object","null"],"description":"Dados que o cliente indicou na página do link reutilizável.","properties":{"name":{"type":["string","null"]},"phone":{"type":["string","null"]},"email":{"type":["string","null"]}}},"link_overpaid":{"type":"boolean","description":"true quando a EMIS capturou tarde um pagamento de um link que já estava pago ou esgotado: devolva-o."}}},"Balance":{"type":"object","properties":{"object":{"const":"balance"},"currency":{"const":"AOA"},"livemode":{"type":"boolean"},"pending":{"type":"integer","description":"Pago, ainda a liquidar ou na reserva."},"available":{"type":"integer","description":"Entra no próximo repasse."},"in_payout":{"type":"integer"}}},"Payout":{"type":"object","properties":{"id":{"type":"string","pattern":"^po_[a-z0-9]{24}$"},"object":{"const":"payout"},"status":{"enum":["pending","paid","failed"]},"amount":{"type":"integer"},"currency":{"const":"AOA"},"iban_last4":{"type":"string"},"paid_at":{"type":["string","null"],"format":"date-time"},"failure_reason":{"type":["string","null"]},"created_at":{"type":"string","format":"date-time"}}},"Refund":{"type":"object","properties":{"id":{"type":"string","pattern":"^re_[a-z0-9]{24}$"},"object":{"const":"refund"},"payment":{"type":"string","pattern":"^pay_[a-z0-9]{24}$"},"amount":{"type":"integer"},"currency":{"const":"AOA"},"status":{"enum":["awaiting_customer","pending","in_payout","paid","failed","cancelled"],"description":"awaiting_customer: à espera de o cliente indicar o IBAN no customer_url. pending: na fila do próximo lote. in_payout: transferência em curso. failed: a transferência falhou — o cliente pode corrigir o IBAN pelo mesmo link."},"reason":{"type":["string","null"]},"customer_iban_last4":{"type":["string","null"]},"failure_reason":{"type":["string","null"]},"customer_url":{"type":["string","null"],"format":"uri","description":"Envie este link ao cliente (WhatsApp, e-mail…): é lá que ele indica o IBAN. Só presente enquanto o cliente pode preencher."},"livemode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"},"paid_at":{"type":["string","null"],"format":"date-time"}}},"CreateRefund":{"type":"object","additionalProperties":false,"required":["payment"],"properties":{"payment":{"type":"string","pattern":"^pay_[a-z0-9]{24}$","description":"O pagamento a devolver (tem de estar pago e liquidado pela EMIS)."},"amount":{"type":"integer","minimum":100,"description":"Cêntimos. Sem ele, devolve o que falta, até ao seu saldo disponível."},"reason":{"type":"string","maxLength":500,"description":"Aparece ao cliente."},"reference":{"type":"string","maxLength":100,"description":"O id da devolução no seu sistema: repetir com a mesma reference devolve a mesma devolução."}}},"PaymentLink":{"type":"object","properties":{"id":{"type":"string","pattern":"^pl_[a-z0-9]{24}$"},"object":{"const":"payment_link"},"url":{"type":"string","format":"uri","description":"O link a enviar ao cliente (pay.sesalin.com/l/…)."},"type":{"enum":["single","reusable"],"description":"single: cobrança única, paga-se uma vez. reusable: paga quem quiser (pede nome e telefone)."},"title":{"type":"string"},"description":{"type":["string","null"]},"amount":{"type":["integer","null"],"description":"Valor fixo (cêntimos)."},"min_amount":{"type":["integer","null"]},"max_amount":{"type":["integer","null"],"description":"Valor à escolha do cliente, entre min_amount e max_amount."},"max_payments":{"type":["integer","null"]},"currency":{"const":"AOA"},"expires_at":{"type":["string","null"],"format":"date-time"},"status":{"enum":["active","inactive","completed","expired"]},"payments_count":{"type":"integer"},"amount_collected":{"type":"integer","description":"Soma dos pagamentos pagos (cêntimos)."},"livemode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"deactivated_at":{"type":["string","null"],"format":"date-time"}}},"CreatePaymentLink":{"type":"object","additionalProperties":false,"required":["type","title"],"properties":{"type":{"enum":["single","reusable"]},"title":{"type":"string","maxLength":100},"description":{"type":"string","maxLength":500},"amount":{"type":"integer","minimum":10000,"description":"Cêntimos. Obrigatório em single; em reusable, ou amount ou min_amount+max_amount."},"min_amount":{"type":"integer","minimum":10000},"max_amount":{"type":"integer","minimum":10000},"max_payments":{"type":"integer","minimum":1,"description":"Só em reusable."},"expires_at":{"type":"string","format":"date-time","description":"Opcional; até um ano."}}},"Event":{"type":"object","properties":{"id":{"type":"string","pattern":"^evt_[a-z0-9]{24}$"},"object":{"const":"event"},"type":{"enum":["payment.succeeded","payment.failed","payment.expired","payment.unconfirmed","payout.paid","payout.failed","refund.paid","refund.failed"]},"livemode":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"data":{"type":"object","properties":{"object":{"oneOf":[{"$ref":"#/components/schemas/Payment"},{"$ref":"#/components/schemas/Payout"},{"$ref":"#/components/schemas/Refund"}]}}}}}}},"paths":{"/v1/payments":{"post":{"operationId":"createPayment","summary":"Criar um pagamento","description":"Âmbito payments:write. Devolve checkout_url para onde redireccionar o cliente. A comissão é calculada pelo Sesalin Pay.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":255},"description":"Opcional (sem ela, a reference protege das repetições). Repetir com a mesma chave e o mesmo corpo devolve o mesmo pagamento; com outro corpo → 409. Válida 24 h."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePayment"},"example":{"amount":1250000,"reference":"PED-1234","description":"Encomenda 1234","return_url":"https://loja.exemplo.ao/obrigado","metadata":{"cliente":"8812"}}}}},"responses":{"201":{"description":"Pagamento criado (ou o mesmo, se a reference ou a Idempotency-Key se repetirem).","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"400":{"description":"Pedido inválido (ver error.code e error.param).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"reference_in_use (a referência já tem um pagamento com outro valor) ou idempotency_key_reused.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}},"get":{"operationId":"listPayments","summary":"Listar pagamentos","description":"Âmbito payments:read. Do mais recente para o mais antigo.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"starting_after","in":"query","schema":{"type":"string"},"description":"id do último pagamento da página anterior."},{"name":"status","in":"query","schema":{"enum":["created","processing","succeeded","failed","expired","unconfirmed"]}},{"name":"merchant_reference","in":"query","schema":{"type":"string"}},{"name":"payment_link","in":"query","schema":{"type":"string","pattern":"^pl_[a-z0-9]{24}$"},"description":"Só os pagamentos deste link."}],"responses":{"200":{"description":"Página de pagamentos.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Payment"}},"has_more":{"type":"boolean"}}}}}},"400":{"description":"Parâmetro inválido.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/payments/{id}":{"get":{"operationId":"getPayment","summary":"Obter um pagamento","description":"Âmbito payments:read. Use isto (ou o webhook) para confirmar um pagamento — nunca o return_url.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^pay_[a-z0-9]{24}$"}}],"responses":{"200":{"description":"O pagamento.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Payment"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe (ou é de outra conta/modo).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/refunds":{"post":{"operationId":"createRefund","summary":"Devolver um pagamento (total ou parcial)","description":"Âmbito payments:write. Só pagamentos pagos e já liquidados pela EMIS, e só até ao seu saldo disponível (a comissão da Sesalin não é devolvida). A resposta traz customer_url: envie-o ao cliente para ele indicar o IBAN; a Sesalin transfere no próximo lote. Repetições: Idempotency-Key ou reference; sem nenhum dos dois cada pedido cria uma devolução nova.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRefund"},"example":{"payment":"pay_0zs3s5rcdimosfc06yuw55q6","amount":250000,"reason":"Artigo devolvido","reference":"DEV-1234"}}}},"responses":{"201":{"description":"Devolução criada (ou a mesma, se a reference/Idempotency-Key se repetir).","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Refund"}}}},"400":{"description":"payment_not_settled, insufficient_balance, amount_exceeds_payment, fully_refunded, refund_window_expired…","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Pagamento não encontrado.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"reference_in_use.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}},"get":{"operationId":"listRefunds","summary":"Listar devoluções","description":"Âmbito payments:read.","parameters":[{"name":"payment","in":"query","schema":{"type":"string","pattern":"^pay_[a-z0-9]{24}$"}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}}],"responses":{"200":{"description":"Devoluções.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Refund"}},"has_more":{"type":"boolean"}}}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/refunds/{id}":{"get":{"operationId":"getRefund","summary":"Obter uma devolução","description":"Âmbito payments:read.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^re_[a-z0-9]{24}$"}}],"responses":{"200":{"description":"A devolução.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Refund"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/refunds/{id}/cancel":{"post":{"operationId":"cancelRefund","summary":"Cancelar uma devolução","description":"Âmbito payments:write. Só antes de entrar num lote (awaiting_customer, pending ou failed); o valor volta ao seu saldo.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^re_[a-z0-9]{24}$"}}],"responses":{"200":{"description":"Cancelada.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Refund"}}}},"400":{"description":"refund_not_cancellable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/payment_links":{"post":{"operationId":"createPaymentLink","summary":"Criar um link de pagamento","description":"Âmbito payments:write. Devolve url: envie-o ao cliente. Cada cliente que paga cria um pagamento normal (com payment_link e customer). Idempotency-Key aceite.","parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"type":"string","minLength":1,"maxLength":255}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentLink"},"example":{"type":"reusable","title":"Consulta de nutrição","amount":1500000}}}},"responses":{"201":{"description":"Link criado.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLink"}}}},"400":{"description":"parameter_invalid, amount_too_small (o valor não cobre a comissão; a mensagem diz o mínimo), livemode_not_allowed…","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}},"get":{"operationId":"listPaymentLinks","summary":"Listar links de pagamento","description":"Âmbito payments:read.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}},{"name":"starting_after","in":"query","schema":{"type":"string","pattern":"^pl_[a-z0-9]{24}$"}}],"responses":{"200":{"description":"Links.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/PaymentLink"}},"has_more":{"type":"boolean"}}}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/payment_links/{id}":{"get":{"operationId":"getPaymentLink","summary":"Obter um link de pagamento","description":"Âmbito payments:read. Os pagamentos do link: GET /v1/payments?payment_link=pl_…","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^pl_[a-z0-9]{24}$"}}],"responses":{"200":{"description":"O link.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLink"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/payment_links/{id}/deactivate":{"post":{"operationId":"deactivatePaymentLink","summary":"Desactivar um link de pagamento","description":"Âmbito payments:write. Deixa de aceitar pagamentos novos; um pagamento já em curso conclui-se. Idempotente; não se reactiva.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^pl_[a-z0-9]{24}$"}}],"responses":{"200":{"description":"Desactivado.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLink"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/balance":{"get":{"operationId":"getBalance","summary":"Saldo","description":"Âmbito balance:read. Do modo da chave (teste ou produção).","responses":{"200":{"description":"Saldo.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Balance"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/payouts":{"get":{"operationId":"listPayouts","summary":"Repasses","description":"Âmbito payouts:read. Os 100 mais recentes.","responses":{"200":{"description":"Repasses.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Payout"}},"has_more":{"type":"boolean"}}}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/events":{"get":{"operationId":"listEvents","summary":"Eventos","description":"Âmbito events:read. Os mesmos eventos dos webhooks — útil para recuperar algum perdido.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":20}}],"responses":{"200":{"description":"Eventos.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"type":"object","required":["object","data","has_more"],"properties":{"object":{"const":"list"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"has_more":{"type":"boolean"}}}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}},"/v1/events/{id}":{"get":{"operationId":"getEvent","summary":"Obter um evento","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^evt_[a-z0-9]{24}$"}}],"responses":{"200":{"description":"O evento.","headers":{"RateLimit-Limit":{"schema":{"type":"integer"}},"RateLimit-Remaining":{"schema":{"type":"integer"}},"RateLimit-Reset":{"schema":{"type":"integer"},"description":"segundos até a janela recomeçar"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"401":{"description":"Chave de API em falta, inválida, revogada ou expirada.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"A chave não tem o âmbito necessário, ou o comerciante não está activo.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Não existe.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Demasiados pedidos. Respeitar o cabeçalho Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}},"headers":{"Retry-After":{"schema":{"type":"integer"}}}}}}}},"webhooks":{"evento":{"post":{"summary":"Notificação de evento (para o URL configurado pela Sesalin)","description":"Cabeçalhos: Sesalin-Event-Id e Sesalin-Signature: t=<segundos>,v1=<hex HMAC-SHA256(segredo whsec_…, t + \".\" + corpo cru)>. Recusar se |agora − t| > 300 s. Responder 2xx em até 10 s; sem 2xx repete-se durante 3 dias. Pode chegar repetido: usar Sesalin-Event-Id para não processar duas vezes.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Event"}}}},"responses":{"200":{"description":"Recebido."}}}}}}