On the subject of operating your AR course of on NetSuite, one of the vital frequent duties you will do is creating gross sales orders.
Manually creating gross sales orders could be tedious – the NetSuite UI is just not very easy, and there are additional complexities which can be current solely within the API and never on the NetSuite UI software.
Nonetheless, the complexity of the NetSuite API could be tough to cope with. It takes quite a lot of devoted time (and energy) to arrange an API integration and really automate your NetSuite workflows.
On this information we’ll undergo a step-by-step course of on the best way to use the NetSuite API to create gross sales orders, in addition to automation options that may make the job simpler.
Nanonets automates gross sales order entry into NetSuite, and units up seamless 2-way matching with funds in lower than quarter-hour!
Understanding Gross sales Orders in NetSuite
A Gross sales Order is a transaction between a enterprise and a buyer the place the shopper commits to buying services or products. Gross sales orders are essential for monitoring stock, income, and buyer funds. NetSuite’s API lets you create, handle, and fulfill these orders programmatically.
There are 4 important varieties of gross sales orders in NetSuite:
- Normal Gross sales Order: The default sort for normal gross sales transactions the place fee is due upon supply.
- Normal Gross sales Order – Money: Used for gross sales transactions the place fee is made on the time of the sale.
- Normal Gross sales Order – Bill: Permits the sale to be invoiced at a later time, usually after the services or products has been delivered.
- Normal Gross sales Order – Progress Billing: Used for big initiatives that require billing in levels or milestones, as work progresses.
The usual gross sales order is probably the most versatile of all of those, and it will provide you with probably the most variety of choices to enter as fields. Whenever you create a regular gross sales order, you principally want to decide on these 5-6 fields:
- The client
- The transaction date (defaulted to the present date)
- The gross sales order standing (Pending Approval or Pending Achievement)
- The gadgets/companies that you’re promoting
- The fee phrases
- The fee methodology
Nonetheless, in lots of circumstances, it is perhaps helpful to make use of one of many different 3 varieties of gross sales orders – particularly if you already know upfront what sort of sale it’ll be (for eg. a money sale). The profit to doing that’s that lots of the fields will probably be pre-populated for you, saving effort and time.
Organising the NetSuite API
Earlier than you can begin creating gross sales orders utilizing the NetSuite API, you will have to arrange your account entry and guarantee correct authentication.
We have now revealed a separate, detailed information on establishing the NetSuite API – you possibly can at all times get began there after which come again right here.
In case you already know the best way to run API calls and simply want quick-start directions for NetSuite authentication, right here’s how you are able to do it:
Receive Account Credentials:
- Log in to your NetSuite account.
- Navigate to Setup > Firm > Allow Options.
- Beneath the SuiteCloud tab, be sure that REST Internet Companies and Token-Based mostly Authentication are enabled.

Create an Integration File:
- Go to Setup > Integration > Handle Integrations > New.
- Fill out the required fields, and notice down the Shopper Key and Shopper Secret offered.

Set Up Token-Based mostly Authentication (TBA):
- Navigate to Setup > Customers/Roles > Entry Tokens > New.
- Choose the combination file you created, and generate the Token ID and Token Secret.

