Creates a new checkout based on the checkout template and redirects to the new checkout page.
Before using this function, you must have a checkout template available. Create a checkout template with createCheckoutTemplate()
.
To build a URL that uses this function, follow this format:
https://www.wixapis.com/ecom/v1/checkout-templates/{checkoutTemplateId}/create-and-redirect-to-checkout?siteId={siteId}
To create a checkout but not automatically redirect to the checkout page, use createCheckoutFromTemplate()
.
function createAndRedirectToCheckout(
checkoutTemplateId: string,
siteId: string,
): Promise<RawHttpResponse>;
ID of the checkout template to use to create a checkout.
ID of the site associated with the checkout template.
import { checkoutTemplates } from "@wix/ecom";
async function createAndRedirectToCheckout(checkoutTemplateId, siteId) {
const response = await checkoutTemplates.createAndRedirectToCheckout(
checkoutTemplateId,
siteId,
);
}
There is 1 error with this status code.
This method may also return standard errors. Learn more about standard Wix errors.