Company invoices

Pay a MagicDoor invoice

Pays an outstanding MagicDoor invoice from one of the company's payment accounts and returns the invoice as it now stands. The caller's IP address is taken from the request and recorded with the payment authorisation.

POST
https://api.portal.magicdoor.com/company-app/invoices/{billId}/pay

Authorization

Authorizationstringrequired
Bearer token — Send your API token in the Authorization header as Bearer <token>. Requests without a valid token are rejected with 401 Unauthorized.

Path parameters

billIdstringrequired

The invoice to pay. A Snowflake id sent as a decimal string.

example: 1833110447398404096

Body

application/json

Name the account to pay from. Both id fields are optional on the wire; leaving both out falls back to whatever the company's billing setup nominates.

paymentAccountIdstring

The company payment account to pay from, from the company payment accounts list.

paymentMethodIdstring

The payment method to pay with, when the account offers more than one.

idempotencyKeystring

A key you choose so that retrying the same request does not charge twice. 5 to 50 characters. Left out, the server generates one per request, which means a retry will be treated as a new payment — send your own if you intend to retry.

Response

200 · The invoice after the payment, with the new allocation on it.

idstring

The invoice. A Snowflake id sent as a decimal string.

billDatestring · date-time

The date on the invoice, in the company's timezone.

dueDatestring · date-time

When MagicDoor expects to be paid, in the company's timezone.

totalAmountnumber

What the invoice comes to in dollars and cents. Positive — money the management company owes MagicDoor.

allocatedAmountnumber

How much of it has been paid or covered by credit so far.

dueAmountnumber

What is still outstanding: totalAmount less allocatedAmount. Zero means the invoice is settled.

memostring

A note on the invoice. Absent when none was set.

referencestring

MagicDoor's reference for the invoice. Absent when none was set.

metadataobject

Free-form key-value pairs kept on the invoice.

createdstring · date-time

When the invoice was created, in the company's timezone.

updatedstring · date-time

When it last changed, in the company's timezone.

creatorobject

Who created the record.

summariesobject[]

The invoice's charges rolled up by service, ordered by service name.

chargesobject[]

Every individual charge on the invoice.

allocationsobject[]

The payments applied to the invoice.

fileobject

The invoice PDF, with a signed download URL. Absent when no file is attached.

400 · The payment account does not exist (`Payment Account Not Found`), or no active bank account is set up for the company's accounting (`Bank Account Not Found`).

401 · The access token is missing, expired, or does not belong to a property manager.

404 · No invoice with that id exists for the caller's company.

409 · The invoice is already paid (`Bill Already Paid`), or the payment was attempted and failed at the provider (`Bill Payment Failed`).

422 · No payment account is linked (`Payment Account Not Linked`), the payment account cannot be used for this invoice (`Payment Account Not Valid`), or no bank account has been chosen for the company's accounting (`Bank Account Not Selected`).