Create Order

Sale Order records the order of product and services from the customers.

Business Rules

The following are required fields for the sale order

•	Customer Account No
•	Invoice Date
•	Invoice Due Date
•	Invoice Template ID
•	One Invoice Product Object
The Invoice Object
ApiToken

String

*(Required)

API authorisation token obtained via authentication API.

InvoiceTemplate

Integer

*(Required)

Invoice template as set out in the Smart Settings (Inline: 2 Distribution: 3)

InvoiceDate

Date (YYYY-MM-DD)

*(Required)

Invoice date

DueDate

Date (YYYY-MM-DD)

*(Required)

Invoice due date

DocNo

String (50)

(Optional)

A reference for the invoice

CustomerAccountNo

String (50)

*(Required)

Account no. allocated to the customer, refer to the customer list for the account no. information.

CustomerAddress

String (500)

(Optional)

Customer address

LocationCode

String (50)

(Optional)

Only required if multi location is enabled in FastAccounts. For the Location Code refer to Locations List

Filter1

String (200)

(Optional)

Filters help you quickly filter the invoices. 4 Filters are provided. In case Filter is not previously defined System will add a new Filter Automatically.

Filter2

String (200)

(Optional)

As Filter 1

Filter3

String (200)

(Optional)

As Filter 1

Filter4

String (200)

(Optional)

As Filter 1

SmartDocNo1

String (50)

(Optional)

A reference for the invoice

SmartDocNo2

String (50)

(Optional)

A reference for the invoice

SmartDocNo3

String (50)

(Optional)

A reference for the invoice

SmartDocNo4

String (50)

(Optional)

A reference for the invoice

Notes

String (500)

(Optional)

Notes for Invoice

InvoiceTotal

decimal (15, 2)

*(Required)

Invoice Total

CurrencyCode

String (5)

(Optional)

Currency code for the Customer Account, e.g. PKR or USD. The Currency Codes can be found in the Currencies List. For Foreign Customer this must match with Customer Currency.

ExchangeRate

decimal (15, 8)

(Optional)

The exchange rate for the foreign currency transactions. Base Currency to Foreign Currency. Must be provided when a foreign currency transaction is recorded.

Invoice Products Object
Code

String (50)

*(Required)

Code for the Product

Description

String (500)

(Optional)

Sale Description of the Product

Unit

String (200)

(Optional)

Unit for the Product, in case linked with Product, this is required.

Quantity

Decimal (20, 6)

*(Required)

Product Quantity

Rate

decimal (20, 6)

*(Required)

Per Unit Rate

Amount

decimal (15, 2)

*(Required)

Amount is Quantity x Rate

DiscountAmount

decimal (15, 2)

(Optional)

Discount Amount (total)

GSTCode

String (10)

(Optional)

GST Tax Code, must be provided when GST Amount is > 0. GST Codes can be found in Smart Settings -> Tax & Year End

GSTAmount

decimal (11, 6)

(Optional)

GST Amount

RetailMargin

decimal (15, 2)

(Optional)

Retail Margin Amount (total)

TradeOffer

decimal (15, 2)

(Optional)

Trade Offer Amount (total)

ProjectCode

String (25)

(Optional)

Project Code linked with the project. Refer to the Projects list.

Invoice Charges Object
Code

String (50)

(Optional)

Code for the Nominal Account

Amount

decimal (15, 2)

(Optional)

Charges Amount

Invoice Deductions Object
Code

String (50)

(Optional)

Code for the Nominal Account

Amount

decimal (15, 2)

(Optional)

Deduction Amount, this must be a Negative Amount

Sample Object
{
    "ApiToken": "c3ef62d81d6738cf14bf335306c57645",
    "InvoiceTemplate": "3",
    "InvoiceDate": "2020-06-08",    
    "DueDate": "2020-06-08",     
    "DocNo": "DC101",
    "CustomerAccountNo": "1001",
    "CustomerAddress": "Lahore",
    "LocationCode":"L101",  
    "Filter1":"FT1",
    "Filter2":"FT2",
    "Filter3":"FT3",
    "Filter4":"FT4",    
    "SmartDocNo1":"SmartDocNo1",
    "SmartDocNo2":"SmartDocNo2",
    "SmartDocNo3":"SmartDocNo3",
    "SmartDocNo4":"SmartDocNo4",    
    "Notes": "Test Invoice",
    "InvoiceTotal": "150",
    "CurrencyRef" : "PKR",
    "ExchangeRate": "1",
    
    "Products": [
        {
            "Code": "1001",
            "Description":"Product 101",
            "Unit": "Pcs",
            "Quantity": "1",
            "Rate": "100",
            "Amount": "100",
            "DiscountAmount": "10",
            "GSTCode":"GST201",
            "GSTAmount": "10",          
            "RetailMargin": "10.00",
            "TradeOffer": "0.00",           
            "ProjectCode": "PJ101"
        },
        {
            "Code": "1002",
            "Description":"Product 102",
            "Unit": "Pcs",
            "Quantity": "1",
            "Rate": "100",
            "Amount": "100",
            "DiscountAmount": "10",
            "GSTCode":"GST202",
            "GSTAmount": "20",          
            "RetailMargin": "0.00",
            "TradeOffer": "10.00",          
            "ProjectCode": "PJ102"
        }
    ],
    "Charges": [
        {
            "Code": "610201",
            "Amount": "10"
        },
        {
            "Code": "610202",
            "Amount": "20"
        }
    ],
    "Deductions": [
        {
            "Code": "610203",
            "Amount": "-30"
        },
        {
            "Code": "610204",
            "Amount": "-40"
        }
    ]
}                  
API URL

https://api.fastaccounts.io/index.php/api/order/create

Sample Response
{"Status":1,"Code":"200","Message":"The request was successfully completed.","InvoiceID":"1"}
Status Codes
Status Code Type Message
200 Success The request was successfully completed.
201 Error Invalid Key Details.
202 Error Data is not valid in API request.
203 Error Data is not valid in API products.
204 Error Validation failed.
205 Error Invalid IP Address.
400 Error Bad Request.
403 Error Forbidden.
404 Error Not Found.
500 Error Internal Server Error.