> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # CreateCheckoutFromCurrentCart # Package: purchaseFlow # Namespace: CurrentCartService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/purchase-flow/cart/create-checkout-from-current-cart.md ## Permission Scopes: Manage Orders: SCOPE.DC-STORES.MANAGE-ORDERS ## Introduction Creates a checkout from the current site visitor's cart. If a checkout was already created from the current cart, that checkout will be updated with any new information from the cart. >**Notes:** >+ `channelType` is a required field. >+ This method requires [visitor or member authentication](https://dev.wix.com/docs/rest/articles/getting-started/access-types-and-permissions.md). --- ## REST API ### Schema ``` Method: createCheckoutFromCurrentCart Description: Creates a checkout from the current site visitor's cart. If a checkout was already created from the current cart, that checkout will be updated with any new information from the cart. >**Notes:** >+ `channelType` is a required field. >+ This method requires [visitor or member authentication](https://dev.wix.com/docs/rest/articles/getting-started/access-types-and-permissions.md). URL: https://www.wixapis.com/ecom/v1/carts/current/create-checkout Method: POST Method parameters: param name: billingAddress | type: Address | description: Physical address - name: country | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://www.iso.org/obp/ui/#search/code/) format. - name: subdivision | type: string | description: Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://www.iso.org/standard/72483.html) format. - name: city | type: string | description: City name. - name: postalCode | type: string | description: Postal or zip code. - name: streetAddress | type: StreetAddress | description: Street address. - name: number | type: string | description: Street number. - name: name | type: string | description: Street name. - name: addressLine | type: string | description: Main address line (usually street name and number). - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains apt, suite, floor. - name: geocode | type: AddressLocation | description: Geocode object containing latitude and longitude coordinates. - name: latitude | type: number | description: Address latitude. - name: longitude | type: number | description: Address longitude. param name: channelType | type: ChannelType - enum: UNSPECIFIED - Unspecified sales channel. This value is not supported. WEB - A web client. POS - [Point of sale solutions](https://support.wix.com/en/wix-mobile-pos-2196395). EBAY - [eBay shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-ebay-shop). AMAZON - [Amazon shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-amazon-shop). OTHER_PLATFORM - Other sales platform. WIX_APP_STORE - [Wix Owner app](https://support.wix.com/article/wix-owner-app-an-overview). WIX_INVOICES - Wix Invoices app in [your dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Finvoices/settings/general-settings) BACKOFFICE_MERCHANT - Wix merchant backoffice. WISH - Wish sales channel. CLASS_PASS - [ClassPass sales channel](https://support.wix.com/en/article/wix-bookings-letting-clients-book-your-services-with-classpass). GLOBAL_E - Global-E sales channel. FACEBOOK - [Facebook shop](https://support.wix.com/en/article/wix-stores-changes-to-facebook-shops). ETSY - [Etsy sales channel](https://support.wix.com/en/article/wix-stores-request-adding-etsy-as-a-sales-channel). TIKTOK - [TikTok sales channel](https://support.wix.com/en/article/wix-stores-request-adding-tiktok-as-a-sales-channel). FAIRE_COM - [Faire marketplace integration](https://support.wix.com/en/article/wix-stores-creating-a-faire-store-using-the-faire-integration-app). PAYPAL_AGENTIC_CHECKOUT - PayPal Agentic Checkout sales channel. STRIPE_AGENTIC_CHECKOUT - Stripe Agentic Checkout sales channel. param name: email | type: email | description: Required when setting billing or shipping address and user is not logged in. param name: selectedShippingOption | type: SelectedShippingOption - name: carrierId | type: string | description: Carrier GUID. - name: code | type: string | description: Selected shipping option code. For example, "usps_std_overnight". param name: shippingAddress | type: Address | description: Physical address - name: country | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://www.iso.org/obp/ui/#search/code/) format. - name: subdivision | type: string | description: Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://www.iso.org/standard/72483.html) format. - name: city | type: string | description: City name. - name: postalCode | type: string | description: Postal or zip code. - name: streetAddress | type: StreetAddress | description: Street address. - name: addressLine | type: string | description: Main address line (usually street name and number). - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains apt, suite, floor. - name: geocode | type: AddressLocation | description: Geocode object containing latitude and longitude coordinates. Return type: CreateCheckoutResponse - name: checkoutId | type: string | description: The newly created checkout's GUID. ``` ### Examples ### Create a checkout from the current site visitor's cart ```curl curl -X POST \ 'https://www.wixapis.com/ecom/v1/carts/current/create-checkout' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "channelType": "EBAY" }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.purchaseFlow.CurrentCartService.createCheckoutFromCurrentCart(options) Description: Creates a checkout from the current site visitor's cart. If a checkout was already created from the current cart, that checkout will be updated with any new information from the cart. >**Notes:** >+ `channelType` is a required field. >+ This method requires [visitor or member authentication](https://dev.wix.com/docs/rest/articles/getting-started/access-types-and-permissions.md). Method parameters: param name: options | type: CreateCheckoutFromCurrentCartOptions none - name: channelType | type: ChannelType | description: __Required.__ Sales channel type. - enum: - UNSPECIFIED: Unspecified sales channel. This value is not supported. - WEB: A web client. - POS: [Point of sale solutions](https://support.wix.com/en/wix-mobile-pos-2196395). - EBAY: [eBay shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-ebay-shop). - AMAZON: [Amazon shop](https://support.wix.com/en/article/wix-stores-connecting-and-setting-up-an-amazon-shop). - OTHER_PLATFORM: Other sales platform. - WIX_APP_STORE: [Wix Owner app](https://support.wix.com/article/wix-owner-app-an-overview). - WIX_INVOICES: Wix Invoices app in [your dashboard](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Finvoices/settings/general-settings) - BACKOFFICE_MERCHANT: Wix merchant backoffice. - WISH: Wish sales channel. - CLASS_PASS: [ClassPass sales channel](https://support.wix.com/en/article/wix-bookings-letting-clients-book-your-services-with-classpass). - GLOBAL_E: Global-E sales channel. - FACEBOOK: [Facebook shop](https://support.wix.com/en/article/wix-stores-changes-to-facebook-shops). - ETSY: [Etsy sales channel](https://support.wix.com/en/article/wix-stores-request-adding-etsy-as-a-sales-channel). - TIKTOK: [TikTok sales channel](https://support.wix.com/en/article/wix-stores-request-adding-tiktok-as-a-sales-channel). - FAIRE_COM: [Faire marketplace integration](https://support.wix.com/en/article/wix-stores-creating-a-faire-store-using-the-faire-integration-app). - PAYPAL_AGENTIC_CHECKOUT: PayPal Agentic Checkout sales channel. - STRIPE_AGENTIC_CHECKOUT: Stripe Agentic Checkout sales channel. - name: shippingAddress | type: Address | description: Shipping address. Used for calculating tax and shipping (when applicable). - name: country | type: string | description: Two-letter country code in [ISO-3166 alpha-2](https://www.iso.org/obp/ui/#search/code/) format. - name: subdivision | type: string | description: Code for a subdivision (such as state, prefecture, or province) in [ISO 3166-2](https://www.iso.org/standard/72483.html) format. - name: city | type: string | description: City name. - name: postalCode | type: string | description: Postal or zip code. - name: streetAddress | type: StreetAddress | description: Street address. - name: number | type: string | description: Street number. - name: name | type: string | description: Street name. - name: addressLine | type: string | description: Main address line (usually street name and number). - name: addressLine2 | type: string | description: Free text providing more detailed address info. Usually contains apt, suite, floor. - name: geocode | type: AddressLocation | description: Geocode object containing latitude and longitude coordinates. - name: latitude | type: number | description: Address latitude. - name: longitude | type: number | description: Address longitude. - name: billingAddress | type: Address | description: Billing address. Used for calculating tax if all the items in the cart are not shippable. - name: selectedShippingOption | type: SelectedShippingOption | description: Selected shipping option. Pass this field only when there is no existing shipping option in the cart. - name: carrierId | type: string | description: Carrier GUID. - name: code | type: string | description: Selected shipping option code. For example, "usps_std_overnight". - name: email | type: string | description: Required when setting billing or shipping address and user is not logged in. Return type: PROMISE - name: checkoutId | type: string | description: The newly created checkout's GUID. ``` ### Examples ### Create a checkout from the current cart ```javascript /************************************** * Backend code - my-backend-file.web.js/ts * *************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { currentCart } from '@wix/ecom'; export const myCreateCheckoutFromCurrentCartFunction = webMethod(Permissions.Anyone, async (options) => { try { const checkoutId = await currentCart.createCheckoutFromCurrentCart(options); console.log('Success! Checkout created, checkoutId:', checkoutId); return checkoutId; } catch (error) { console.error(error); // Handle the error } }); /************* * Page code * ************/ import { myCreateCheckoutFromCurrentCartFunction } from 'backend/my-backend-file.web'; // Sample options object: const options = { // channelType is a required field "channelType": "WEB", "email": "janedoe@example.com", "shippingAddress": { "addressLine1": "235 West 23rd Street", "addressLine2": "3rd floor", "city": "New York", "country": "US", "postalCode": "10011", "streetAddress": { "name": "West 23rd Street", "number": "235" }, "subdivision": "US-NY" } }; myCreateCheckoutFromCurrentCartFunction(options) .then((checkoutId) => { console.log('Success! Checkout created, checkoutId:', checkoutId); return checkoutId; }) .catch((error) => { console.error(error); // Handle the error }); /* Promise resolves to: * * {"checkoutId": "a43420aa-986b-456a-a2f7-7ea5c80e9007"} * */ ``` ### createCheckoutFromCurrentCart (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { currentCart } from '@wix/ecom'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { currentCart }, // Include the auth strategy and host as relevant }); async function createCheckoutFromCurrentCart(options) { const response = await myWixClient.currentCart.createCheckoutFromCurrentCart(options); }; ``` ---