Search.../

getCheckout( )

Retrieves a checkout.

Description

The getCheckout() function returns a Promise that resolves when the specified checkout is retrieved.

Syntax

function getCheckout(_id: string): Promise<Checkout>

getCheckout Parameters

NAME
TYPE
DESCRIPTION
_id
string

Checkout ID.

Returns

Fulfilled - the requested checkout.

Return Type:

Promise<
Checkout
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time the checkout was created.

_id
string

Checkout ID.

_updatedDate
Date

Date and time the checkout was updated.

additionalFees
Array<
AdditionalFee
>

Additional Fees.

appliedDiscounts
Array<
AppliedDiscount
>

Applied discounts.

billingInfo
AddressWithContact

Billing information.

buyerInfo
BuyerInfo

Buyer information.

buyerLanguage
string

Language for communication with the buyer. Defaults to the site language. For a site that supports multiple languages, this is the language the buyer selected.

buyerNote
string

Buyer note left by the customer.

calculationErrors
CalculationErrors

Errors when calculating totals.

cartId
string

Cart ID that this checkout was created from. Empty if this checkout wasn't created from a cart.

channelType
string

Sales channel that created the checkout. Supported values:

  • "WEB", "POS", "EBAY", "AMAZON", "WIX_APP_STORE", "WIX_INVOICES", "BACKOFFICE_MERCHANT", "WISH", "OTHER_PLATFORM".
completed
boolean

Whether an order was successfully created from this checkout. For an order to be successful, it must be successfully paid for (unless the total is 0).

conversionCurrency
string

All converted prices are displayed in this currency in three-letter ISO-4217 alphabetic format.

createdBy
CreatedBy

ID of the checkout's initiator.

currency
string

The currency used when submitting the order.

customFields
Array<
CustomField
>

Custom fields.

customSettings
CustomSettings

Additional settings for customization of the checkout process.

Custom settings can only be defined when creating a checkout.

extendedFields
ExtendedFields

Custom field data for the checkout object.

Extended fields must be configured in the Wix Dev Center before they can be accessed with API calls.

giftCard
GiftCard

Applied gift card details.

Note: Gift cards are supported through the Wix UI, though the SPI is not currently available. Learn more about Wix Gift Cards.

lineItems
Array<
LineItem
>

Line items.

Max: 300 items

membershipOptions
MembershipOptions

Memberships to apply when creating the order.

payLater
PriceSummary

Remaining amount for the order to be fully paid.

payNow
PriceSummary

Minimal amount to pay in order to place the order.

priceSummary
PriceSummary

Calculated price summary for the checkout.

purchaseFlowId
string

Persistent ID that correlates between the various eCommerce elements: cart, checkout, and order.

shippingInfo
ShippingInfo

Shipping information.

siteLanguage
string

Site language in which original values are shown.

taxIncludedInPrice
boolean

Whether tax is included in line item prices.

taxSummary
TaxSummary

Tax summary.

violations
Array<
Violation
>

List of validation violations raised by the Validations Custom Extension SPI.

weightUnit
string

Weight measurement unit - defaults to site's weight unit. Supported values:

  • "KG"
  • "LB"

Was this helpful?

Get a checkout

