Getting started

Recurring billing

Automate monthly invoices and collect recurring payments from your application.

How recurring billing works#

Manza does not auto-charge stored cards. Your application owns the subscription, billing dates and reminders; the customer authorizes a new payment each period. This guide covers collecting subscription payments, not scheduling outgoing transfers.

  1. Run a scheduled job in your application on each billing date.
  2. Create a fresh single-use link with POST /api/payment_links. Use an open account belonging to your entity, and supply the amount and a payment_reference for the billing period.
  3. Store the returned link ID against that subscription and period before delivering it.
  4. Email or message the returned url to the customer from your application.
  5. Confirm payment through payment_link.paid, then renew access once for that period.

Use a key with payment_links:write to create links and payment_links:read to reconcile them. See Payment links for request examples, required fields and the deployment's minimum amount. Reusable links accept multiple payments; they do not schedule payments or charge cards automatically.

Fixed monthly subscriptions#

Your application owns the subscription schedule. The API creates individual invoices; it does not create a recurring invoice schedule or a subscription you can cancel. For a customer paying the same amount each month:

  1. Create the customer once with POST /api/customers and store its ID.
  2. Store the agreed line items, amount and billing day in your application.
  3. Each month, call POST /api/invoices with the same customer_id and line items, updated issue_date and due_date, and a reference identifying the billing period.
  4. Use invoices:write and invoices:auto_approve to issue each invoice without monthly manual approval. Include send_to_email to queue the invoice email.
  5. Store the returned invoice ID against the subscription and billing period. When the subscription ends, stop future creation jobs in your application.

For example, Ruby can build the period reference as "club-#{club_id}-#{billing_month}".

Auto-approval is an API-key permission, not an approved=true request parameter. It is not restricted to a fixed amount or a particular agreement: your integration must enforce those rules. A sent status means the invoice email was queued. It does not mean the email was delivered or that the customer has paid. Without send_to_email no email is queued, and the invoice is created approved with "sent_at": null. It can still be paid through a payment link, when it has one, or a matched bank transfer, be marked as paid, and become overdue.

For issuer logo setup and safe retries, see Recurring invoices and branding.

Automate invoice approval#

For an invoice each period, use POST /api/invoices with invoices:write and invoices:auto_approve. Supply the customer, issue and due dates, and line items described in Create invoice. Create customers first with customers:write if needed.

With send_to_email set, the response is already sent: Manza approves the invoice and queues its email in the create request. Do not call POST /api/invoices/:id/send again for this path. Without send_to_email the response is approved, with its number and "sent_at": null: the invoice is issued, and nothing was emailed.

This scope bypasses the entity's approval rules, including multi-approval requirements. Grant it only to an integration trusted to issue invoices without a human decision.

To add a card-payment link, set "generate_payment_link": true on create. The invoice needs its bank account (account_id) and the key needs payment_links:write. Manza makes the link while it approves the invoice, for the invoice's total and into its account, so the invoice email queued by send_to_email already includes it. The response carries the link in payment_link. See Payment links for invoices.

Keep dashboard approval#

If invoices need human review, use a key without invoices:auto_approve:

  1. Create the invoice with POST /api/invoices and invoices:write. It starts in pending_approval with no number yet: the number is given at approval, so read it back with GET /api/invoices/:id after step 2. Set send_to_email to the customer's email. For a card-payment link, also set "generate_payment_link": true; the invoice needs its bank account (account_id) and the key needs payment_links:write.
  2. A member completes Approve & Send in the dashboard (Invoicing → Invoices). Once the approval requirements are met, Manza makes the payment link, sends the invoice and queues its email, which includes the link. Do not send it again through the API.
  3. Only if an invoice is still approved, use POST /api/invoices/:id/send with invoices:send. Check its current status first.

There is no public invoice-approve API endpoint. See Approval before send for both paths.

Confirm each renewal#

Verify the webhook signature and deduplicate deliveries using X-Manza-Event-Id. Match the payment link ID to the subscription and billing period you stored. Mark that period paid and extend access only once.

payment_link.paid confirms the customer's payment; the link can still be clearing while funds settle. If your service must wait for money to land, use payment_link.payment_settled instead. A browser redirect alone is not proof of payment. See Webhooks for verification and retry behavior.

Reconcile with GET /api/payment_links/:id, including its status and settled_at, if delivery is delayed or your integration needs to recover after an outage.

Retries, reminders and cancellation#

Keep one billing record per subscription and period in your own database and prevent concurrent jobs from creating duplicate requests. payment_reference is a reconciliation label, not an idempotency guarantee; the same applies to an invoice's reference. If creation times out, reconcile the result before creating another invoice or link.

Send reminders for the existing unpaid link rather than creating a new charge each time. If a link expires, reconcile its payment state before issuing a replacement. Stop future billing jobs when a subscription is cancelled; cancel an outstanding active link with POST /api/payment_links/:id/cancel when appropriate. Cancelling a link does not cancel an associated invoice or reverse an earlier payment.