Guides
Billing API (Cobranças)

Payment links

Create a link where the payer picks boleto or card, simulate the payer's choice and follow the charge.

A payment link is an Efí page where the payer fills in their data and picks how to pay. You create the charge with the link settings and get payment_url. The charge stays in link until the payer acts; then it follows the boleto or card statuses. Authentication and host are in Boleto and Bolix.

bash
curl --request POST \
  --url https://cobrancas.efi.mimicr.dev/v1/charge/one-step/link \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "items": [{ "name": "Meu Produto", "value": 5990, "amount": 1 }],
    "metadata": { "custom_id": "pedido-1042", "notification_url": "https://sua-app.dev/webhooks/efi" },
    "settings": {
      "payment_method": "all",
      "expire_at": "2026-10-31",
      "request_delivery_address": false,
      "message": "Obrigado pela compra",
      "billet_discount": 500
    }
  }'
json
{
  "code": 200,
  "data": {
    "charge_id": 1000008,
    "status": "link",
    "total": 5990,
    "custom_id": "pedido-1042",
    "payment_url": "https://cobrancas.efi.mimicr.dev/link/9121028d2156f677892d91f59681e0e2",
    "payment_method": "all",
    "billet_discount": 500,
    "card_discount": null,
    "conditional_discount_value": null,
    "conditional_discount_type": null,
    "conditional_discount_date": null,
    "request_delivery_address": false,
    "message": "Obrigado pela compra",
    "expire_at": "2026-10-31",
    "created_at": "2026-10-21 21:25:18"
  }
}
SettingRule
payment_methodbanking_billet, credit_card or all (required)
expire_atToday or later (required; otherwise 4600060 invalid_date)
request_delivery_addressBoolean (required)
message3 to 80 characters
billet_discount, card_discountDiscount in cents per payment method

Reference: Create a payment link.

For a charge that already exists in new, use Set a link on a charge with the settings at the top level of the body (no settings). A second call answers 3500080 link_already_defined.

payment_url opens a Mimicr page with the receiver, the total, the accepted methods and the expiry. While the status is link, you can:

3. Simulate the payer's choice

In Mimicr, the payer acts in the console or through the cobrancas.charge action:

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/efi/actions/cobrancas.charge \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "id": "1000008", "action": "link-boleto" }'
actionWhat happens
link-boletoThe payer generates the boleto: waiting, due in 3 days, with billet_discount taken off the total. Then use pagar as in Boleto and Bolix
link-cartaoThe payer pays with an approved card: waiting, approved and, a few seconds later, paid, with card_discount applied
link-cartao-recusadoThe card is refused (security reason): unpaid

The test payer is always "Francisco da Silva", CPF 12345678909. The chosen method must be in payment_method, and the link must be in link. If the card is refused, Efí advises creating a new charge and a new link.

With the CLI: npx mimicr action efi cobrancas.charge id=1000008 action=link-cartao.

4. Expiry

A link that reaches the day after expire_at unpaid goes to expired. Advance the sandbox clock to test it (see Sandbox control).

text
new ──link──▶ link ──link-boleto──▶ waiting ──pagar──▶ paid
                │ ├──link-cartao──▶ waiting ─▶ approved ─▶ paid
                │ └──link-cartao-recusado──▶ unpaid
                ├──expire_at passes──▶ expired
                └──cancel──▶ canceled

Charges created through a link don't accept Mark as paid (3500081), not even when paid by boleto.

The same mechanism serves subscriptions: see Subscriptions.