Developer documentation

Sales invoice - Book the invoice

In Reeleezee application, when any sales invoice is created, it has the status of ‘Draft’ initially. Once the user is done with preparing of an invoice and its complete then it can be booked. In this topic, we would take a look at how you can ‘Book’ a sales invoice. The ‘Status’ will indicate whether an invoice is in ‘Draft’ mode, ‘Booked’ or ‘Finalized’. Let us see what method to be called for and how request should be prepared for same.

Request Info

Production base URL   https://apps.reeleezee.nl/api/v1
Operation : POST
Content type : application/json
Request   https://apps.reeleezee.nl/api/v1/{adminid}/SalesInvoices/{invoiceId}/Actions
URI Parameter : {adminid} is the GUID for an admin you subscribed. {invoiceid} globally unique identifier of the sales invoice for which you aim to book.

As you might have noticed that for this we would be using ‘Post’ method which will specify the ‘Actions’ to perform for a sales invoice. To perform the action, we need to mention ‘Type’ attribute in the payload of request. Let us have a look at value to be used for ‘Type’ in the payload. [To find what kind of other ‘Actions’ can be set for this attribute, check here.]

Request Body

{
    "id": "f200868c-5000-41ea-8fe3-08563887f19b",
    "Type": 17
}

To see the change in ‘Status’ of an invoice via above request, you can see via url:

https://apps.reeleezee.nl/api/v1/{adminid}/salesinvoices/f200868c-5000-41ea-8fe3-08563887f19b

which would show below result

Result

{
    "id": "f200868c-5000-41ea-8fe3-08563887f19b",
    "IsArchived": false,
    "IsFixedAmount": false,
    "IsVatIncluded": false,
    "AccruedQuantity": 7,
    "ExchangeRate": 1,
    "BaseInvoiceAmount": 320.17,
    "BasePaidAmount": 0,
    "BaseRemainingAmount": 320.17,
    "CalculatedDiscountAmount": 5.4,
    "TotalLineAmountWithoutDiscount": 270,
    "TotalNetAmount": 264.6,
    "TotalPaidAmount": 0,
    "TotalPayableAmount": 320.17,
    "TotalTaxAmount": 55.57,
    "UnspecifiedAmount": 0,
    "BookDate": "2017-04-12T00:00:00",
    "Date": "2017-04-12T00:00:00",
    "Bottom": null,
    "DiscountComment": null,
    "CompanyInformation": null,
    "Header": "Subject: Sales invoice to H n L Company on purchase of flash drives",
    "Footer": "Please pay within days before ",
    "PaymentReference": null,
    "ReceiptNumber": "5",
    "Reference": "5",
    "Token": "DtKID72HTS6PZIYr4MZFbnr8wPC8CQ",
    "Status": 2,
    "DocumentType": 10,
    "Origin": 2,
    "Type": 1,
    "TaxPurposeType": null,
    "DueDate": "2017-04-17T00:00:00",
    "DiscountAmount": null,
    "DiscountPercentage": 0.02,
    "InvoiceNumber": 5,
    "OverdueDays": -15
}

So let us summarized on basic flow for any sales invoice along with taking it further for the payment.

Create-Book-Pay a sales invoice:

  1. Get PaymentItemId -> GET: {{url}}/salesinvoices/{salesinvoiceId}/?$select=PaymentTermList&$expand=PaymentTermList($expand=PaymentItem;$select=PaymentItem))
  2. Create a PaymentTransaction fot the PaymentAccount  you select during creation of salesinvoice -> PUT: {{url}}/PaymentTransactions/{transactionId})
  3. Link PaymentItem to PaymentTransAction -> POST: {{url/PaymentTransactions/{transactionId}/Actions)

This would give a complete picture on how you can play with sales invoices and their relevant actions.

 

NL Select your country