Criar um link de pagamento
Crie uma URL de checkout hospedada pela Therius para um pagamento único ou uma assinatura. De uso único por padrão, ou reutilizável com um limite opcional.
POST /payment-link cria uma página de checkout hospedada que você pode enviar ao pagador por e-mail, chat ou QR code, sem integrar o SDK. A resposta contém a url para compartilhar.
Tipos de link
- Pagamento único, valor fixo — você define
amount(amountMode: "fixed", o padrão). Use para faturas e passagens. - Pagamento único, valor informado pelo pagador — defina
amountMode: "customer_entered"e umacurrency. O pagador digita o valor, opcionalmente limitado poramountMineamountMax(unidades menores). - Assinatura — defina
type: "subscription"e umsubscriptionPlanId. O plano define o preço. Se você omitirsubscriptionPlanId, o pagador escolhe entre seus planos ativos. Não envieamountem links de assinatura.
Links de uso único e reutilizáveis
Por padrão um link é de uso único: ele passa paraused após o primeiro pagamento bem-sucedido. Tentativas que falham não o consomem, então o pagador pode tentar de novo.
Defina reusable: true para aceitar vários pagamentos. Adicione maxUses para limitar a quantidade de pagamentos bem-sucedidos; o link passa para used ao atingir o limite. Sem maxUses, um link reutilizável permanece active até expirar ou até você cancelá-lo. maxUses exige reusable: true, e links de assinatura não podem ser reutilizáveis.
Ambiente e validade
Um link assume o ambiente da chave que o criou: chavesprv_sandbox_ criam links de sandbox e chaves prv_production_ criam links de produção. Os links expiram em 7 dias, a menos que você defina expiresInDays (1–365) ou expiresAt (YYYY-MM-DD, fim desse dia em UTC).
Referência e URL de retorno
reference é o seu próprio identificador (por exemplo, o número de uma fatura). Ele vira o orderCode do pagamento resultante. returnUrl deve ser uma URL https (em sandbox http é aceito).
Exemplo
Idempotency-Key para que uma requisição repetida retorne o link original em vez de criar um segundo. Veja Idempotência.Autorizações
Your secret API key: Bearer prv_production_xxx (production) or Bearer prv_sandbox_xxx (sandbox).
Cabeçalhos
A UUID you generate per operation. Required in production. Retrying with the same key returns the original response.
Corpo
one-time, subscription Your merchant account identifier. Required if the key maps to more than one merchant account.
One-time links only.
fixed, customer_entered Required for one-time links. value is required when amountMode is fixed; for customer_entered only currency is needed. Not allowed on subscription links.
customer_entered only. Minimum amount the payer may enter, minor units.
customer_entered only. Maximum amount the payer may enter, minor units.
Subscription links only. Omit to let the payer choose among your active plans.
Checkout Builder configuration to style the page.
2552000Your own reference (invoice number, PNR). It becomes the orderCode of the resulting payment.
128Where to send the payer after paying. Must be https (sandbox also allows http).
1 <= x <= 365Expiry date, YYYY-MM-DD (end of that day, UTC). Takes precedence over expiresInDays.
Accept many payments instead of one. One-time links only.
Cap on successful payments for a reusable link. Requires reusable: true.
x >= 1Resposta
Payment link created
The hosted checkout URL to share with the payer.
one-time, subscription used once a single-use link takes its first successful payment, or a reusable link reaches maxUses.
active, used, expired, cancelled fixed, customer_entered Absent on subscription links. For customer_entered links only currency and exponent are set.
Minimum payer-entered amount, minor units.
Maximum payer-entered amount, minor units.
Number of successful payments taken through this link.
production, sandbox 
