Search.../

createCheckout( )

Creates a checkout.

Description

The createCheckout() function returns a Promise that resolves to the new checkout when it's created.

Notes:

  • Checkout must include at least 1 item in the options.lineItems array.
  • options.channelType is required.
  • If _id for options.lineItems is added, make sure that each _id is unique.
  • If options.checkoutInfo.customFields are added, then options.checkoutInfo.customFields.value is required.

Syntax

function createCheckout(options: CreateCheckoutOptions): Promise<Checkout>

createCheckout Parameters

NAME
TYPE
DESCRIPTION
options
Optional
CreateCheckoutOptions

Checkout creation options.

Returns

Fulfilled - the newly created 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?

Create a checkout with minimum required properties

Copy Code
1/**************************************
2 * Backend code - my-backend-file.jsw *
3 *************************************/
4
5import { checkout } from 'wix-ecom-backend';
6
7export async function myCreateCheckoutFunction(options) {
8 try {
9 const newCheckout = await checkout.createCheckout(options);
10 console.log('Success! Checkout created, checkout:', newCheckout);
11 return newCheckout;
12 } catch (error) {
13 console.error(error);
14 // Handle the error
15 }
16}
17
18/*************
19 * Page code *
20 ************/
21
22import { myCreateCheckoutFunction } from 'backend/my-backend-file';
23
24// Sample options object:
25const options = {
26 "lineItems": [{
27 "quantity": 3,
28 "catalogReference": {
29 // Wix Stores appId
30 "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
31 // Wix Stores productId
32 "catalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a"
33 }
34 }],
35 "channelType": "WEB"
36}
37
38myCreateCheckoutFunction(options)
39 .then((newCheckout) => {
40 console.log('Success! Checkout created:', newCheckout);
41 return newCheckout;
42 })
43 .catch((error) => {
44 console.error(error);
45 // Handle the error
46 });
47
48/* Promise resolves to:
49 *
50 * {
51 * "_id": "8a27ba84-0814-4b0e-8db3-b6057a421bd9",
52 * "lineItems": [
53 * {
54 * "_id": "00000000-0000-0000-0000-000000000001",
55 * "quantity": 3,
56 * "catalogReference": {
57 * "catalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a",
58 * "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
59 * },
60 * "productName": {
61 * "original": "Shirt",
62 * "translated": "Shirt"
63 * },
64 * "url": "https://example.wixsite.com",
65 * "price": {
66 * "amount": "10",
67 * "convertedAmount": "10",
68 * "formattedAmount": "$10.00",
69 * "formattedConvertedAmount": "$10.00"
70 * },
71 * "lineItemPrice": {
72 * "amount": "30",
73 * "convertedAmount": "30",
74 * "formattedAmount": "$30.00",
75 * "formattedConvertedAmount": "$30.00"
76 * },
77 * "fullPrice": {
78 * "amount": "10",
79 * "convertedAmount": "10",
80 * "formattedAmount": "$10.00",
81 * "formattedConvertedAmount": "$10.00"
82 * },
83 * "priceBeforeDiscounts": {
84 * "amount": "10",
85 * "convertedAmount": "10",
86 * "formattedAmount": "$10.00",
87 * "formattedConvertedAmount": "$10.00"
88 * },
89 * "totalPriceAfterTax": {
90 * "amount": "30",
91 * "convertedAmount": "30",
92 * "formattedAmount": "$30.00",
93 * "formattedConvertedAmount": "$30.00"
94 * },
95 * "totalPriceBeforeTax": {
96 * "amount": "30",
97 * "convertedAmount": "30",
98 * "formattedAmount": "$30.00",
99 * "formattedConvertedAmount": "$30.00"
100 * },
101 * "taxDetails": {
102 * "taxableAmount": {
103 * "amount": "30",
104 * "convertedAmount": "30",
105 * "formattedAmount": "$30.00",
106 * "formattedConvertedAmount": "$30.00"
107 * },
108 * "taxRate": "0",
109 * "totalTax": {
110 * "amount": "0",
111 * "convertedAmount": "0",
112 * "formattedAmount": "$0.00",
113 * "formattedConvertedAmount": "$0.00"
114 * },
115 * "rateBreakdown": []
116 * },
117 * "discount": {
118 * "amount": "0",
119 * "convertedAmount": "0",
120 * "formattedAmount": "$0.00",
121 * "formattedConvertedAmount": "$0.00"
122 * },
123 * "descriptionLines": [],
124 * "media": "wix:image://v1/3c76e2_c5331f937348492a97df87b0a3b34ea4~mv2.jpg#originWidth=1000&originHeight=1000",
125 * "availability": {
126 * "status": "AVAILABLE"
127 * },
128 * "physicalProperties": {
129 * "sku": "364115376135191",
130 * "shippable": true
131 * },
132 * "couponScopes": [
133 * {
134 * "namespace": "stores",
135 * "group": {
136 * "name": "collection",
137 * "entityId": "00000000-000000-000000-000000000001"
138 * }
139 * },
140 * {
141 * "namespace": "stores",
142 * "group": {
143 * "name": "product",
144 * "entityId": "c8539b66-7a44-fe18-affc-afec4be8562a"
145 * }
146 * }
147 * ],
148 * "itemType": {
149 * "preset": "PHYSICAL"
150 * },
151 * "paymentOption": "FULL_PAYMENT_ONLINE",
152 * "rootCatalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a"
153 * }
154 * ],
155 * "shippingInfo": {
156 * "carrierServiceOptions": []
157 * },
158 * "buyerInfo": {
159 * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873"
160 * },
161 * "conversionCurrency": "USD",
162 * "priceSummary": {
163 * "subtotal": {
164 * "amount": "30",
165 * "convertedAmount": "30",
166 * "formattedAmount": "$30.00",
167 * "formattedConvertedAmount": "$30.00"
168 * },
169 * "shipping": {
170 * "amount": "0",
171 * "convertedAmount": "0",
172 * "formattedAmount": "$0.00",
173 * "formattedConvertedAmount": "$0.00"
174 * },
175 * "tax": {
176 * "amount": "0",
177 * "convertedAmount": "0",
178 * "formattedAmount": "$0.00",
179 * "formattedConvertedAmount": "$0.00"
180 * },
181 * "discount": {
182 * "amount": "0",
183 * "convertedAmount": "0",
184 * "formattedAmount": "$0.00",
185 * "formattedConvertedAmount": "$0.00"
186 * },
187 * "total": {
188 * "amount": "30",
189 * "convertedAmount": "30",
190 * "formattedAmount": "$30.00",
191 * "formattedConvertedAmount": "$30.00"
192 * }
193 * },
194 * "calculationErrors": {
195 * "orderValidationErrors": []
196 * },
197 * "appliedDiscounts": [],
198 * "customFields": [],
199 * "weightUnit": "KG",
200 * "currency": "USD",
201 * "channelType": "WEB",
202 * "siteLanguage": "en",
203 * "buyerLanguage": "en",
204 * "completed": false,
205 * "taxIncludedInPrice": false,
206 * "createdBy": {
207 * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873"
208 * },
209 * "_createdDate": "2022-07-18T13:39:03.023Z",
210 * "_updatedDate": "2022-07-18T13:39:03.023Z",
211 * "payNow": {
212 * "subtotal": {
213 * "amount": "30",
214 * "convertedAmount": "30",
215 * "formattedAmount": "$30.00",
216 * "formattedConvertedAmount": "$30.00"
217 * },
218 * "shipping": {
219 * "amount": "0",
220 * "convertedAmount": "0",
221 * "formattedAmount": "$0.00",
222 * "formattedConvertedAmount": "$0.00"
223 * },
224 * "tax": {
225 * "amount": "0",
226 * "convertedAmount": "0",
227 * "formattedAmount": "$0.00",
228 * "formattedConvertedAmount": "$0.00"
229 * },
230 * "discount": {
231 * "amount": "0",
232 * "convertedAmount": "0",
233 * "formattedAmount": "$0.00",
234 * "formattedConvertedAmount": "$0.00"
235 * },
236 * "total": {
237 * "amount": "30",
238 * "convertedAmount": "30",
239 * "formattedAmount": "$30.00",
240 * "formattedConvertedAmount": "$30.00"
241 * }
242 * },
243 * "payLater": {
244 * "subtotal": {
245 * "amount": "0",
246 * "convertedAmount": "0",
247 * "formattedAmount": "$0.00",
248 * "formattedConvertedAmount": "$0.00"
249 * },
250 * "shipping": {
251 * "amount": "0",
252 * "convertedAmount": "0",
253 * "formattedAmount": "$0.00",
254 * "formattedConvertedAmount": "$0.00"
255 * },
256 * "tax": {
257 * "amount": "0",
258 * "convertedAmount": "0",
259 * "formattedAmount": "$0.00",
260 * "formattedConvertedAmount": "$0.00"
261 * },
262 * "discount": {
263 * "amount": "0",
264 * "convertedAmount": "0",
265 * "formattedAmount": "$0.00",
266 * "formattedConvertedAmount": "$0.00"
267 * },
268 * "total": {
269 * "amount": "0",
270 * "convertedAmount": "0",
271 * "formattedAmount": "$0.00",
272 * "formattedConvertedAmount": "$0.00"
273 * }
274 * },
275 * "membershipOptions": {
276 * "eligibleMemberships": [],
277 * "invalidMemberships": [],
278 * "selectedMemberships": {
279 * "memberships": []
280 * }
281 * }
282 * }
283 *
284 */
Create a checkout with minimum required properties (export from backend code)

