Use case
User wants to get the information to the other system when a customer pays the invoice.
After a customer pays the invoice, a payment transaction will be added for the sales invoice. The user would like to know if a new payment transaction has been added to the invoice.
Used endpoints
The ID of the invoice should be stored in advance or searched using GET /invoices endpoint.
GET/invoices/{invoiceId}/paymentevents endpoint returns payment transactions (payment events in API) for the requested invoice. Manually added payment transactions and payment transactions, such as reference payments, allocated to the sales invoice are both returned.
In the following example two payment transaction have been added manually. API returns the response as follow:
{
"results": [
{
"id": 29249765,
"invoiceId": 8497816,
"type": "BANKTRANSFERELSEWHERE",
"paymentDate": "2020-12-01",
"status": "MARKED_PAID",
"amount": 40.00,
"currency": "EUR"
},
{
"id": 29249766,
"invoiceId": 8497816,
"type": "BANKTRANSFERELSEWHERE",
"paymentDate": "2020-12-15",
"status": "MARKED_PAID",
"amount": 60.00,
"currency": "EUR"
}
],
"meta": {
"pageNumber": 0,
"pageSize": 50,
"resultCount": 2
}
}
The payment transaction receives status when it is saved. Status of the sales invoice's payment transaction can be Paid or Marked paid. If the payment transaction has been allocated automatically, then it has status PAID. If it has been added manually, status is MARKED_PAID.
The status of the payment transaction does not indicate directly whether the sales invoice has been fully paid. The total sum of the amounts of the payment transactions must be calculated and compared with the calculated amount of the invoice.
- If the total sum of the payment transactions on the invoice is other than the amount of the invoice, the invoice is over paid or only a part of the invoice's sum is paid. Then the status of the status of the sales invoice is Partly paid (PARTLY_PAID).
- If the total sum of the payment transactions is equal to the amount of the invoice, then the invoice’s open sum is zero. Then the sales invoice’s status is Paid (PAID) or Marked Paid (MARKED_PAID), depending on how the payment transactions were added.
The status of the invoice can also be checked using the GET /invoices or GET /invoices/{invoiceId} endpoint.
Other information
In Procountor's user interface, the sales invoice's payment transactions are listed to the Payment transactions section of the invoice’s Special situations view: