Apply a customer receipt
Customer receipts in Sage 50 are money received from a customer, applied to open sales invoices. Use POST /api/receipts to post a receipt against a single invoice.
Prerequisites
Before applying a receipt, make sure you have:
- A valid API key configured on the server
- The Sage 50 company file open (use
GET /api/databaseto check status) - A valid
customerIdfromGET /api/customers - An open invoice for that customer with an
invoiceNumberandamountOwinggreater than zero
Use GET /api/sales to find invoices to pay. Filter by customerId and repeat paymentStatus for unpaid and partial invoices (0 = unpaid, 1 = partial). You can also limit the list with modifiedSince or activitySince:
GET /api/sales?customerId=42&paymentStatus=0&paymentStatus=1
modifiedSince returns invoices whose content was edited on or after that date and time (amounts, lines, and so on). Applying a payment alone does not count. activitySince returns invoices with any update on or after that time, including payments.
Each result includes invoiceNumber, amountOwing, lastModifiedAt, and lastActivityAt. lastModifiedAt is when the invoice itself was last edited. lastActivityAt is when anything last changed, including payments. You can also use GET /api/sales/{saleId} if you already have the sale id from when the invoice was created.
Pick the Deposit To account (bank or cash) from GET /api/general-accounts. Send the account display number in depositAccountNumber (for example 10600), the same way general journal lines use accountNumber. Sage’s 8-digit internal account id (accountId, for example 10600000) is also accepted.
Authentication
Pass your API key in the x-api-key request header:
x-api-key: YOUR_API_KEY
Endpoint
POST /api/receipts
customerId, invoiceNumber, amount, depositAccountNumber, and paymentMethod are required. The payment must be greater than zero and cannot exceed the invoice amountOwing.
What you actually need to send
| Field | Required? | What happens if omitted |
|---|---|---|
customerId |
Yes | Request is rejected |
invoiceNumber |
Yes | Request is rejected. Must match an open invoice for the customer |
amount |
Yes | Request is rejected. Must be ≤ amountOwing on the invoice |
depositAccountNumber |
Yes | Request is rejected. Deposit To: the bank or cash account the receipt is deposited into, as a display number or internal account id |
paymentMethod |
Yes | Request is rejected. See payment methods below |
date |
No | Sage uses the current date. The receipt date must fall within the company’s open fiscal period |
chequeNumber |
No | Optional reference when paymentMethod is Cheque (1) |
creditCardId |
Yes for credit card | Required when paymentMethod is CreditCard (2). Use GET /api/creditcards/selectable |
comment |
No | The receipt’s Comment field stays empty. Up to 75 characters |
paymentMethod values:
| Value | Method |
|---|---|
0 |
Cash |
1 |
Cheque |
2 |
CreditCard |
3 |
DirectPayment |
When paymentMethod is 2 (CreditCard), creditCardId is required. When it is 1 (Cheque), send chequeNumber if you want the cheque reference on the receipt.
Request body
Minimum example for a full payment against one open invoice. Only the required fields are sent:
{
"customerId": 42,
"invoiceNumber": "INV-1001",
"amount": 113.0,
"depositAccountNumber": "10600",
"paymentMethod": 0
}
Cheque payment with a reference:
{
"customerId": 42,
"invoiceNumber": "INV-1001",
"amount": 113.0,
"depositAccountNumber": "10600",
"paymentMethod": 1,
"chequeNumber": "1042"
}
Credit card payment (use an id from GET /api/creditcards/selectable):
{
"customerId": 42,
"invoiceNumber": "INV-1001",
"amount": 113.0,
"depositAccountNumber": "10600",
"paymentMethod": 2,
"creditCardId": 3
}
Interac e-Transfer with the confirmation number in comment:
{
"customerId": 42,
"invoiceNumber": "INV-1001",
"amount": 113.0,
"depositAccountNumber": "10600",
"paymentMethod": 3,
"comment": "Interac e-Transfer CA1xYz7Q9"
}
comment is saved in the receipt’s Comment field in Sage. Like in Sage, it also replaces the customer name as the comment of the receipt’s journal entry.
cURL example
curl -X POST "/api/receipts" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{
"customerId": 42,
"invoiceNumber": "INV-1001",
"amount": 113.0,
"depositAccountNumber": "10600",
"paymentMethod": 0
}'
Success response
A successful request returns 201 Created with the posted receipt:
{
"id": 88,
"receiptNumber": "RCT-501",
"customerId": 42,
"date": "2026-09-29T00:00:00",
"amount": 113.0,
"depositAccountNumber": "10600000",
"depositAccountDisplayNumber": "10600",
"paymentMethod": 0,
"chequeNumber": "",
"comment": "",
"lines": [
{
"invoiceNumber": "INV-1001",
"amount": 113.0
}
]
}
In the response, depositAccountNumber is Sage’s 8-digit internal account id and depositAccountDisplayNumber is the account number shown in Sage. paymentMethod is the method recorded in Sage, comment is empty when the receipt has none, and each line’s invoiceNumber is the invoice the payment was applied to.
Use the returned id as receiptId with GET /api/receipts/{receiptId} to retrieve the receipt later. After posting, GET /api/sales/{saleId} on the invoice should show a lower amountOwing and an updated paymentStatus (0 = unpaid, 1 = partial, 2 = paid).
Error response
If the request is invalid or Sage rejects the entry, the API returns 400 Bad Request with a ProblemDetails body. Nothing is posted:
{
"title": "Bad request",
"status": 400,
"detail": "Invoice INV-1001 was not found for customer 42.",
"code": "400",
"requestId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
Common causes include an unknown customerId, an invoice that is already paid or does not belong to the customer, an amount greater than amountOwing, a missing creditCardId when paymentMethod is CreditCard, a depositAccountNumber that does not exist or is not a bank or cash account, or a comment longer than 75 characters (code M400). When Sage itself rejects a value, code is the Sage message id (for example E71), or SDK01 / SDK02 for Sage SDK validation errors.
Next steps
- Browse the full API reference for all Receipts endpoints
- See Create a sales invoice if you need to create the invoice first
- Use
GET /api/receipts?customerId=42to list receipts for a customer - Use
GET /api/sales/{saleId}to confirm the invoice balance after payment