About the eCommerce Checkout Templates API
The Checkout Templates API allows you to create and manage pre-populated checkouts to share with customers. When customers then create checkouts from these templates, the new checkouts already include information such as predefined line items, coupons, or other customizations.
With the Checkout Templates API, you can:
- Run a sale on a specific product for a limited time
- Customize the checkout experience
Before you Begin
It’s important to note that the checkout template functionality is not currently available in the Wix Dashboard. If a site creates checkout templates with an app, they must also be able to manage and update their checkout templates through an app. For example, a website offering a sale through a checkout template must be able to change the template’s status
to INACTIVE
or they will not be able to turn off the sale when they want it to end.
Use Cases
Checkout Templates: Sample Use Case & Flow
This article shares some possible use cases your app could support, as well as an sample flow that could support each use case. This can be a helpful jumping off point as you plan your app's implementation.
Run a flash sale through social media
Offer a sale to customers through social media channels that runs for a limited time only. Create the checkout template and pull the URL to automatically redirect anyone that clicks on the link to a checkout page with the offer. When the period for the sale is complete, update the checkout template's status
to INACTIVE
to turn it off.
To create and share the offer:
- Use Create Checkout Template with the product and coupon information for offer.
- Use the
checkoutTemplateId
to build the URL to share with customers. Build the URL in this format:https://www.wixapis.com/ecom/v1/checkout-templates/{checkoutTemplateId}/create-and-redirect-to-checkout?siteId={siteId}
. - Post and share the URL to customers.
To turn off the offer at the end of the sale:
- Use Update Checkout Template to update
checkoutTemplate.status
toINACTIVE
.
Limit the number of checkouts for a specific coupon
Offer a sale to the first 100 customers that click on an offer. Create a checkout template, then share your own custom link that will run custom logic before creating a new checkout for the customer.
Create a checkout template and add your own custom logic:
- Use Create Checkout Template with the product and coupon information for offer.
- Create a bank of all new checkouts for this sale by collecting the
checkoutId
s of checkouts created from thischeckoutTemplateId
. - Before a new checkout is created with the
checkoutTemplateId
, check the bank and count the number ofcheckoutId
s being stored. - Once the count hits
100
checkouts, use Update Checkout Template to updatecheckoutTemplate.status
toINACTIVE
.
A checkout template can be shared with customers to create checkouts with predefined information already included.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates a checkout template.
A checkout template is used to create a new checkout that will include predefined information. For example, a single link with
a checkoutTemplateId
can be shared with customers and each time the link is clicked, a new checkout page will be created
for that customer with certain checkout information already populated.
The customizable features include the option to allow or to lock coupon codes or gift cards. For example, if a store owner is
using the checkout template to offer a flash sale to their social media followers, they may want to lock the option to apply an
additional coupon on top of the sale being offered. If so, they can set customization.applyCouponLocked
to true
.
A checkout can be created with a checkout template in 2 ways:
- Create and Redirect to Checkout. With this endpoint you can build a URL that when clicked will create a new checkout and redirect the customer to that new checkout page.
- Create Checkout From Template. This endpoint can be called to create a new checkout from the checkout template. The site may add further customizations to the new checkout and then redirect the customer using the new checkout's
checkoutUrl
.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a checkout template.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Deletes a checkout template.
If a checkout template is deleted and a customer attempts to create a checkout with that checkoutTemplateId
then
the customer will be redirected to the domain site.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates a checkout template.
If the info in a checkout template is updated, only new checkouts created from this template will include the updated items. Checkouts previously created from this template before the update will not be affected.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a list of checkout templates, given the provided paging, filtering, and sorting.
Query Checkout Templates runs with these defaults, which you can override:
id
sorted inASC
order
The following table shows field support for filters and sorting for the checkout template object:
Field | Supported Filters | Sortable |
---|---|---|
id | $eq , $ne , $in , $startsWith , $exists , $hasSome | Sortable |
status | $eq , $ne , $in , $exists , $hasSome | Sortable |
To learn about working with Query endpoints, see API Query Language, Sorting and Paging, and Field Projection.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates a new checkout based on the checkout template.
Before using this endpoint, you must have a checkout template available. Create a checkout template with Create Checkout Template.
The customer can be directed to the new checkout using the checkout's checkoutUrl
.
To create the new checkout and automatically redirect to the checkout page, use Create and Redirect to Checkout.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a checkout template is created.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a checkout template is updated.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a checkout template is deleted.
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Triggered when a checkout is created from a checkout template.