Guides
Billing API (Cobranças)

Plans and subscriptions

Create a plan, subscribe by boleto or card and generate the next cycles by advancing the clock or with an action.

A subscription charges the same amount every interval of a plan. Each cycle is its own charge (subscription_charge event), paid by boleto or card. Authentication and host are in Boleto and Bolix.

1. Create the plan

bash
curl --request POST \
  --url https://cobrancas.efi.mimicr.dev/v1/plan \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{ "name": "Plano Internet 10 Mb", "interval": 1, "repeats": 12 }'
json
{ "code": 200, "data": { "plan_id": 1018, "name": "Plano Internet 10 Mb", "interval": 1, "repeats": 12, "created_at": "2026-10-21 21:25:25" } }

interval is the number of months between charges (1 to 24) and repeats, how many charges will be generated (2 to 120; without it, unlimited). A plan with subscriptions can't be deleted (3500032). Reference: Create a plan, List plans.

2. Subscribe

By card, in one call:

bash
curl --request POST \
  --url https://cobrancas.efi.mimicr.dev/v1/plan/1018/subscription/one-step \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "items": [{ "name": "Internet", "value": 6990, "amount": 1 }],
    "metadata": { "custom_id": "assinante-9", "notification_url": "https://sua-app.dev/webhooks/efi" },
    "payment": {
      "credit_card": {
        "customer": { "name": "Gorbadoc Oldbuck", "cpf": "94271564656", "email": "oldbuck@efipay.com.br", "phone_number": "5144916523", "birth": "1977-01-15" },
        "billing_address": { "street": "Avenida Juscelino Kubitschek", "number": "909", "neighborhood": "Bauxita", "zipcode": "35400000", "city": "Ouro Preto", "state": "MG" },
        "payment_token": "<payment_token>"
      }
    }
  }'
json
{
  "code": 200,
  "data": {
    "subscription_id": 10019,
    "status": "active",
    "plan": { "id": 1018, "interval": 1, "repeats": 12 },
    "charge": { "id": 1000020, "status": "approved", "parcel": 1, "total": 6990 },
    "first_execution": "21/10/2026",
    "total": 6990,
    "payment": "credit_card"
  }
}
Card ruleError
installments always 13500021 invalid_installments
Payer with birth, email and phone_number3500034
trial_days from 1 to 365 (card only)3500034

The payment_token comes from the cobrancas.card_token action and follows the last-digit rule (see Credit card). With trial_days, the first date is trial_days days after the day following the subscription.

By boleto, use banking_billet instead of credit_card; the response carries the first charge's barcode, link, pdf and expire_at, and first_execution is the due date.

In two steps: Create a subscription (status new, first charge in new) and Set the subscription payment. With a payment link: Create a subscription link; the subscription stays new until the payer pays the link (see Payment links).

3. Follow it

bash
curl --url https://cobrancas.efi.mimicr.dev/v1/subscription/10019 \
  --header 'Authorization: Bearer <token>'
json
{
  "code": 200,
  "data": {
    "subscription_id": 10019,
    "value": 6990,
    "status": "active",
    "custom_id": "assinante-9",
    "notification_url": "https://sua-app.dev/webhooks/efi",
    "payment_method": "credit_card",
    "next_execution": "2026-11-21",
    "next_expire_at": "2026-11-21",
    "plan": { "plan_id": 1018, "name": "Plano Internet 10 Mb", "interval": 1, "repeats": 12 },
    "occurrences": 1,
    "created_at": "2026-10-21 21:25:26",
    "history": [{ "charge_id": 1000020, "status": "paid", "created_at": "2026-10-21 21:25:26" }]
  }
}

history lists the charges generated and occurrences counts the paid ones.

4. Generate the next cycles

On the next_execution date, Mimicr generates the next charge: by boleto, a new waiting boleto due on that date; by card, a charge analyzed right away with the same token. To avoid waiting a month, advance the sandbox clock or generate the cycle now:

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/efi/actions/cobrancas.subscription_next \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "id": "10019" }'

With the CLI: npx mimicr action efi cobrancas.subscription_next id=10019. When the last charge of repeats is generated, the subscription becomes expired. Boleto charges are paid with cobrancas.charge and action=pagar, by charge_id.

Cycles keep the same day of the month; if the first charge falls on the last day, the next ones stay on the last day of each month.

5. Update or cancel

ToUse
Change card, items, plan or payer data (card only, active)Update a card subscription
Cancel (new or active; otherwise 3500040)Cancel a subscription
Change custom_id or URL (subscription and charges)Update subscription metadata
Resend the charge linkResend the subscription link
text
new ──pay──▶ active ──cycles──▶ … ──last charge──▶ expired
  └──cancel──▶ canceled ◀──cancel── active

The subscription and its charges share the same notification token: subscription events (new, active, canceled, expired) and subscription_charge. See Notifications.