Together with your Account ID, Shopper Key, Shopper Secret, Token ID, and Token Secret, you are now able to make authenticated API calls to NetSuite.
Making a Gross sales Order in NetSuite
The NetSuite API lets you create Gross sales Orders programmatically, making certain seamless integration between methods. Under is a step-by-step information to making a Gross sales Order utilizing NetSuite’s REST API in python.
Authentication
Earlier than making any API calls to NetSuite, you must authenticate utilizing OAuth 1.0. The next Python code makes use of the requests_oauthlib
library to authenticate the request utilizing your consumer_key
, consumer_secret
, token_key
, and token_secret
.
This is the way you authenticate utilizing OAuth 1.0:
import requests
from requests_oauthlib import OAuth1
# Authentication particulars
auth = OAuth1('consumer_key', 'consumer_secret', 'token_key', 'token_secret')
When you’re authenticated, you are able to construct your payloads.
Create Gross sales Order Payload
That is the principle payload that sends the gross sales order knowledge to NetSuite. On this, we’re in a position to outline what sort of gross sales order we’re creating. We take 2 examples under from the 4 varieties of gross sales orders that we noticed earlier.
1. Normal Merchandise-Based mostly Gross sales Order
In case your gross sales order entails tangible merchandise, right here’s the best way to construction the payload for the standard gross sales order:
item_payload = {
"entity": {"id": "1234"}, # Buyer ID
"trandate": "2024-09-01", # Transaction Date
"duedate": "2024-09-15", # Due Date
"foreign money": {"id": "1"}, # Foreign money ID (USD)
"phrases": {"id": "1"}, # Cost phrases
"merchandise": [
{
"item": {"id": "5678"}, # Item ID
"quantity": 10, # Quantity
"rate": 20.00 # Unit price
}
],
"memo": "Gross sales order for workplace provides"
}
2. Progress Billing Gross sales Order
For giant initiatives which can be billed incrementally, right here’s the construction for a progress billing gross sales order:
progress_billing_payload = {
"entity": {"id": "5678"}, # Buyer ID
"trandate": "2024-09-01", # Transaction Date
"duedate": "2024-09-15", # Due Date
"foreign money": {"id": "1"}, # Foreign money ID (USD)
"merchandise": [
{
"item": {"id": "service_item_id"}, # Service Item ID
"quantity": 1, # Quantity
"rate": 200.00, # Rate
"percentcomplete": 50 # Percentage complete for progress billing
}
],
"memo": "Consulting companies for September"
}
Ship POST Request
As soon as the payload is created, the following step is to ship a POST request to the NetSuite API utilizing the authenticated session. Under is the operate to deal with the request:
def create_sales_order(auth, payload):
url = "https://<account_id>.suitetalk.api.netsuite.com/companies/relaxation/file/v1/salesOrder"
headers = {"Content material-Kind": "software/json"}
# Ship POST request to create the gross sales order
response = requests.submit(url, json=payload, headers=headers, auth=auth)
return response
# Ship the gross sales order creation request
response = create_sales_order(auth, payload)
URL: That is the NetSuite REST API endpoint for creating gross sales orders. Substitute <account_id>
together with your precise NetSuite account ID.
Response Dealing with
As soon as the POST request is made, the API returns a response. You need to verify the standing of the response and deal with it accordingly. If the gross sales order is created efficiently, the response will embrace particulars such because the gross sales order ID and standing.
# Response Dealing with
if response.status_code == 200:
print("Gross sales Order created efficiently:", response.json())
else:
print("Error creating Gross sales Order:", response.status_code, response.textual content)
Instance of profitable Gross sales Order creation
As soon as the gross sales order is created efficiently it can present up within the NetSuite UI as under:

Obtain Full Code:
The core code for posting a gross sales order utilizing NetSuite stays constant. Nonetheless, the payload varies relying on the kind of gross sales order being added. Let’s discover the best way to ship a POST request so as to add numerous varieties of gross sales orders utilizing the NetSuite API.
Find out how to Retrieve Inside IDs in NetSuite
To populate the mandatory fields within the payloads (comparable to itemID
, currencyID
, termsID
, and accountID
), you will want to make use of NetSuite’s Inside IDs. These IDs correspond to particular entities, gadgets, or phrases inside your NetSuite account.
You could find these inside IDs by way of the next steps:
- NetSuite UI: Navigate to the related file (e.g., Vendor, Merchandise, or Account) within the NetSuite dashboard and allow “Inside IDs” underneath
Dwelling -> Set Preferences -> Normal -> Defaults -> Present Inside IDs
.

