Skip to Content

Recurring billing

Issue an invoice automatically every period for each subscribed customer.

Recurring billing issues an invoice to a customer every day, week or month. Each invoice is an ordinary payment with its own payment page. The customer pays each one by hand with QRIS or a VA. There is no auto-debit and no stored card.

There are three objects:

  • Plan (plan_...): an amount and a period, for example Rp150,000 every month.
  • Subscription (sub_...): one customer on one plan, with a start and an end.
  • Invoice: the payment we issue for each period of a subscription.

The flow: create a plan once, add a subscription per customer, and every period we issue an invoice and send an invoice.created webhook. You send that invoice's checkout_url to the customer. When it is paid you get payment.paid, as for any payment.

Plans and subscriptions belong to one app and one mode. An API key sees only its app's plans and subscriptions. The dashboard sees all apps.

In the dashboard

Open Tagihan in the dashboard. It has three tabs: Sekali bayar (one-off invoices), Berulang (subscriptions) and Paket (plans).

Create a plan

On the Paket tab, click Buat paket. Enter the plan name, the amount per invoice, how often to bill, the payment method (customer picks, QRIS only, or one bank's VA only) and how long each invoice stays payable (1, 3, 7, 14 or 30 days).

Add a subscription

On the Berulang tab, click Tambah langganan. Pick the plan and enter the customer's name (required), WhatsApp, email and reference (optional). Set the schedule: start now or on a date, and end when cancelled, after a number of invoices, or on a date.

Send the invoice

If the subscription starts now, the first invoice is made at once and the dashboard shows its link and a WhatsApp message for the customer. Later invoices are on the subscription's page, each with a button to send it.

On a subscription's page you can Jeda (pause), Lanjutkan (resume) or Batalkan (cancel). On the Paket tab you can switch a plan on or off.

We don't send invoices by email or WhatsApp ourselves. You send the link, from the dashboard or from your system when invoice.created arrives.

Through the API

All endpoints are under /v1/billing/.... Every POST that creates a plan or subscription needs an Idempotency-Key header (see Idempotency).

1. Create a plan

POST /v1/billing/plans
curl https://pay.piti.id/v1/billing/plans \
  -H "Authorization: Bearer lbp_test_xxxxxxxx" \
  -H "Idempotency-Key: plan-internet-20" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Internet 20 Mbps",
    "amount": 150000,
    "interval": { "unit": "month", "count": 1 }
  }'
FieldRules
nameRequired, up to 100 characters.
amountRequired. Whole rupiah per period, Rp1,000 to Rp50,000,000. QRIS up to Rp10,000,000; a VA from Rp10,000.
intervalRequired. unit: day, week or month. count: 1 to 366, default 1. For example {"unit": "week", "count": 2} is every 2 weeks.
methodany (default: the customer picks among the app's switched-on methods), qris, or va with va_bank.
va_bankFor method: "va": mandiri, bri, bni, bsi, cimb, permata, maybank or danamon.
expires_inSeconds each invoice stays payable: 3,600 (1 hour) to 2,592,000 (30 days). Default 604,800 (7 days).
metadataAny object.

The answer is 201 with the plan. See Create a plan.

2. Add a subscription

POST /v1/billing/subscriptions
curl https://pay.piti.id/v1/billing/subscriptions \
  -H "Authorization: Bearer lbp_test_xxxxxxxx" \
  -H "Idempotency-Key: sub-cust-0042" \
  -H "Content-Type: application/json" \
  -d '{
    "plan_id": "plan_xxxxxxxx",
    "customer_name": "Budi Santoso",
    "customer_phone": "0812xxxxxxx",
    "reference": "CUST-0042",
    "cycles": 12
  }'
FieldRules
plan_idRequired. The plan must be on, or you get 409 plan_inactive.
customer_nameRequired, up to 120 characters. Shown on the payment page and the VA.
customer_emailOptional, up to 120 characters.
customer_phoneOptional, up to 40 characters.
referenceOptional, up to 50 characters. Your customer's id. Each invoice's reference is <reference>-<period number>, for example CUST-0042-3. Without a reference, the subscription id is used.
start_atOptional. When the first period starts, at most a year ahead. Empty (or a time already past, up to 24 hours back) means now.
cyclesOptional, 1 to 1,000. Stop after this many invoices.
end_atOptional. No invoice for a period that starts at or after this time.
metadataOptional. Copied to every invoice.

The answer is 201 with the subscription and first_invoice:

  • Starting now: first_invoice is the first invoice. Send its checkout_url to the customer.
  • Starting later (start_at in the future, for example after a trial): first_invoice is null, and the first invoice is issued at start_at.
Answer (shortened)
{
  "id": "sub_xxxxxxxx",
  "object": "subscription",
  "plan_id": "plan_xxxxxxxx",
  "plan": { "id": "plan_xxxxxxxx", "name": "Internet 20 Mbps", "amount": 150000, "active": true,
            "interval": { "unit": "month", "count": 1 }, "method": "any", "va_bank": null },
  "status": "active",
  "customer": { "name": "Budi Santoso", "phone": "0812xxxxxxx" },
  "reference": "CUST-0042",
  "start_at": "2026-11-30T03:00:00Z",
  "cycles": 12,
  "end_at": null,
  "invoices_issued": 1,
  "next_invoice_at": "2026-12-30T03:00:00Z",
  "first_invoice": {
    "id": "pay_xxxxxxxx",
    "object": "payment",
    "reference": "CUST-0042-1",
    "description": "Internet 20 Mbps · periode 1",
    "method": "any",
    "status": "pending",
    "amount": 150000,
    "checkout_url": "https://pay.piti.id/pay/pay_xxxxxxxx",
    "source": "subscription",
    "subscription": { "id": "sub_xxxxxxxx", "cycle": 1,
                      "period_start": "2026-11-30T03:00:00Z", "period_end": "2026-12-30T03:00:00Z" }
  }
}

