Search.../

createCheckoutFromTemplate( )

Developer Preview

Creates a new checkout based on the checkout template.

Description

Before using this function, you must have a checkout template available. Create a checkout template with createCheckoutTemplate().

The customer can be directed to the new checkout using the checkout's checkoutUrl.

Authorization

Request

This endpoint does not take any parameters

Response Object

NAME
TYPE
DESCRIPTION
checkoutId
string

ID of the created checkout.

checkoutUrl
string

URL of the created checkout page.

Status/Error Codes

Was this helpful?

createCheckoutFromTemplate example

Copy Code
1import { checkoutTemplates } from 'wix-ecom-backend';
2
3 async function createCheckoutFromTemplate(checkoutTemplateId, siteId) {
4 try {
5 const result = await checkoutTemplates.createCheckoutFromTemplate(checkoutTemplateId, siteId);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13