Invoice payments ================ Current version: 1.0.1 Create ------ .. http:post:: /api2/facturen/(int:id)/betalingen Create a new payment for an invoice **Example request**: .. sourcecode:: http 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**: .. sourcecode:: http 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 int betaalmethode_id: the ID of the used payment method (`betaalmethode_id`). Default value is ``null`` :json float bedrag: **Required** the paid amount (`bedrag`) :json date wanneer: an ISO8601 date on which the payment was made (`wanneer`). Default value is the current date/time :resheader Location: The location of the new payment :statuscode 201: Payment made :statuscode 406: Error in the input (`Fout in de invoer`) :statuscode 403: User does not have the permission ``createFactuurBetaling`` (createInvoicePayment) or ``editFactuurBetaling`` (editInvoicePayment) Update ------ .. http:put:: /api2/facturen/(int:id)/betalingen/(int:id) Update an existing payment on an invoice **Example request**: .. sourcecode:: http 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 ---- .. http:get:: /api2/facturen/(int:id)/betalingen **Example request**: .. sourcecode:: http GET /api2/facturen/42/betalingen HTTP/1.1 Host: demo.recras.nl Accept: application/json **Example response**: .. sourcecode:: http 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) } }, ] :reqheader Authorization: mandatory Basic authentication :query string embed: Comma-separated list of related entities to embed in the result. Accepts ``Creator``, and ``Factuur`` (invoice) :query string Factuur.context: Comma-separated list of Invoice contexts to filter the payments by. Implicitly embeds invoice :statuscode 200: no error .. http:get:: /api2/facturen/(int:id)/betalingen/(int:id) A specific payment **Example request**: .. sourcecode:: http GET /api2/facturen/42/betalingen/1 HTTP/1.1 Host: demo.recras.nl Accept: application/json **Example response**: .. sourcecode:: http 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) } } :statuscode 200: OK :statuscode 404: No payment with this ``id`` Delete ------ .. http:delete:: /api2/facturen/(int:id)/betalingen/(int:id) **Example request**: .. sourcecode:: http DELETE /facturen/42/betalingen/1 HTTP/1.1 Host: demo.recras.nl **Example response**: .. sourcecode:: http HTTP/1.1 200 OK :statuscode 200: Payment deleted :statuscode 403: User does not have the permission ``editFactuurBetaling`` (editInvoicePayment)