Invoice payments

Current version: 1.0.1

Create

POST /api2/facturen/(int: id)/betalingen

Create a new payment for an invoice

Example request:

POST /api2/facturen/42/betalingen HTTP/1.1
Host: demo.recras.nl
Accept: application/json

{
   betaalmethode_id: 1, // (payment_method_id)
   bedrag: 19.95, // (amount)
   wanneer: "2018-05-14T17:09:00.000Z" // (when)
}

Example response:

HTTP/1.1 201 Created
Content-Type: application/json
Location: /api2/facturen/42/betalingen/1

{
   "id": 1,
   "factuur_id": 42, // (invoice_id)
   "wanneer": "2018-05-14T19:09:00+02:00", // (when)
   "bedrag": 19.95, // (amount)
   "opmerking": "", // (remark)
   "betaalmethode_id": 1, // (payment_method_id)
   "pos_id": null,
   "location_id": null,
   "btw": { // (vat)
      "6": {
         "btw": 1.1292452830189, // (vat)
         "bedrag": 18.820754716981 // (amount)
      }
   },
   "klant": { // (customer)
      "id": 666,
      "naam": "De Vil" // (name)
   }
}
JSON Parameters:
  • betaalmethode_id (int) – the ID of the used payment method (betaalmethode_id). Default value is null

  • bedrag (float) – Required the paid amount (bedrag)

  • wanneer (date) – an ISO8601 date on which the payment was made (wanneer). Default value is the current date/time

Response Headers:
  • Location – The location of the new payment

Status Codes:
  • 201 Created – Payment made

  • 406 Not Acceptable – Error in the input (Fout in de invoer)

  • 403 Forbidden – User does not have the permission createFactuurBetaling (createInvoicePayment) or editFactuurBetaling (editInvoicePayment)

Update

PUT /api2/facturen/(int: id)/betalingen/(int: id)

Update an existing payment on an invoice

Example request:

PUT /api2/facturen/42/betalingen/1 HTTP/1.1
Host: demo.recras.nl
Accept: application/json

{
   "id": 1,
   "factuur_id": 42, // (invoice_id)
   "wanneer": "2018-05-14T19:09:00+02:00", // (when)
   "bedrag": 19.95, // (amount)
   "opmerking": "", // (remark)
   "betaalmethode_id": 2, // (payment_method_id)
   "pos_id": null,
   "location_id": null,
   "btw": { // (vat)
      "6": {
         "btw": 1.1292452830189, // (vat)
         "bedrag": 18.820754716981 // (amount)
      }
   },
   "klant": { // (customer)
      "id": 666,
      "naam": "De Vil" // (name)
   }
}

Read

GET /api2/facturen/(int: id)/betalingen

Example request:

GET /api2/facturen/42/betalingen HTTP/1.1
Host: demo.recras.nl
Accept: application/json

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

[
   {
      "id": 1,
      "factuur_id": 42, // (invoice_id)
      "wanneer": "2018-05-14T19:09:00+02:00", // (when)
      "bedrag": 19.95, // (amount)
      "opmerking": "", // (remark)
      "betaalmethode_id": 1, // (payment_method_id)
      "pos_id": null,
      "location_id": null,
      "btw": { // (vat)
         "6": {
            "btw": 1.1292452830189, // (vat)
            "bedrag": 18.820754716981 // (amount)
         }
      },
      "klant": { // (customer)
         "id": 666,
         "naam": "De Vil" // (name)
      }
  },
]
Request Headers:
Query Parameters:
  • embed (string) – Comma-separated list of related entities to embed in the result. Accepts Creator, and Factuur (invoice)

  • Factuur.context (string) – Comma-separated list of Invoice contexts to filter the payments by. Implicitly embeds invoice

Status Codes:
GET /api2/facturen/(int: id)/betalingen/(int: id)

A specific payment

Example request:

GET /api2/facturen/42/betalingen/1 HTTP/1.1
Host: demo.recras.nl
Accept: application/json

Example response:

HTTP/1.1 200 OK
Content-Type: application/json

{
   "id": 1,
   "factuur_id": 42, // (invoice_id)
   "wanneer": "2018-05-14T19:09:00+02:00", // (when)
   "bedrag": 19.95, // (amount)
   "opmerking": "", // (remark)
   "betaalmethode_id": 1, // (payment_method_id)
   "pos_id": null,
   "location_id": null,
   "btw": { // (vat)
      "6": {
         "btw": 1.1292452830189, // (vat)
         "bedrag": 18.820754716981 // (amount)
      }
   },
   "klant": { // (customer)
      "id": 666,
      "naam": "De Vil" // (name)
   }
}
Status Codes:

Delete

DELETE /api2/facturen/(int: id)/betalingen/(int: id)

Example request:

DELETE /facturen/42/betalingen/1 HTTP/1.1
Host: demo.recras.nl

Example response:

HTTP/1.1 200 OK
Status Codes:
  • 200 OK – Payment deleted

  • 403 Forbidden – User does not have the permission editFactuurBetaling (editInvoicePayment)