Browse Documentation
POST Pay purchase

Pay Purchase

POST /purchases/:id/pay

To approve pay a purchase you need to send a payment object to the pay purchase endpoint. A payment needs to include the amount and the GL account from which the payment is made. It can also include an optional reference property. The GL account provided needs to be enabled for payments.

Request

{
    "payment": {
        "amount": 500,
        "gl_account_id": "961a46720ad38ca194c27be38753264cbca43da1",
        "reference": "my reference"
    }
}

Response

As a response the complete purchase object will be returned

{
    "id": "ba775d2a3f9612ab288489f20ceab582f7f62fd5",
    "organization_id": "daa71f0644647c0d82dd2d03d0b29779644b1a48",
    "document_number": "-",
    "client_id": "1615c6926a25a72b31ee320d0889e82f6395511c",
    "template_id": "6510e39e71217f262c39b3525831f2a5405fc5e8",
    "total_amount": 221,
    "total_base_amount": 182.64,
    "total_tax_amount": 38.36,
    "amount_due": 0,
    "currency": "EUR",
    "date_issued": "2017-04-24",
    "date_due": "2017-08-23",
    "date_created": "2017-07-24",
    "date_updated": "2017-07-24",
    "status": "approved",
    "reference": null,
    "items": [{
        "id": "2417f43fb9ec75daa3abad35f0ab9a42eebc1910",
        "title": "item 01",
        "description": null,
        "quantity": 1,
        "item_base_amount": 100,
        "tax_id": "fd62ee6c1d65e4729da41f85cdd328dfc816d161",
        "tax_name": "VAT 21%",
        "tax_percentage": 21,
        "line_base_amount": 100,
        "line_tax_amount": 21,
        "line_total_amount": 121,
        "tax_included": false,
        "price": 100,
        "gl_account": {
            "id": "aefb526889e1059a61ecce700a3363c388a93335",
            "code": "7000000",
            "title": "Sales",
            "description": null
        }
    }, {
        "id": "b92f3b4c8013d092acf7d8b56a8eef19bbea6613",
        "title": "item 02",
        "description": null,
        "quantity": 1,
        "item_base_amount": 82.644628099174,
        "tax_id": "fd62ee6c1d65e4729da41f85cdd328dfc816d161",
        "tax_name": "VAT 21%",
        "tax_percentage": 21,
        "line_base_amount": 82.64,
        "line_tax_amount": 17.36,
        "line_total_amount": 100,
        "tax_included": true,
        "price": 82.64,
        "gl_account": {
            "id": "aefb526889e1059a61ecce700a3363c388a93335",
            "code": "7000000",
            "title": "Sales",
            "description": null
        }
   }],
   "attachments": []
}