import type { CheckoutEndpoint } from '.' const fullCheckout = true const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({ req, res, config, }) => { const { cookies } = req const cartId = cookies[config.cartCookie] if (!cartId) { res.redirect('/cart') return } const { data } = await config.storeApiFetch( `/v3/carts/${cartId}/redirect_urls`, { method: 'POST', } ) if (fullCheckout) { res.redirect(data.checkout_url) return } // TODO: make the embedded checkout work too! const html = `