Get an Order
GET
Get by ID
https://api.moltin.com/v2/orders/:id
Parameters
Path parameters
Name | Required | Type | Description |
---|---|---|---|
id | Required | string | The ID of the order. |
Headers
Name | Required | Type | Description |
---|---|---|---|
Authorization | Required | string | The Bearer token required to get access to the API. |
include | Optional | string | The information included, such as items , account , or account_member . |
x-moltin-customer-token | Optional | string | A customer token to access a specific customer order. |
Request Examples
Curl
curl -X GET https://api.moltin.com/v2/orders/:id \
-H "Authorization: Bearer XXXX"
JavaScript SDK
const MoltinGateway = require("@moltin/sdk").gateway;
const Moltin = MoltinGateway({
client_id: "X",
client_secret: "X",
});
const id = "XXXX";
Moltin.Orders.Get(id).then((orders) => {
// Do something
});
// Get order with items
Moltin.Orders.With("items")
.Get(id)
.then((orders) => {
// Do something
});
Response Example
The following response contains accounts and account members in the included
section:
200 OK
{
"data": {
"type": "order",
"id": "369ad4a4-ee67-48b0-x347-t50a6e61d83d",
"status": "incomplete",
"payment": "unpaid",
"shipping": "unfulfilled",
"customer": {
"name": "Mr John Doe",
"email": "johndoe@example.com"
},
"shipping_address": {
"first_name": "John",
"last_name": "Doe",
"phone_number": "",
"company_name": "",
"line_1": "1234 Disney Drive",
"line_2": "Disney Resort",
"city": "Anaheim",
"county": "Orange",
"region": "CA",
"postcode": "92802",
"country": "US",
"instructions": ""
},
"billing_address": {
"first_name": "John",
"last_name": "Doe",
"company_name": "",
"line_1": "1234 Disney Drive",
"line_2": "Disney Resort",
"city": "Anaheim",
"county": "Orange",
"region": "CA",
"postcode": "92802",
"country": "US"
},
"links": {},
"meta": {
"display_price": {
"with_tax": {
"amount": 237500,
"currency": "USD",
"formatted": "$2175.00"
},
"without_tax": {
"amount": 237500,
"currency": "USD",
"formatted": "$2175.00"
},
"tax": {
"amount": 0,
"currency": "",
"formatted": ""
}
},
"timestamps": {
"created_at": "2018-04-16T10:11:59.715Z",
"updated_at": "2018-04-16T10:11:59.715Z"
}
},
"relationships": {
"items": {
"data": [
{
"type": "item",
"id": "de9fddf5-011b-4485-abf8-ebb8f53c39ff"
}
]
},
"account": {
"data": {
"type": "account",
"id": "b6e47478-7e7f-4127-b7e9-4a255564ae68"
}
},
"account_member": {
"data": {
"type": "account-member",
"id": "c8c1c511-beef-4812-9b7a-9f92c587217c"
}
}
},
"included": {
"accounts": [
{
"id": "b6e47478-7e7f-4127-b7e9-4a255564ae68",
"type": "account",
"name": "acc-name",
"legal_name": "acc-legal-name",
"registration_id": "00000000-0000-1000-8000-000f00000300"
}
],
"account_members": [
{
"id": "c8c1c511-beef-4812-9b7a-9f92c587217c",
"type": "account_member",
"name": "John Smith",
"email": "john@smith.com"
}
]
}
}
}
GET
Include Custom Discounts
https://api.moltin.com/v2/orders/:id?include=custom_discounts
Parameters
Path parameters
Name | Required | Type | Description |
---|---|---|---|
id | Required | string | The ID of the order. |
Query parameters
Name | Required | Type | Description |
---|---|---|---|
include | Required | string | The custom discounts for the order. |
Request Example - Curl
curl -X GET https://api.moltin.com/v2/orders/:id?include=custom_discounts \
-H "Authorization: Bearer XXXX"
Response Example
200 OK
{
"data": {
"id": "a51a680e-9570-4f8d-9bbc-bd3c9fcd9ea3",
"type": "order",
"status": "incomplete",
"payment": "unpaid",
"shipping": "unfulfilled",
"anonymized": false,
"customer": {
"name": "John Doe",
"email": "andy@example.com"
},
"shipping_address": {
"first_name": "Andy",
"last_name": "Dwyer",
"phone_number": "123-456-1111",
"company_name": "Elasticpath",
"line_1": "1 Sunny Street",
"line_2": "",
"city": "Sunny Town",
"postcode": "v1v 1v1",
"county": "BC",
"country": "CA",
"instructions": ""
},
"billing_address": {
"first_name": "Andy",
"last_name": "Dwyer",
"company_name": "Elasticpath",
"line_1": "1 Sunny Street",
"line_2": "",
"city": "Sunny Town",
"postcode": "v1v 1v1",
"county": "BC",
"country": "CA"
},
"links": {},
"meta": {
"display_price": {
"with_tax": {
"amount": 8500,
"currency": "USD",
"formatted": "$85.00"
},
"without_tax": {
"amount": 8500,
"currency": "USD",
"formatted": "$85.00"
},
"tax": {
"amount": 0,
"currency": "USD",
"formatted": "$0.00"
},
"discount": {
"amount": -1500,
"currency": "USD",
"formatted": "-$15.00"
},
"balance_owing": {
"amount": 8500,
"currency": "USD",
"formatted": "$85.00"
},
"paid": {
"amount": 0,
"currency": "USD",
"formatted": "$0.00"
},
"authorized": {
"amount": 0,
"currency": "USD",
"formatted": "$0.00"
},
"without_discount": {
"amount": 10000,
"currency": "USD",
"formatted": "$100.00"
}
},
"timestamps": {
"created_at": "2023-04-19T23:08:57Z",
"updated_at": "2023-04-19T23:08:57Z"
}
},
"relationships": {
"items": {
"data": [
{
"type": "item",
"id": "8addeb0a-3117-4583-bb92-efd7a7aa91b5"
}
]
},
"custom_discounts": {
"data": [
{
"type": "custom_discount",
"id": "4b3ec5f2-941f-4125-89d7-5885b3e9782b"
}
]
}
}
},
"included": {
"custom_discounts": [
{
"amount": {
"amount": -500,
"currency": "USD"
},
"type": "custom_discount",
"id": "3e36ad8e-cf3e-463d-8332-ef569ffc819c",
"external_id": "item custom discount",
"discount_engine": "Custom Discount Engine",
"description": "custom discount description",
"discount_code": "item custom-code"
},
{
"amount": {
"amount": -1000,
"currency": "USD"
},
"type": "custom_discount",
"id": "4b3ec5f2-941f-4125-89d7-5885b3e9782b",
"external_id": "cart custom discount",
"discount_engine": "Custom Discount Engine",
"description": "custom discount description",
"discount_code": "cart custom-code"
}
]
}
}