Recurring rent#

Create the agreement once, then raise an invoice per period. The tenant is already known and verified, so each month is a single API call and a link.

1. Create the agreement#

Do this at move-in - either implicitly, by taking the first payment through POST /sessions, or explicitly:

curl -X POST https://manage.casapay.com/api/v1/gateway/agreements \
  -H 'Authorization: Bearer sk_live_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "tenant": { "email": "tenant@example.com", "first_name": "Mari", "last_name": "Tamm" },
    "agreement_type": "ontime",
    "cover_amount": 800,
    "currency": "EUR"
  }'

Keep the returned numeric id against your tenancy record.

2. Raise a monthly invoice#

curl -X POST https://manage.casapay.com/api/v1/gateway/agreements/4821/invoice \
  -H 'Authorization: Bearer sk_live_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "amount": 650,
    "description": "April rent",
    "due_date": "2026-04-05",
    "reference_number": "2026-04-4821",
    "success_url": "https://your-app.com/done",
    "cancel_url": "https://your-app.com/cancelled"
  }'

Email the returned gateway_url to the tenant, or show it in your portal. These sessions never expire.

due_date drives your payout

For ontime agreements the operator payout is scheduled from due_date, so set it to the real rent due date rather than today.

3. Reconcile#

Listen for gateway.session.completed and match on invoice_id, or poll:

curl 'https://manage.casapay.com/api/v1/gateway/agreements/4821/invoices?status=unpaid' \
  -H 'Authorization: Bearer sk_live_...'

Filter by payout_status to see which collected months have actually reached your bank account.

Alternative: email the PDF#

Every agreement has an email_alias. Forward a rent or supplier invoice PDF to it and CasaPay parses the amount, due date and reference, creates the invoice, and emails the tenant a checkout link - no API call at all. Useful when your accounting system already produces PDFs.

Handling non-payment#

  • The invoice stays unpaid and the session stays open, so the tenant can pay late on the original link.
  • With ontime or cover you are still paid on schedule; CasaPay carries the risk.
  • Cancel an invoice only while it is unpaid and its payout is still pending.