Copy Code
1/**************************************
2 * Backend code - my-backend-file.jsw *
3 *************************************/
4
5import { checkout } from 'wix-ecom-backend';
6
7export async function myGetCheckoutFunction(checkoutId) {
8 try {
9 const retrievedCheckout = await checkout.getCheckout(checkoutId);
10 console.log('Success! Retrieved checkout:', retrievedCheckout);
11 return retrievedCheckout;
12 } catch (error) {
13 console.error(error);
14 // Handle the error
15 }
16}
17
18/*************
19 * Page code *
20 ************/
21
22import { myGetCheckoutFunction } from 'backend/my-backend-file';
23
24// Sample checkoutId:
25const checkoutId = '74cc6825-82a1-4f1f-9fbb-7d73f6be152a';
26
27myGetCheckoutFunction(checkoutId)
28 .then((checkout) => {
29 const formattedCheckoutTotal = checkout.subtotal.formattedAmount;
30 const numOfCheckoutLineItems = checkout.lineItems.length;
31 console.log('Success! Retrieved checkout:', checkout);
32 return checkout;
33 })
34 .catch((error) => {
35 console.error(error);
36 // Handle the error
37 });
38
39/* Promise resolves to:
40 *
41 * {
42 * "_id": "74cc6825-82a1-4f1f-9fbb-7d73f6be152a",
43 * "lineItems": [
44 * {
45 * "_id": "00000000-0000-0000-0000-000000000001",
46 * "quantity": 3,
47 * "catalogReference": {
48 * "catalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a",
49 * "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
50 * },
51 * "productName": {
52 * "original": "Shirt",
53 * "translated": "Shirt"
54 * },
55 * "url": "https://example.wixsite.com",
56 * "price": {
57 * "amount": "10.00",
58 * "convertedAmount": "10.00",
59 * "formattedAmount": "$10.00",
60 * "formattedConvertedAmount": "$10.00"
61 * },
62 * "lineItemPrice": {
63 * "amount": "30.00",
64 * "convertedAmount": "30.00",
65 * "formattedAmount": "$30.00",
66 * "formattedConvertedAmount": "$30.00"
67 * },
68 * "fullPrice": {
69 * "amount": "10.00",
70 * "convertedAmount": "10.00",
71 * "formattedAmount": "$10.00",
72 * "formattedConvertedAmount": "$10.00"
73 * },
74 * "priceBeforeDiscounts": {
75 * "amount": "10.00",
76 * "convertedAmount": "10.00",
77 * "formattedAmount": "$10.00",
78 * "formattedConvertedAmount": "$10.00"
79 * },
80 * "totalPriceAfterTax": {
81 * "amount": "20.0",
82 * "convertedAmount": "20.0",
83 * "formattedAmount": "$20.00",
84 * "formattedConvertedAmount": "$20.00"
85 * },
86 * "totalPriceBeforeTax": {
87 * "amount": "20.0",
88 * "convertedAmount": "20.0",
89 * "formattedAmount": "$20.00",
90 * "formattedConvertedAmount": "$20.00"
91 * },
92 * "taxDetails": {
93 * "taxableAmount": {
94 * "amount": "20.0",
95 * "convertedAmount": "20.0",
96 * "formattedAmount": "$20.00",
97 * "formattedConvertedAmount": "$20.00"
98 * },
99 * "taxRate": "0.0",
100 * "totalTax": {
101 * "amount": "0.0",
102 * "convertedAmount": "0.0",
103 * "formattedAmount": "$0.00",
104 * "formattedConvertedAmount": "$0.00"
105 * },
106 * "rateBreakdown": []
107 * },
108 * "discount": {
109 * "amount": "10.0",
110 * "convertedAmount": "10.0",
111 * "formattedAmount": "$10.00",
112 * "formattedConvertedAmount": "$10.00"
113 * },
114 * "descriptionLines": [],
115 * "media": "wix:image://v1/3c76e2_c5331f937348492a97df87b0a3b34ea4~mv2.jpg#originWidth=1000&originHeight=1000",
116 * "availability": {
117 * "status": "AVAILABLE"
118 * },
119 * "physicalProperties": {
120 * "sku": "364115376135191",
121 * "shippable": true
122 * },
123 * "couponScopes": [
124 * {
125 * "namespace": "stores",
126 * "group": {
127 * "name": "collection",
128 * "entityId": "00000000-000000-000000-000000000001"
129 * }
130 * },
131 * {
132 * "namespace": "stores",
133 * "group": {
134 * "name": "product",
135 * "entityId": "c8539b66-7a44-fe18-affc-afec4be8562a"
136 * }
137 * }
138 * ],
139 * "itemType": {
140 * "preset": "PHYSICAL"
141 * },
142 * "paymentOption": "FULL_PAYMENT_ONLINE",
143 * "rootCatalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a"
144 * },
145 * {
146 * "_id": "00000000-0000-0000-0000-000000000002",
147 * "quantity": 1,
148 * "catalogReference": {
149 * "catalogItemId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e",
150 * "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
151 * "options": {
152 * "variantId": "2f430d69-9b75-4874-bfbd-c5f6fa5aff3d",
153 * "customTextFields": {
154 * "birthday card": "Happy Birthday!"
155 * }
156 * }
157 * },
158 * "productName": {
159 * "original": "Shoe",
160 * "translated": "Shoe"
161 * },
162 * "url": "https://example.wixsite.com",
163 * "price": {
164 * "amount": "85.00",
165 * "convertedAmount": "85.00",
166 * "formattedAmount": "$85.00",
167 * "formattedConvertedAmount": "$85.00"
168 * },
169 * "lineItemPrice": {
170 * "amount": "85.00",
171 * "convertedAmount": "85.00",
172 * "formattedAmount": "$85.00",
173 * "formattedConvertedAmount": "$85.00"
174 * },
175 * "fullPrice": {
176 * "amount": "85.00",
177 * "convertedAmount": "85.00",
178 * "formattedAmount": "$85.00",
179 * "formattedConvertedAmount": "$85.00"
180 * },
181 * "priceBeforeDiscounts": {
182 * "amount": "85.00",
183 * "convertedAmount": "85.00",
184 * "formattedAmount": "$85.00",
185 * "formattedConvertedAmount": "$85.00"
186 * },
187 * "totalPriceAfterTax": {
188 * "amount": "85.00",
189 * "convertedAmount": "85.00",
190 * "formattedAmount": "$85.00",
191 * "formattedConvertedAmount": "$85.00"
192 * },
193 * "totalPriceBeforeTax": {
194 * "amount": "85.00",
195 * "convertedAmount": "85.00",
196 * "formattedAmount": "$85.00",
197 * "formattedConvertedAmount": "$85.00"
198 * },
199 * "taxDetails": {
200 * "taxableAmount": {
201 * "amount": "85.00",
202 * "convertedAmount": "85.00",
203 * "formattedAmount": "$85.00",
204 * "formattedConvertedAmount": "$85.00"
205 * },
206 * "taxRate": "0.0",
207 * "totalTax": {
208 * "amount": "0.0",
209 * "convertedAmount": "0.0",
210 * "formattedAmount": "$0.00",
211 * "formattedConvertedAmount": "$0.00"
212 * },
213 * "rateBreakdown": []
214 * },
215 * "discount": {
216 * "amount": "0",
217 * "convertedAmount": "0",
218 * "formattedAmount": "$0.00",
219 * "formattedConvertedAmount": "$0.00"
220 * },
221 * "descriptionLines": [
222 * {
223 * "name": {
224 * "original": "Color",
225 * "translated": "Color"
226 * },
227 * "colorInfo": {
228 * "original": "Brown",
229 * "translated": "Brown",
230 * "code": "#783f04"
231 * },
232 * "lineType": "COLOR",
233 * "color": "Brown"
234 * },
235 * {
236 * "name": {
237 * "original": "birthday card",
238 * "translated": "birthday card"
239 * },
240 * "plainText": {
241 * "original": "Happy Birthday!",
242 * "translated": "Happy Birthday!"
243 * },
244 * "lineType": "PLAIN_TEXT",
245 * "plainTextValue": {
246 * "original": "Happy Birthday!",
247 * "translated": "Happy Birthday!"
248 * }
249 * }
250 * ],
251 * "media": "wix:image://v1/3c76e2_bf235c38610f4d2a905db71095b351cf~mv2.jpg#originWidth=1000&originHeight=1000",
252 * "availability": {
253 * "status": "AVAILABLE",
254 * "quantityAvailable": 30
255 * },
256 * "physicalProperties": {
257 * "sku": "364215376135191",
258 * "shippable": true
259 * },
260 * "couponScopes": [
261 * {
262 * "namespace": "stores",
263 * "group": {
264 * "name": "collection",
265 * "entityId": "00000000-000000-000000-000000000001"
266 * }
267 * },
268 * {
269 * "namespace": "stores",
270 * "group": {
271 * "name": "product",
272 * "entityId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e"
273 * }
274 * }
275 * ],
276 * "itemType": {
277 * "preset": "PHYSICAL"
278 * },
279 * "paymentOption": "FULL_PAYMENT_ONLINE",
280 * "rootCatalogItemId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e"
281 * },
282 * {
283 * "_id": "00000000-0000-0000-0000-000000000003",
284 * "quantity": 1,
285 * "catalogReference": {
286 * "catalogItemId": "9fe8c5b2-9c94-7153-ebb9-8533695e2b6f",
287 * "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
288 * "options": {
289 * "Size": "Large",
290 * "Color": "White"
291 * }
292 * },
293 * "price": {
294 * "amount": "",
295 * "convertedAmount": "",
296 * "formattedAmount": "",
297 * "formattedConvertedAmount": ""
298 * },
299 * "fullPrice": {
300 * "amount": "",
301 * "convertedAmount": "",
302 * "formattedAmount": "",
303 * "formattedConvertedAmount": ""
304 * },
305 * "priceBeforeDiscounts": {
306 * "amount": "",
307 * "convertedAmount": "",
308 * "formattedAmount": "",
309 * "formattedConvertedAmount": ""
310 * },
311 * "descriptionLines": [],
312 * "availability": {
313 * "status": "NOT_FOUND"
314 * },
315 * "couponScopes": [],
316 * "paymentOption": "FULL_PAYMENT_ONLINE"
317 * }
318 * ],
319 * "billingInfo": {
320 * "address": {
321 * "addressLine1": "235 West 23rd Street",
322 * "addressLine2": "3rd floor",
323 * "city": "New York",
324 * "subdivision": "US-NY",
325 * "country": "US",
326 * "postalCode": "10011"
327 * },
328 * "contactDetails": {
329 * "firstName": "Jane",
330 * "lastName": "Doe",
331 * "phone": "+1234567890"
332 * }
333 * },
334 * "shippingInfo": {
335 * "shippingDestination": {
336 * "address": {
337 * "addressLine1": "235 West 23rd Street",
338 * "addressLine2": "3rd floor",
339 * "city": "New York",
340 * "subdivision": "US-NY",
341 * "country": "US",
342 * "postalCode": "10011"
343 * },
344 * "contactDetails": {
345 * "firstName": "Jane",
346 * "lastName": "Doe",
347 * "phone": "+1234567890"
348 * }
349 * },
350 * "selectedCarrierServiceOption": {
351 * "code": "ed5bbce2-9533-dff4-7db0-13702fd139c5",
352 * "title": "Standard US Shipping",
353 * "logistics": {
354 * "deliveryTime": ""
355 * },
356 * "cost": {
357 * "totalPriceAfterTax": {
358 * "amount": "10.0",
359 * "convertedAmount": "10.0",
360 * "formattedAmount": "$10.00",
361 * "formattedConvertedAmount": "$10.00"
362 * },
363 * "totalPriceBeforeTax": {
364 * "amount": "10",
365 * "convertedAmount": "10",
366 * "formattedAmount": "$10.00",
367 * "formattedConvertedAmount": "$10.00"
368 * },
369 * "taxDetails": {
370 * "taxRate": "0.0",
371 * "totalTax": {
372 * "amount": "0.0",
373 * "convertedAmount": "0.0",
374 * "formattedAmount": "$0.00",
375 * "formattedConvertedAmount": "$0.00"
376 * },
377 * "rateBreakdown": []
378 * },
379 * "price": {
380 * "amount": "10",
381 * "convertedAmount": "10",
382 * "formattedAmount": "$10.00",
383 * "formattedConvertedAmount": "$10.00"
384 * }
385 * },
386 * "requestedShippingOption": true,
387 * "otherCharges": [],
388 * "carrierId": "c8a08776-c095-4dec-8553-8f9698d86adc"
389 * },
390 * "region": {
391 * "_id": "009fbe5d-89d3-7825-cbbf-1aab4d908b73",
392 * "name": "USA shipping"
393 * },
394 * "carrierServiceOptions": [
395 * {
396 * "carrierId": "c8a08776-c095-4dec-8553-8f9698d86adc",
397 * "shippingOptions": [
398 * {
399 * "code": "ed5bbce2-9533-dff4-7db0-13702fd139c5",
400 * "title": "Standard US Shipping",
401 * "logistics": {
402 * "deliveryTime": ""
403 * },
404 * "cost": {
405 * "price": {
406 * "amount": "10",
407 * "convertedAmount": "10",
408 * "formattedAmount": "$10.00",
409 * "formattedConvertedAmount": "$10.00"
410 * },
411 * "otherCharges": []
412 * }
413 * }
414 * ]
415 * }
416 * ]
417 * },
418 * "buyerNote": "Please wrap it up as a present",
419 * "buyerInfo": {
420 * "contactId": "f7dc17a6-825a-466e-a78e-c4abea0217db",
421 * "email": "Janedoe@example.com",
422 * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873"
423 * },
424 * "conversionCurrency": "USD",
425 * "priceSummary": {
426 * "subtotal": {
427 * "amount": "115.00",
428 * "convertedAmount": "115.00",
429 * "formattedAmount": "$115.00",
430 * "formattedConvertedAmount": "$115.00"
431 * },
432 * "shipping": {
433 * "amount": "10.0",
434 * "convertedAmount": "10.0",
435 * "formattedAmount": "$10.00",
436 * "formattedConvertedAmount": "$10.00"
437 * },
438 * "tax": {
439 * "amount": "0.0",
440 * "convertedAmount": "0.0",
441 * "formattedAmount": "$0.00",
442 * "formattedConvertedAmount": "$0.00"
443 * },
444 * "discount": {
445 * "amount": "10.0",
446 * "convertedAmount": "10.0",
447 * "formattedAmount": "$10.00",
448 * "formattedConvertedAmount": "$10.00"
449 * },
450 * "total": {
451 * "amount": "115.00",
452 * "convertedAmount": "115.00",
453 * "formattedAmount": "$115.00",
454 * "formattedConvertedAmount": "$115.00"
455 * }
456 * },
457 * "calculationErrors": {
458 * "orderValidationErrors": []
459 * },
460 * "appliedDiscounts": [
461 * {
462 * "discountType": "GLOBAL",
463 * "lineItemIds": [],
464 * "coupon": {
465 * "_id": "fbb94b06-7447-4161-9c48-59bfcdc39e77",
466 * "code": "SUMMERSALE10",
467 * "amount": {
468 * "amount": "10.0",
469 * "convertedAmount": "10.0",
470 * "formattedAmount": "$10.00",
471 * "formattedConvertedAmount": "$10.00"
472 * },
473 * "name": "SUMMERSALE10",
474 * "couponType": "MoneyOff"
475 * }
476 * }
477 * ],
478 * "customFields": [
479 * {
480 * "value": "12345",
481 * "title": "Tax ID",
482 * "translatedTitle": "Tax ID"
483 * }
484 * ],
485 * "weightUnit": "KG",
486 * "currency": "USD",
487 * "channelType": "WEB",
488 * "siteLanguage": "en",
489 * "buyerLanguage": "en",
490 * "completed": false,
491 * "taxIncludedInPrice": false,
492 * "createdBy": {
493 * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873"
494 * },
495 * "_createdDate": "2022-07-18T13:25:22.141Z",
496 * "_updatedDate": "2022-07-18T13:25:22.216Z",
497 * "payNow": {
498 * "subtotal": {
499 * "amount": "115.00",
500 * "convertedAmount": "115.00",
501 * "formattedAmount": "$115.00",
502 * "formattedConvertedAmount": "$115.00"
503 * },
504 * "shipping": {
505 * "amount": "10.0",
506 * "convertedAmount": "10.0",
507 * "formattedAmount": "$10.00",
508 * "formattedConvertedAmount": "$10.00"
509 * },
510 * "tax": {
511 * "amount": "0.0",
512 * "convertedAmount": "0.0",
513 * "formattedAmount": "$0.00",
514 * "formattedConvertedAmount": "$0.00"
515 * },
516 * "discount": {
517 * "amount": "10.0",
518 * "convertedAmount": "10.0",
519 * "formattedAmount": "$10.00",
520 * "formattedConvertedAmount": "$10.00"
521 * },
522 * "total": {
523 * "amount": "115.00",
524 * "convertedAmount": "115.00",
525 * "formattedAmount": "$115.00",
526 * "formattedConvertedAmount": "$115.00"
527 * }
528 * },
529 * "payLater": {
530 * "subtotal": {
531 * "amount": "0.00",
532 * "convertedAmount": "0.00",
533 * "formattedAmount": "$0.00",
534 * "formattedConvertedAmount": "$0.00"
535 * },
536 * "shipping": {
537 * "amount": "0.0",
538 * "convertedAmount": "0.0",
539 * "formattedAmount": "$0.00",
540 * "formattedConvertedAmount": "$0.00"
541 * },
542 * "tax": {
543 * "amount": "0.0",
544 * "convertedAmount": "0.0",
545 * "formattedAmount": "$0.00",
546 * "formattedConvertedAmount": "$0.00"
547 * },
548 * "discount": {
549 * "amount": "0.0",
550 * "convertedAmount": "0.0",
551 * "formattedAmount": "$0.00",
552 * "formattedConvertedAmount": "$0.00"
553 * },
554 * "total": {
555 * "amount": "0.00",
556 * "convertedAmount": "0.00",
557 * "formattedAmount": "$0.00",
558 * "formattedConvertedAmount": "$0.00"
559 * }
560 * },
561 * "membershipOptions": {
562 * "eligibleMemberships": [],
563 * "invalidMemberships": [],
564 * "selectedMemberships": {
565 * "memberships": []
566 * }
567 * }
568 * }
569 *
570 */