Getting started with Commerce.js to build your product catalogue and cart can be fast and easy, while finishing it off with a custom checkout may take a little longer.
If you need to save some time you can use our hosted checkout option instead. This can also be a nice option to get your store up and running quickly while you finish building your integrated experience. Here's how to do that.
Redirecting to the hosted checkout
When you call the "retrieve cart" API, there is a field named
hosted_checkout_url. For more information on this API and its response structure, see the "retrieve cart" API documentation.
You can use this value to redirect your customers to our hosted checkout with an
<a> or a
<button>. The link includes your cart's ID, so the items in that cart will be loaded into our hosted checkout automatically.
Your payment gateways, shipping, and tax settings etc will be automatically configured for you in this hosted checkout.
Directing customers after the checkout
Once the hosted checkout process has completed, you can direct customers back to your website or to another URL. This can be configured in your product details, using the "Thank you URL" field: