API Reference
Resources
Retrieve an order
How to fetch a specific order via API
To fetch a single order, send a GET request to the /api/orders/:id endpoint, where id is the ID of the resource that you want to retrieve.

Request

GET https://yourdomain.commercelayer.io/api/orders/:id

Example

Request
Response
The following request fetches the order identified by the id "xYZkjABcde":
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/orders/xYZkjABcde' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token'
Copied!
On success, the API responds with a 200 OK status code, returning a single resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "orders",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde"
7
},
8
"attributes": {
9
"number": 1234,
10
"autorefresh": true,
11
"status": "draft",
12
"payment_status": "unpaid",
13
"fulfillment_status": "unfulfilled",
14
"guest": true,
15
"editable": true,
16
"customer_email": "[email protected]",
17
"language_code": "it",
18
"currency_code": "EUR",
19
"tax_included": true,
20
"tax_rate": 0.22,
21
"freight_taxable": true,
22
"requires_billing_info": false,
23
"country_code": "IT",
24
"shipping_country_code_lock": "IT",
25
"coupon_code": "SUMMERDISCOUNT",
26
"gift_card_code": "cc92c23e-967e-48b2-a323-59add603301f",
27
"gift_card_or_coupon_code": "cc92c23e-967e-48b2-a323-59add603301f",
28
"subtotal_amount_cents": 5000,
29
"subtotal_amount_float": 50.0,
30
"formatted_subtotal_amount": "€50,00",
31
"shipping_amount_cents": 1200,
32
"shipping_amount_float": 12.0,
33
"formatted_shipping_amount": "€12,00",
34
"payment_method_amount_cents": 0,
35
"payment_method_amount_float": 0.0,
36
"formatted_payment_method_amount": "€0,00",
37
"discount_amount_cents": -500,
38
"discount_amount_float": -5.0,
39
"formatted_discount_amount": "-€5,00",
40
"adjustment_amount_cents": 1500,
41
"adjustment_amount_float": 15.0,
42
"formatted_adjustment_amount": "€15,00",
43
"gift_card_amount_cents": 1500,
44
"gift_card_amount_float": 15.0,
45
"formatted_gift_card_amount": "€15,00",
46
"total_tax_amount_cents": 1028,
47
"total_tax_amount_float": 10.28,
48
"formatted_total_tax_amount": "€10,28",
49
"subtotal_tax_amount_cents": 902,
50
"subtotal_tax_amount_float": 9.02,
51
"formatted_subtotal_tax_amount": "€9,02",
52
"shipping_tax_amount_cents": 216,
53
"shipping_tax_amount_float": 2.16,
54
"formatted_shipping_tax_amount": "€2,16",
55
"payment_method_tax_amount_cents": 0,
56
"payment_method_tax_amount_float": 0.0,
57
"formatted_payment_method_tax_amount": "€0,00",
58
"adjustment_tax_amount_cents": 900,
59
"adjustment_tax_amount_float": 9.0,
60
"formatted_adjustment_tax_amount": "€9,00",
61
"total_amount_cents": 5700,
62
"total_amount_float": 57.0,
63
"formatted_total_amount": "€57,00",
64
"total_taxable_amount_cents": 4672,
65
"total_taxable_amount_float": 46.72,
66
"formatted_total_taxable_amount": "€46,72",
67
"subtotal_taxable_amount_cents": 4098,
68
"subtotal_taxable_amount_float": 40.98,
69
"formatted_subtotal_taxable_amount": "€40,98",
70
"shipping_taxable_amount_cents": 984,
71
"shipping_taxable_amount_float": 9.84,
72
"formatted_shipping_taxable_amount": "€9,84",
73
"payment_method_taxable_amount_cents": 0,
74
"payment_method_taxable_amount_float": 0.0,
75
"formatted_payment_method_taxable_amount": "€0,00",
76
"adjustment_taxable_amount_cents": 120,
77
"adjustment_taxable_amount_float": 1.2,
78
"formatted_adjustment_taxable_amount": "€1,20",
79
"total_amount_with_taxes_cents": 5700,
80
"total_amount_with_taxes_float": 57.0,
81
"formatted_total_amount_with_taxes": "€57,00",
82
"fees_amount_cents": 0,
83
"fees_amount_float": 0.0,
84
"formatted_fees_amount": "€0,00",
85
"duty_amount_cents": 0,
86
"duty_amount_float": 0.0,
87
"formatted_duty_amount": "€0,00",
88
"skus_count": 2,
89
"line_item_options_count": 1,
90
"shipments_count": 1,
91
"payment_source_details": {
92
"foo": "bar"
93
},
94
"token": "1c0994cc4e996e8c6ee56a2198f66f3c",
95
"cart_url": "https://yourdomain.com/cart",
96
"return_url": "https://yourdomain.com/",
97
"terms_url": "https://yourdomain.com/terms",
98
"privacy_url": "https://yourdomain.com/privacy",
99
"checkout_url": "https://yourdomain.commercelayer.io/checkout/1c0994cc4e996e8c6ee56a2198f66f3c",
100
"placed_at": "2018-01-01T12:00:00.000Z",
101
"approved_at": "2018-01-01T12:00:00.000Z",
102
"cancelled_at": "2018-01-01T12:00:00.000Z",
103
"payment_updated_at": "2018-01-01T12:00:00.000Z",
104
"fulfillment_updated_at": "2018-01-01T12:00:00.000Z",
105
"refreshed_at": "2018-01-01T12:00:00.000Z",
106
"archived_at": "2018-01-01T12:00:00.000Z",
107
"expires_at": "2018-01-01T12:00:00.000Z",
108
"created_at": "2018-01-01T12:00:00.000Z",
109
"updated_at": "2018-01-01T12:00:00.000Z",
110
"reference": "ANY-EXTERNAL-REFEFERNCE",
111
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
112
"metadata": {
113
"foo": "bar"
114
}
115
},
116
"relationships": {
117
"market": {
118
"links": {
119
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/market",
120
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/market"
121
}
122
},
123
"customer": {
124
"links": {
125
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/customer",
126
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/customer"
127
}
128
},
129
"shipping_address": {
130
"links": {
131
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/shipping_address",
132
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/shipping_address"
133
}
134
},
135
"billing_address": {
136
"links": {
137
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/billing_address",
138
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/billing_address"
139
}
140
},
141
"available_payment_methods": {
142
"links": {
143
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/available_payment_methods",
144
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/available_payment_methods"
145
}
146
},
147
"available_customer_payment_sources": {
148
"links": {
149
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/available_customer_payment_sources",
150
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/available_customer_payment_sources"
151
}
152
},
153
"payment_method": {
154
"links": {
155
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_method",
156
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_method"
157
}
158
},
159
"payment_source": {
160
"links": {
161
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/payment_source",
162
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/payment_source"
163
}
164
},
165
"line_items": {
166
"links": {
167
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/line_items",
168
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/line_items"
169
}
170
},
171
"shipments": {
172
"links": {
173
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/shipments",
174
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/shipments"
175
}
176
},
177
"transactions": {
178
"links": {
179
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/transactions",
180
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/transactions"
181
}
182
},
183
"authorizations": {
184
"links": {
185
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/authorizations",
186
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/authorizations"
187
}
188
},
189
"captures": {
190
"links": {
191
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/captures",
192
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/captures"
193
}
194
},
195
"voids": {
196
"links": {
197
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/voids",
198
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/voids"
199
}
200
},
201
"refunds": {
202
"links": {
203
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/refunds",
204
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/refunds"
205
}
206
},
207
"order_subscriptions": {
208
"links": {
209
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_subscriptions",
210
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_subscriptions"
211
}
212
},
213
"order_copies": {
214
"links": {
215
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/order_copies",
216
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/order_copies"
217
}
218
},
219
"attachments": {
220
"links": {
221
"self": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/relationships/attachments",
222
"related": "https://yourdomain.commercelayer.io/api/orders/xYZkjABcde/attachments"
223
}
224
}
225
},
226
"meta": {
227
"mode": "test"
228
}
229
}
230
}
Copied!
Last modified 2mo ago
Copy link