- Saved Searches: Navigate to Stories -> Saved Searches -> All Saved Searches within the NetSuite dashboard. Create a brand new search and choose the related file sort (e.g., Objects, Clients). Within the Outcomes tab, add the Inside ID subject as a column. Working the search will show the inner IDs of the chosen information in your outcomes.
- SuiteScript: You’ll be able to write and deploy a SuiteScript that retrieves inside IDs from information. After deploying the script, you possibly can run it to entry inside IDs to be used in your API calls. Under an instance of a easy SuiteScript to retrieve inside IDs of shoppers:
/**
* @NApiVersion 2.x
* @NScriptType Suitelet
*/
outline(['N/search'], operate(search) {
operate onRequest(context) {
var customerSearch = search.create({
sort: search.Kind.CUSTOMER,
columns: ['internalid', 'entityid'] // inside ID and Buyer title
});
var searchResult = customerSearch.run();
var prospects = [];
searchResult.every(operate(end result) {
prospects.push({
internalId: end result.getValue({ title: 'internalid' }),
customerName: end result.getValue({ title: 'entityid' })
});
return true; // proceed iteration
});
// Ship again response as JSON
context.response.write(JSON.stringify(prospects));
}
return {
onRequest: onRequest
};
});
With these inside IDs, you possibly can guarantee your API calls goal the proper information, bettering accuracy and effectivity in your gross sales order creation course of.
Dealing with Gross sales Order Fulfilment and Cost Situations in NetSuite
When creating gross sales orders in NetSuite, the kind of fee phrases that you simply’re making use of can differ, and can usually depend upon one other variable – when the gross sales order is getting fulfilled.
There are a number of frequent duties that you’ll normally should do:
- Apply a buyer fee to a Gross sales Order
- Dealing with reductions and credit
- Remodel a Gross sales Order into an Merchandise Fulfilment
Making use of Buyer Funds to Gross sales Orders
As soon as a gross sales order is created, buyer funds could be utilized utilizing this payload:
payment_data = {
"buyer": {"id": "customer_id"},
"salesOrder": {"id": "sales_order_id"},
"fee": {
"quantity": 500,
"methodology": {"id": "payment_method_id"} # Cost Technique ID (e.g., bank card)
}
}
payment_url="https://your_netsuite_instance/relaxation/customerpayment/v1/"
response = requests.submit(payment_url, json=payment_data, auth=auth)
print(response.json())
Making use of Reductions or Credit to Gross sales Orders
To use reductions or credit to a gross sales order, replace the payload like this:
sales_order_data["discountitem"] = {"id": "discount_id"} # Low cost ID
response = requests.submit(url, json=sales_order_data, auth=auth)
print(response.json())
Remodel a Gross sales Order into an Merchandise Fulfilment
As soon as a gross sales order is able to be fulfilled, you possibly can rework the gross sales order into an merchandise achievement utilizing the NetSuite API. This course of ensures that the gadgets within the gross sales order are marked as shipped or delivered.
This may be accomplished as a NetSuite rework – i.e., you alter the gross sales order to an merchandise fulfilment.
Right here’s an instance API name for instantly remodeling a gross sales order into merchandise achievement:
POST /file/v1/salesOrder/<Sales_Order_id>/!rework/itemFulfillment
{
"inventoryLocation": {
"id" : <location id>
}
...
}
Word that the inventoryLocation subject is obligatory when remodeling a Gross sales Order to an Merchandise Achievement (you must specify from the place within the stock you might be delivery the gadgets that you simply simply bought).
Frequent Pitfalls and Troubleshooting
Creating gross sales orders by way of the NetSuite API is a strong method to automate your AR course of, but it surely comes with its challenges. Listed here are some frequent pitfalls and the best way to keep away from them:
Pitfall | Resolution |
---|---|
Authentication Points | Double-check your tokens, keys, and permissions. Be certain that Token-Based mostly Authentication (TBA) is appropriately arrange. |
Lacking or Incorrect Fields | All the time discuss with the NetSuite API documentation to make sure all required fields are included and appropriately formatted. |
Information Synchronization Points | Implement common GET queries to confirm that the information in your system matches what’s in NetSuite. Think about using middleware or an integration platform to keep up synchronization. |
Price Limits | Monitor your API utilization and implement methods like request batching or throttling to remain inside limits. |
Dealing with Partial Exports | Implement error dealing with and logging to establish and handle partial exports promptly. |
Create Gross sales Orders on Netsuite utilizing Nanonets
Nanonets simplifies the method by dealing with the complexities of API authentication, scope administration, and error dealing with, making it an ideally suited end-to-end NetSuite automation workflow supplier.
By leveraging the AI-powered Nanonets platform, you possibly can automate the complete vendor invoice creation course of in NetSuite with minimal human intervention. This ensures quicker processing occasions, improved accuracy, and seamless integration together with your present workflows.
Nanonets intelligently extracts key knowledge out of your inside CRM in addition to paperwork, maps it instantly into NetSuite, and generates correct gross sales orders.
Right here’s a demo video exhibiting how one can arrange automated NetSuite workflows utilizing Nanonets in underneath 2 minutes.
Benefits of Utilizing Nanonets:
- Native NetSuite Connection: Handles all of the intricate particulars like API authentication and lacking fields.
- Out-of-the-Field Workflows: Simplifies duties like gross sales order creation and fee software.
- Correct Information Extraction: Leverages Gen AI fashions to extract knowledge from invoices and different paperwork.
- Person and Information Administration: Supplies options like doc storage and administration and crew collaboration.
- Approval Workflows: Permits for knowledge verification inside your crew earlier than posting to NetSuite.
By automating the gross sales order creation course of with Nanonets, you possibly can guarantee effectivity, accuracy, and scalability in your accounts receivable workflow, leaving the tedious duties to AI.
For extra info, try the Nanonets documentation.
Nanonets automates gross sales order and fee entry into NetSuite, plus units up seamless 2-way, 3-way, and 4-way matching in minutes!
Conclusion
Creating gross sales orders in NetSuite utilizing the API streamlines your accounts receivable course of, from dealing with a number of gadgets and recurring funds to making use of reductions.
However why cease at simply guide API calls? Nanonets takes automation a step additional. By harnessing AI, Nanonets automates the extraction and enter of essential gross sales order knowledge instantly into NetSuite, saving you time and eliminating the chance of human error.