Reference
Payments
POST/api/v1/payments/{id}/cancelCancel payment
Cancels a payment recorded by hand on an invoice, e.g. one typed wrong, with a reason: a counter-entry is booked, the payment stays listed as cancelled and no longer counts as paid. The payment ids are in get_invoice. A payment from a bank transaction, or one coupled to a bank transaction, is undone on the transaction instead and is refused here.scope invoices
Path
| idrequired | stringThe payment's id, from get_invoice's payments. |
Body (JSON)
| reasonrequired | stringWhy it is cancelled; stays visible at the payment. |
Response 200
| id | string |
| number | string | null |
| kind | string |
| status | one of draft, issuing, issued, cancelled |
| payment | one of unsent, open, partially_paid, paid, overdue, cancelled | null |
| invoice_date | string | null |
| company | string |
| order | string | null |
| business_unit | string | null |
| customer_reference | string | null |
| lines[] | object[] |
| lines[].id | string |
| lines[].position | integer |
| lines[].source | string |
| lines[].name | string |
| lines[].description | string | null |
| lines[].period_from | string | null |
| lines[].period_to | string | null |
| lines[].quantity | string |
| lines[].unit | string |
| lines[].unit_price_cents | integer |
| lines[].net_cents | integer |
| totals | object |
| totals.net_cents | integer |
| totals.vat_cents | integer |
| totals.gross_cents | integer |
| payments[] | object[] |
| payments[].id | string |
| payments[].paid_on | string | null |
| payments[].amount_cents | integer |
| payments[].note | string | null |
| payments[].origin | one of hand, bank, reversal, cancellation |
| payments[].bank_transaction_id | string | null |
| payments[].cancelled | object | null |
| payments[].cancelled.on | string | null |
| payments[].cancelled.by | string |
| payments[].cancelled.reason | string |
| url | string |
Schema
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"number": {
"type": [
"string",
"null"
]
},
"kind": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"draft",
"issuing",
"issued",
"cancelled"
]
},
"payment": {
"anyOf": [
{
"type": "string",
"enum": [
"unsent",
"open",
"partially_paid",
"paid",
"overdue",
"cancelled"
]
},
{
"type": "null"
}
]
},
"invoice_date": {
"type": [
"string",
"null"
]
},
"company": {
"type": "string"
},
"order": {
"type": [
"string",
"null"
]
},
"business_unit": {
"type": [
"string",
"null"
]
},
"customer_reference": {
"type": [
"string",
"null"
]
},
"lines": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"position": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"source": {
"type": "string"
},
"name": {
"type": "string"
},
"description": {
"type": [
"string",
"null"
]
},
"period_from": {
"type": [
"string",
"null"
]
},
"period_to": {
"type": [
"string",
"null"
]
},
"quantity": {
"type": "string"
},
"unit": {
"type": "string"
},
"unit_price_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"net_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"required": [
"id",
"position",
"source",
"name",
"description",
"period_from",
"period_to",
"quantity",
"unit",
"unit_price_cents",
"net_cents"
],
"additionalProperties": false
}
},
"totals": {
"type": "object",
"properties": {
"net_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"vat_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"gross_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"required": [
"net_cents",
"vat_cents",
"gross_cents"
],
"additionalProperties": false
},
"payments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"paid_on": {
"type": [
"string",
"null"
]
},
"amount_cents": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"note": {
"type": [
"string",
"null"
]
},
"origin": {
"type": "string",
"enum": [
"hand",
"bank",
"reversal",
"cancellation"
]
},
"bank_transaction_id": {
"type": [
"string",
"null"
]
},
"cancelled": {
"anyOf": [
{
"type": "object",
"properties": {
"on": {
"type": [
"string",
"null"
]
},
"by": {
"type": "string"
},
"reason": {
"type": "string"
}
},
"required": [
"on",
"by",
"reason"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"id",
"paid_on",
"amount_cents",
"note",
"origin",
"bank_transaction_id",
"cancelled"
],
"additionalProperties": false
}
},
"url": {
"type": "string"
}
},
"required": [
"id",
"number",
"kind",
"status",
"payment",
"invoice_date",
"company",
"order",
"business_unit",
"customer_reference",
"lines",
"totals",
"payments",
"url"
],
"additionalProperties": false
}Refusals are problems with a code — see Errors.