Type
|
Create
|
List
|
Orders
|
URL
|
http://{domain}/api/v2/orders/create.json
|
Accepts Filters
|
No
|
Output Attributes
|
No
|
Create Orders
These parameters are used for creating Orders
Key
|
Data Type
|
Required
|
Example
|
Notes
|
sale_channel
|
int
|
Yes
|
2
|
|
customer_type
|
int
|
No
|
2
|
What type of customer to create
|
alternate_order_id
|
string
|
No
|
X4545RL0
|
An alternative order ID.
|
shipping_cost
|
decimal
|
Yes
|
15.57
|
Price paid for shipping
|
shipping_provider
|
int
|
Yes
|
5
|
ID of the shipping provider
|
placed
|
int/string
|
No
|
UNIX timestamp (871708681)
|
If not passed, it will use the current time.
|
notes
|
string
|
No
|
|
Any additional notes.
|
Customer
All customer data is a subvalue under the array value "customer"
Key
|
Data Type
|
Required
|
Example
|
Notes
|
first
|
string
|
Yes
|
Jack
|
|
last
|
string
|
Yes
|
Jones
|
|
phone
|
string
|
No
|
619.555.1212
|
|
email
|
string
|
Yes
|
[email protected]
|
|
company
|
string
|
No
|
Jack Inc
|
|
Products
All product data is a subvalue under the array value "products"
Key
|
Data Type
|
Required
|
Example
|
Notes
|
sku
|
string
|
Yes
|
1154-8211
|
|
qty
|
int
|
Yes
|
6
|
Quantity of items
|
shipping_class
|
int
|
Yes
|
51
|
Must be part of Shipping Provider
|
address
|
array
|
Yes
|
|
See Customer Address section for values
|
price
|
decimal
|
Yes
|
16.58
|
|
tax
|
decimal
|
No
|
1.65
|
|
Payments
All payment data is a subvalue under the array value
"payments".
This will allow for payments to be made. You can use multiple
payments for
Key
|
Data Type
|
Required
|
Example
|
Notes
|
amount
|
decimal
|
Yes
|
16.85
|
|
date
|
string
|
No
|
UNIX timestamp (871708681)
|
This will use the date of the api request if not passed.
|
address
|
array
|
No
|
|
See Customer Address section for values.
|
data1
|
string
|
No
|
|
|
data2
|
string
|
No
|
|
|
data3
|
string
|
No
|
|
|
data4
|
string
|
No
|
|
|
notes
|
string
|
No
|
Some additional notes about this transaction
|
Any Additional Notes
|
Customer Address
All payment data is a subvalue under the array value "address".
This section will create the address for the customer. This is not
required.
Key
|
Data Type
|
Required
|
Example
|
Notes
|
full_name
|
string
|
Yes
|
Tom Smith
|
Customer full name for shipping
|
status
|
int/string
|
No
|
1
|
Set address status, default to active if not set
|
address_1
|
string
|
Yes
|
5000 Parkway Ave.
|
Customer street address
|
address_2
|
string
|
No
|
|
|
city
|
string
|
Yes
|
Los Angeles
|
|
subregion
|
string
|
Yes
|
CA
|
Customer state (abbr)
|
postal_code
|
string
|
Yes
|
90210
|
|
region
|
string
|
Yes
|
United States
|
Customer country
|
phone
|
string
|
No
|
310-555-9876
|
|
Request
Example cURL request
curl -X POST 'https://{yourdomain}/api/v2/orders/create.json'
--header 'Content-Type: application/x-www-form-urlencoded'
-u '{your-identifier}:{your-key}'
--data-urlencode 'data={
"inserts": [
{
"sale_channel": 1,
"placed": 1523915832,
"customer": {
"customer_type": 1,
"first": "Tina",
"last": "API 2",
"phone": "(602) 803-0408",
"email": "[email protected]",
"company": "Tina Turner"
},
"shipping_provider": 5,
"shipping_cost": "0",
"products": [
{
"sku": "450-0009-1",
"name": "4812393036 Product",
"qty": 1,
"price": 5,
"tax": 0.1,
"shipping_class": 52,
"address": {
"full_name": "Jackie Richardson",
"biz_name": "Happy Hair Salon & Boutique",
"address_1": "3480 Drusilla Ln Ste A",
"address_2": "",
"city": "Baton Rouge",
"subregion": "LA",
"postal_code": "70809-1866",
"region": "US",
"phone": ""
}
}
],
"payments": [
{
"amount": 55.25,
"date": 1523548459,
"data1": "payment_type",
"data2": "",
"address": {
"full_name": "Anna Curry",
"address_1": "10720 Linkwood Court",
"address_2": "221",
"city": "Baton Rouge",
"subregion": "LA",
"postal_code": "70810",
"region": "US",
"phone": "(702) 485-7480"
}
}
],
"notes": "this is my order note",
"attributes": [],
"files": {
"xml_file": ""
},
"discounts": [
{
"discount_type": "order",
"discount": "9.74",
"description": "order discount"
}
]
}
]
}
'
Response
Example JSON returned
{
"code": "200",
"data": [
{
"id": "1",
"title": "Order 10000",
"tag": "6JLS05DNEBSWH6EZVH56VJX23"
}
]
}