Copy Code
1/*****************************************
2 * Backend code - my-backend-file.web.js *
3 ****************************************/
4
5import { Permissions, webMethod } from 'wix-web-module';
6import { checkout } from 'wix-ecom-backend';
7
8export const myCreateCheckoutFunction = webMethod(Permissions.Anyone, async (options) => {
9 try {
10 const newCheckout = await checkout.createCheckout(options);
11 console.log('Success! Checkout created, checkout:', newCheckout);
12 return newCheckout;
13 } catch (error) {
14 console.error(error);
15 // Handle the error
16 }
17});
18
19/*************
20 * Page code *
21 ************/
22
23import { myCreateCheckoutFunction } from 'backend/my-backend-file.web';
24
25// Sample options object:
26const options = {
27 "lineItems": [{
28 "quantity": 3,
29 "catalogReference": {
30 // Wix Stores appId
31 "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
32 // Wix Stores productId
33 "catalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a"
34 }
35 }],
36 "channelType": "WEB"
37}
38
39myCreateCheckoutFunction(options)
40 .then((newCheckout) => {
41 console.log('Success! Checkout created:', newCheckout);
42 return newCheckout;
43 })
44 .catch((error) => {
45 console.error(error);
46 // Handle the error
47 });
48
49/* Promise resolves to:
50 *
51 * {
52 * "_id": "8a27ba84-0814-4b0e-8db3-b6057a421bd9",
53 * "lineItems": [
54 * {
55 * "_id": "00000000-0000-0000-0000-000000000001",
56 * "quantity": 3,
57 * "catalogReference": {
58 * "catalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a",
59 * "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
60 * },
61 * "productName": {
62 * "original": "Shirt",
63 * "translated": "Shirt"
64 * },
65 * "url": "https://example.wixsite.com",
66 * "price": {
67 * "amount": "10",
68 * "convertedAmount": "10",
69 * "formattedAmount": "$10.00",
70 * "formattedConvertedAmount": "$10.00"
71 * },
72 * "lineItemPrice": {
73 * "amount": "30",
74 * "convertedAmount": "30",
75 * "formattedAmount": "$30.00",
76 * "formattedConvertedAmount": "$30.00"
77 * },
78 * "fullPrice": {
79 * "amount": "10",
80 * "convertedAmount": "10",
81 * "formattedAmount": "$10.00",
82 * "formattedConvertedAmount": "$10.00"
83 * },
84 * "priceBeforeDiscounts": {
85 * "amount": "10",
86 * "convertedAmount": "10",
87 * "formattedAmount": "$10.00",
88 * "formattedConvertedAmount": "$10.00"
89 * },
90 * "totalPriceAfterTax": {
91 * "amount": "30",
92 * "convertedAmount": "30",
93 * "formattedAmount": "$30.00",
94 * "formattedConvertedAmount": "$30.00"
95 * },
96 * "totalPriceBeforeTax": {
97 * "amount": "30",
98 * "convertedAmount": "30",
99 * "formattedAmount": "$30.00",
100 * "formattedConvertedAmount": "$30.00"
101 * },
102 * "taxDetails": {
103 * "taxableAmount": {
104 * "amount": "30",
105 * "convertedAmount": "30",
106 * "formattedAmount": "$30.00",
107 * "formattedConvertedAmount": "$30.00"
108 * },
109 * "taxRate": "0",
110 * "totalTax": {
111 * "amount": "0",
112 * "convertedAmount": "0",
113 * "formattedAmount": "$0.00",
114 * "formattedConvertedAmount": "$0.00"
115 * },
116 * "rateBreakdown": []
117 * },
118 * "discount": {
119 * "amount": "0",
120 * "convertedAmount": "0",
121 * "formattedAmount": "$0.00",
122 * "formattedConvertedAmount": "$0.00"
123 * },
124 * "descriptionLines": [],
125 * "media": "wix:image://v1/3c76e2_c5331f937348492a97df87b0a3b34ea4~mv2.jpg#originWidth=1000&originHeight=1000",
126 * "availability": {
127 * "status": "AVAILABLE"
128 * },
129 * "physicalProperties": {
130 * "sku": "364115376135191",
131 * "shippable": true
132 * },
133 * "couponScopes": [
134 * {
135 * "namespace": "stores",
136 * "group": {
137 * "name": "collection",
138 * "entityId": "00000000-000000-000000-000000000001"
139 * }
140 * },
141 * {
142 * "namespace": "stores",
143 * "group": {
144 * "name": "product",
145 * "entityId": "c8539b66-7a44-fe18-affc-afec4be8562a"
146 * }
147 * }
148 * ],
149 * "itemType": {
150 * "preset": "PHYSICAL"
151 * },
152 * "paymentOption": "FULL_PAYMENT_ONLINE",
153 * "rootCatalogItemId": "c8539b66-7a44-fe18-affc-afec4be8562a"
154 * }
155 * ],
156 * "shippingInfo": {
157 * "carrierServiceOptions": []
158 * },
159 * "buyerInfo": {
160 * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873"
161 * },
162 * "conversionCurrency": "USD",
163 * "priceSummary": {
164 * "subtotal": {
165 * "amount": "30",
166 * "convertedAmount": "30",
167 * "formattedAmount": "$30.00",
168 * "formattedConvertedAmount": "$30.00"
169 * },
170 * "shipping": {
171 * "amount": "0",
172 * "convertedAmount": "0",
173 * "formattedAmount": "$0.00",
174 * "formattedConvertedAmount": "$0.00"
175 * },
176 * "tax": {
177 * "amount": "0",
178 * "convertedAmount": "0",
179 * "formattedAmount": "$0.00",
180 * "formattedConvertedAmount": "$0.00"
181 * },
182 * "discount": {
183 * "amount": "0",
184 * "convertedAmount": "0",
185 * "formattedAmount": "$0.00",
186 * "formattedConvertedAmount": "$0.00"
187 * },
188 * "total": {
189 * "amount": "30",
190 * "convertedAmount": "30",
191 * "formattedAmount": "$30.00",
192 * "formattedConvertedAmount": "$30.00"
193 * }
194 * },
195 * "calculationErrors": {
196 * "orderValidationErrors": []
197 * },
198 * "appliedDiscounts": [],
199 * "customFields": [],
200 * "weightUnit": "KG",
201 * "currency": "USD",
202 * "channelType": "WEB",
203 * "siteLanguage": "en",
204 * "buyerLanguage": "en",
205 * "completed": false,
206 * "taxIncludedInPrice": false,
207 * "createdBy": {
208 * "memberId": "c43190d2-eea3-493e-b6e8-f146850c6873"
209 * },
210 * "_createdDate": "2022-07-18T13:39:03.023Z",
211 * "_updatedDate": "2022-07-18T13:39:03.023Z",
212 * "payNow": {
213 * "subtotal": {
214 * "amount": "30",
215 * "convertedAmount": "30",
216 * "formattedAmount": "$30.00",
217 * "formattedConvertedAmount": "$30.00"
218 * },
219 * "shipping": {
220 * "amount": "0",
221 * "convertedAmount": "0",
222 * "formattedAmount": "$0.00",
223 * "formattedConvertedAmount": "$0.00"
224 * },
225 * "tax": {
226 * "amount": "0",
227 * "convertedAmount": "0",
228 * "formattedAmount": "$0.00",
229 * "formattedConvertedAmount": "$0.00"
230 * },
231 * "discount": {
232 * "amount": "0",
233 * "convertedAmount": "0",
234 * "formattedAmount": "$0.00",
235 * "formattedConvertedAmount": "$0.00"
236 * },
237 * "total": {
238 * "amount": "30",
239 * "convertedAmount": "30",
240 * "formattedAmount": "$30.00",
241 * "formattedConvertedAmount": "$30.00"
242 * }
243 * },
244 * "payLater": {
245 * "subtotal": {
246 * "amount": "0",
247 * "convertedAmount": "0",
248 * "formattedAmount": "$0.00",
249 * "formattedConvertedAmount": "$0.00"
250 * },
251 * "shipping": {
252 * "amount": "0",
253 * "convertedAmount": "0",
254 * "formattedAmount": "$0.00",
255 * "formattedConvertedAmount": "$0.00"
256 * },
257 * "tax": {
258 * "amount": "0",
259 * "convertedAmount": "0",
260 * "formattedAmount": "$0.00",
261 * "formattedConvertedAmount": "$0.00"
262 * },
263 * "discount": {
264 * "amount": "0",
265 * "convertedAmount": "0",
266 * "formattedAmount": "$0.00",
267 * "formattedConvertedAmount": "$0.00"
268 * },
269 * "total": {
270 * "amount": "0",
271 * "convertedAmount": "0",
272 * "formattedAmount": "$0.00",
273 * "formattedConvertedAmount": "$0.00"
274 * }
275 * },
276 * "membershipOptions": {
277 * "eligibleMemberships": [],
278 * "invalidMemberships": [],
279 * "selectedMemberships": {
280 * "memberships": []
281 * }
282 * }
283 * }
284 *
285 */
Create a checkout, full object

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