See Add a subscription for the full object.

Other endpoints

GET /v1/billing/plansList plans, newest first. Filter with active=true or false.
GET /v1/billing/plans/{id}One plan.
PATCH /v1/billing/plans/{id}Change name, or switch it on and off with active.
GET /v1/billing/subscriptionsList subscriptions, newest first. Filter with status and plan_id.
GET /v1/billing/subscriptions/{id}One subscription with its latest 50 invoices (invoices, newest first).
POST /v1/billing/subscriptions/{id}/pausePause.
POST /v1/billing/subscriptions/{id}/resumeResume.
POST /v1/billing/subscriptions/{id}/cancelCancel.

Lists take limit (1 to 100, default 20) and starting_after (the last id of the previous page).

The invoice for each period

Each invoice is a payment with:

  • source: "subscription" and method: "any". If the plan uses qris or va, that is the only method the customer can pick.
  • reference: <subscription reference or id>-<period number>.
  • description: <plan name> · periode <number>.
  • customer and metadata from the subscription.
  • subscription: {id, cycle, period_start, period_end}. A payment that is not a recurring invoice has subscription: null.

The fee, and who pays it, follow the app's method settings when the customer picks, as for any payment.

Schedule

  • Periods are counted in WIB from the subscription's start, including its time of day.
  • Monthly periods keep the start's day. In a shorter month, the month's last day is used: 31 Jan → 28 Feb → 31 Mar.
  • An invoice is issued when its period starts. next_invoice_at says when the next one is issued.
  • No back-billing. A period that passes with no invoice (while the subscription is paused or the plan is off) is not billed later. Period numbers keep counting, so there can be a gap (1, 2, 4).
  • Each period is invoiced once, even when something is retried.

How long an invoice is payable

An invoice can be paid for the plan's expires_in (default 7 days), then it expires (payment.expired).

  • For QRIS, the QR code is renewed while the invoice is open.
  • A VA is made when the customer picks it, for the invoice's remaining time.
  • A payment that still arrives after expiry is booked as paid with paid_late: true.

There are no reminders, retries or automatic cancellation when an invoice is not paid.

Subscription statuses

StatusMeaning
activeAn invoice is issued every period.
pausedNo new invoices until resumed.
cancelledCancelled. Final.
completedThe last invoice is issued (cycles reached or end_at passed). Final.
  • Pause (active → paused): no invoices while paused.
  • Resume (paused → active): the next invoice is issued at the start of the next period after now. Periods while paused are not billed. Example: a monthly subscription started 1 Jan, paused 15 Jan, resumed 10 Mar: the next invoice is issued 1 Apr. If that period is past end_at, the subscription becomes completed at once.
  • Cancel (active or paused → cancelled): no new invoices, and it cannot be turned back on.
  • An action that doesn't fit the current status gets 409 with a code naming that status: subscription_active, subscription_paused, subscription_cancelled or subscription_completed.

Pausing, cancelling or completing a subscription doesn't change invoices already issued. They stay payable until they expire, and can be refunded like any payment.

cycles counts invoices actually issued. To change the plan or the amount, cancel the subscription and create a new one.

When a plan is switched off

With PATCH /v1/billing/plans/{id} and {"active": false} (or on the Paket tab):

  • Existing subscriptions stay active, with plan.active: false. While the plan is off, their periods pass with no invoice and are not billed later.
  • When the plan is switched on again, invoicing continues from the next period.
  • New subscriptions to a switched-off plan are refused with 409 plan_inactive.

When an app is switched off

When an app is switched off in Developer:

  • Existing subscriptions keep being invoiced every period, so no period is lost.
  • Its webhooks, invoice.created included, are held and sent in order once the app is on again.
  • The app's API keys get 403 app_disabled. The dashboard can't create new plans or subscriptions for it (409 app_disabled).
  • Invoices already issued stay payable.

Webhooks

Eventdata
invoice.createdThe invoice: a payment with subscription. Also sent for the first invoice.
subscription.pausedThe subscription.
subscription.resumedThe subscription.
subscription.cancelledThe subscription.
subscription.completedThe subscription.

After that, each invoice sends payment.paid or payment.expired like any payment. Changes made in the dashboard send events too, so your system can follow them all. See Webhooks.

Handling invoice.created
if (event.type === 'invoice.created') {
  const invoice = event.data;
  // invoice.subscription.id, invoice.subscription.cycle, invoice.checkout_url
  await sendToCustomer(invoice.customer, invoice.checkout_url);
}

Not available yet

  • Sending invoices by email or WhatsApp from our side.
  • Reminders, retries and auto-debit.
  • Changing a subscription (another plan or amount): cancel it and create a new one.