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, bedrag: 19.95, wanneer: "2018-05-14T17:09:00.000Z" } **Example response**: .. sourcecode:: http HTTP/1.1 201 Created Content-Type: application/json Location: /api2/facturen/42/betalingen/1 { "id": 1, "factuur_id": 42, "wanneer": "2018-05-14T19:09:00+02:00", "bedrag": 19.95, "opmerking": "", "betaalmethode_id": 1, "pos_id": null, "location_id": null, "btw": { "6": { "btw": 1.1292452830189, "bedrag": 18.820754716981 } }, "klant": { "id": 666, "naam": "De Vil" } } :json int betaalmethode_id: the ID of the used payment method. Default value is ``null`` :json float bedrag: **Required** the paid amount :json date wanneer: an ISO8601 date on which the payment was made. Default value is the current date/time :resheader Location: The location of the new payment :statuscode 201: Payment made :statuscode 406: Mistake in the input :statuscode 403: User does not have the permission ``createFactuurBetaling`` or ``editFactuurBetaling`` 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, "wanneer": "2018-05-14T19:09:00+02:00", "bedrag": 19.95, "opmerking": "", "betaalmethode_id": 2, "pos_id": null, "location_id": null, "btw": { "6": { "btw": 1.1292452830189, "bedrag": 18.820754716981 } }, "klant": { "id": 666, "naam": "De Vil" } } 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, "wanneer": "2018-05-14T19:09:00+02:00", "bedrag": 19.95, "opmerking": "", "betaalmethode_id": 1, "pos_id": null, "location_id": null, "btw": { "6": { "btw": 1.1292452830189, "bedrag": 18.820754716981 } }, "klant": { "id": 666, "naam": "De Vil" } }, ] :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, "wanneer": "2018-05-14T19:09:00+02:00", "bedrag": 19.95, "opmerking": "", "betaalmethode_id": 1, "pos_id": null, "location_id": null, "btw": { "6": { "btw": 1.1292452830189, "bedrag": 18.820754716981 } }, "klant": { "id": 666, "naam": "De Vil" } } :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``