Browse Documentation
POST Create purchase

Create a new Purchase

POST /purchases

To create purchases you will need an access token, for questions regarding how to obtain an access token click on this link.

Parameters

  Parameter
  Type
 Description
 supplier_id | required
  String
 The supplier you are sending the purchase to
 issued_date | required
  Date YYYY-MM-DD
 The date the invoice was issued
 due_date | required
  Date YYYY-MM-DD
 The expiration date of the purchase
 reference
  String
 Any name that you wish to use as a reference
 remarks
  String
 Remarks
 Items | required
  Array[object]
 Items to be added to the invoice
 items[title] | required
  String
 Item title
 items[description]
  String
 Description of the item
 items[quantity] | required
  Int
 Item Quantity
 items[price] | required
  Float|Int
 Item Price
 items[tax_id] | required
  String
  Item Tax ID
 items[include_tax] | required
  Int
 Enter 1 if you want the tax to be included and 0 if the tax  to be excluded
items[gl_account] | required
  String
 The account to charge the item

A POST request is expected to be sent to the above endpoint where the content body must be JSON string containing all parameters that are needed to create a new invoice. The below example demonstrates how to create a new Purchase.

  1. curl -s -H "Content-Type: application/json" -H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOixMiJ9.eyJleHAiOjE1MDM4NDQzMzIsIm5iZiI6MTQ4ODIwOTUzMiwiaWF0IjoxNDg4MjA5NTMyLCJidXNpbmVzcyI6NjIsInVzZXIiOjEwLCJjbGllbnQiOjJ9.kTVtfmMLOEBsBxKSeJupQ2RP0wo6kPyqWFxQvcuU5nk7hRKlw-mcurK0IlMXrWxa8ktab0Yquc5j9s1w" \
    • -XPOST \
    • -d '{ 
    •       "purchase":{
    •          "supplier_id":"1b908f34bbe258f96ab6932ca832a2a4dee09c73",
    •          "issued_date":"2016-09-25",
    •          "due_date":"2016-09-28",
    •          "reference":"Slimzy",
    •          "remarks":"Satisfactory",
    •          "items":[  
    •             {  
    •                "title":"Macmillan Advanced Mathematics",
    •                "description":"Mathematics textbook",
    •                "quantity":1,
    •                "price":3500,
    •                "tax_id":"ec8fedb21ef20208ebf708d83c3de936327f98ee",
    •                "include_tax":0,
    •                "gl_account": "372ac9a718661f26d34ba886d739d0dcbdfd0de6"
    •             },
    •             {  
    •                "title":"Oxford Mathematical set",
    •                "description":"School accessories",
    •                "quantity":2,
    •                "price":900,
    •                "tax_id":"be8b5a387dbdfb42c7b897dd4b032019163a088f",
    •                "include_tax":0,
    •                "gl_account": "372ac9a718661f26d34ba886d739d0dcbdfd0de6"
    •             }
    •          ]
    •       }
    • }' \
    • https://app.accounteer.com/api/v0.1/purchases
  2.  

Response

  • {
     "data": [
     {
      "id": "162126addae2d39873058fcb7a619b96ecd5e704",
      "organization_id": "520e391aa7e3bceccc5e2a9729fe0c60404140dc",
      "supplier_id": "b4df480b298db729344e27d0bc8f236b294e18df",
      "total_amount": 3675,
      "total_base_amount": 3500,
      "total_tax_amount": 175,
      "currency": "EUR",
      "issued_date": "2017-05-28",
      "due_date": "2017-05-29",
      "status": "DRAFT",
      "reference": "Temitope",
      "items": [
         {
           "title": "Okeke Physics TextBook",
           "description": "Okeke Physics",
           "quantity": 1,
           "item_base_amount": 1500,
           "tax_id": 1b908f34bbe258f96ab6932ca832a2a4dee09c73,
           "tax_name": "5%",
           "tax_percentage": 5,
           "account_id": "53fa00e35def06ef89003af73ab0379c809d4b11",
           "gl_account": "2150 Holding account",
           "line_base_amount": 1500,
           "line_tax_amount": 75,
           "line_total_amount": 1575
        },
        {
           "title": "Macmillian Mathematics",
           "description": "Mathematics",
           "quantity": 2,
           "item_base_amount": 2000,
           "tax_id": 1b908f34bbe258f96ab6932ca832a2a4dee09c73,
           "tax_name": "5%",
           "tax_percentage": 5,
           "account_id": "53fa00e35def06ef89003af73ab0379c809d4b11",
           "gl_account": "2150 Holding account",
           "line_base_amount": 2000,
           "line_tax_amount": 100,
           "line_total_amount": 2100
        }]
          }
      ]
    }