Wix Headless provides you with the flexibility to create an app or site on any platform and take advantage of Wix's backend business solutions via APIs. However, for certain processes, such as authentication and checkout, you can save time and effort by redirecting visitors to frontend pages Wix implements for you.
For example, your site can temporarily redirect a visitor to a Wix-managed page for authentication or for a checkout process for a Bookings, eCommerce, Events, or Paid Plans transaction. When the process is over, Wix redirects the visitor back to your external site.
For instructions on redirecting to Wix for authorization, login, and logout, see Handle Members with Managed Login.
To take advantage of Wix's checkout services, you need to redirect to a Wix-managed checkout page using the Redirects API.
To use Wix-managed checkout services:
Determine which checkout service you need. For example, Bookings, eCommerce, Events, or Paid Plans.
In the documentation for Create Redirect Session
, find the body parameter matching the checkout type you need. For example, eventsCheckout
or ecomCheckout
.
In the property descriptions, find the APIs you can use to get the information you need to send to Create Redirect Session. For example, for eventsCheckout
you can use Query Events
and Create Reservation
and for ecomCheckout
you can use Create Checkout
.
Call whichever APIs are appropriate for obtaining the data you need for the desired checkout.
To implement a redirect session, it's essential to identify the destination for visitors on your external site once the Wix-managed flow concludes.
When developing your external site or app, determine a post-flow URL. This is the URL your visitors will be redirected back to when the Wix-managed flow is over.
For greater customization, you may also provide callback URLs for specific purposes, such as a custom thank you page on your external site. If you don't provide this, a standard page is used. See Create Redirect Session
for details.
Note: Wix returns visitors to a URL you provide only if its domain has been authorized in advance. The URL must be under an allowed redirect domain.
You now have the information you need to generate a URL for a Wix-managed checkout.
To generate the redirect session URL, call Create Redirect Session
. Pass the data needed for your redirect session type. Also pass your post-flow URL and any optional callback URLs in the callbacks
parameter.
For example, if you're performing an eComm checkout, pass the checkoutId
in the ecomCheckout
property of the body and the postFlowUrl
in the callbacks
property.
The response contains a single-use redirect session URL in redirectSession.fullUrl
.
Redirect your visitor to the URL returned by Create Redirect Session
. The URL contains the information needed for Wix to process the checkout, including the post-flow URL to redirect the visitor back to on your external site.
Note: You can customize the domain that visitors see when your external site redirects them to Wix-managed pages. Learn how to connect a domain for Wix-managed pages.
Wix redirects the visitor back to the URL (or URLs) you provided, so make sure to implement the next stage in your flow at this address.
Upon redirecting back to your site, Wix includes a wixMemberLoggedIn
boolean query parameter. If set to true, this indicates that a visitor successfully logged in during the preceding Wix-managed process.
Additionally, Wix passes specific query parameters depending on the checkout type. For details, refer to callbacks
in Create Redirect Session
.