Main Web API Documentation Information
Actual Page/Function Name:
startMainInvoice
Human Readable Name or Caption:
Start Main Invoice
Page/Function Description:
This method will create the main invoice.
Page/Function Output Type:
API - JSON or WDDX
Categories:
eComm,invoice
Extra Page/Function Notes:
An invoice is basically further than a quote because it actually starts attaching itself to inventory, money, receivables, etc. It's a live piece.


Parameters
Scope Name Type Default Description Required Alternates Known Values
Arguments ADJUSTED_DATE_TIME String Pass in the adjusted date/time stamp. Yes
Arguments CORP_ID Numeric 0 Pass in the corp id number. This is your corporation ID or your business world number. This is required and will be validated. The default is 0, but will be checked for a real number. Yes
Arguments CUSTOMER_ID Numeric 1 Pass in the customer id number. If this is a real customer invoice, a real id is required. If it is not, please use a default of 1 for a dummy customer record. This is usually used for counter sales and internal tickets as well. Yes
Arguments EXTERNAL_PO_NUMBER String Pass in the external customer PO number. This is not required, but if your corporation uses this setting, this is where you would put in an external po number. Also, this field can be named something other than po number and can be used for other values. No
Arguments INVOICE_AMOUNT Numeric 0 Pass in the total invoice amount. Yes
Arguments INVOICE_CREATED_BY_ID Numeric 0 Pass in the payee id number of who created the invoice. Yes
Arguments INVOICE_DATE String Pass in the invoice date. The default is today's date. Yes
Arguments INVOICE_NOTES String Pass in the general invoice notes. These are non-printing notes. As a note, there are two note types. This is the non-printing one. See the PRINTABLE_INVOICE_NOTES for the other option. No
Arguments INVOICE_TYPE_ID Numeric 0 Pass in the invoice type id number. 2=Customer Invoice, 3=Counter Sale, 4=Rental Ticket, 5=Internal-Repair, 6=Transfer, 7=Quote, 8=Transition Invoice. Yes
Arguments OTHER_SALESPERSON_ID Numeric 1 Pass in the other salesperson id number. Use 1 if you're not assigning a second salesperson. This will tie it to a dummy record behind the scenes. If a second salesperson is really used, pass in their payee id number. Yes
Arguments OTHER_STORE_ID Numeric 1 Pass in the other location id number. This is for transfers. If your invoice is not a transfer, please use the value of 1. If it is a valid transfer, this is the "to" store (where it will end up). Yes
Arguments PRINTABLE_INVOICE_NOTES String Pass in the printable invoice notes. These notes will actually show up on the physical invoice. If you need notes that you don't want to show up, use the INVOICE_NOTES argument (hidden, internal notes). No
Arguments SALESPERSON_ID Numeric 0 Pass in the main salesperson id number. This is the payee id of the person who is getting credit for the sale. There is also another field called the OTHER_SALESPERSON_ID that may also be used if there is a second person. Yes
Arguments STOCK Numeric 0 Pass in the stock number. This is used for internal tickets. For example, if you had a vehicle (stock unit) and did an oil change, an internal ticket would apply the oil change to the stock unit. Use 0 as default if unknown. No
Arguments STOCK_UNIT_LIST String Pass in a list of unit/stock numbers if any. This field is used if you are selling stock units as line items on the invoice. Pass in a comma-delineated list if applicable. The default is blank. No
Arguments STORE_ID Numeric 0 Pass in the main location id number. This is always required. This helps us keep track of inventory. If you're doing a transfer, this is the "from" store (where it came from). This value is corporation specific and can be looked up by going to the getGeneralLookupValues method. You'll be looking for the QRY_LOCATION_INFO_ARRAY data. Yes
Arguments SUB_INVOICE_TYPE_ID Numeric 0 Pass in the sub invoice type id number. 1=Normal, 2=Delivery, 3=Order, 4=Fulfilled, 5=Canceled. Yes


Results
RET_STATUS RET_MAIN_MESSAGE RET_SECOND_MESSAGE Redirect Link Description
ok Successfully created the new invoice in the database. Invoice # [number] Where can we take you? [printer friendly invoice] [printable invoice w/ nav] [edit invoice] [invoice homepage] [interactive map] [classic homepage] [start a new cart] This assumes that everything went well.
Name Type Description Notes
NEW_INVOICE_NUMBER Numeric This is the new invoice number that was set by the method. This invoice number automatically increases to make sure it is unique for every invoice.
dataIn Unable to create the new invoice. Missing some information. Use your back button and try again. This is returned if the corp id, customer id, invoice type id, other salesperson id, other store id, invoice created by id, salesperson id, or store id arguments are not found.
dataIn2 Unable to create the new invoice. Missing the date/time information. Use your back button and try again. This is returned if the date is not valid.
zeroCorp Unable to find the corporation info requested. Use your back button and try again. This is returned if the transition invoice name does not exist.
db Unable to connect to the database. The new invoice was not created in the database. Use your back button and try again. This is returned if there was an error in querying values such as transition invoice name, invoice number, invoice id, all monies, all paperwork, corp id, customer id, invoice amount, invoice date, pay date, stock, etc.


Samples
Caption Text
JSON
{"API_CALL_FUNCTION_NAME":"startMainInvoice","ADJUSTED_DATE_TIME":"2015-03-24 11:54:00","CORP_ID":53,"CUSTOMER_ID":23169,"INVOICE_CREATED_BY_ID":5130,"INVOICE_DATE":"2015-03-24","INVOICE_TYPE_ID":3,"OTHER_SALESPERSON_ID":1,"OTHER_STORE_ID":1,"SALESPERSON_ID":2,"STORE_ID":178,"EXTERNAL_PO_NUMBER":2,"INVOICE_AMOUNT":10.5,"INVOICE_NOTES":"Notes","PRINTABLE_INVOICE_NOTES":"Printable Notes","STOCK":8,"STOCK_UNIT_LIST":"List","API_CORP_KEY_ID":"PLA-0053","API_USER_NAME":"demo","API_USER_PASSWORD":"1234","API_CURRENT_PAYEE_ID":"3","API_INPUT_OUTPUT_TYPE":"JSON","API_URL_ENCODING":"AUTO","SUB_INVOICE_TYPE_ID":1}