To make requests to Supercycle’s storefront API, you will need to go through the app proxy.

The path for this can be found with window.supercycleAppEmbed.context.proxyPathPrefix and will usually look like /apps/supercycle this will need to be prepended to all requests made to the storefront API.

async function supercycleFetch(method, path, options) {
  if (!path.startsWith("/")) path = `/${url}`;
	const {	proxyPathPrefix } = window.supercycleAppEmbed.context
  const response = await fetch(proxyPathPrefix + path, {
    method,
    headers: { "Content-Type": "application/json" },
    ...options,
  });

  return response.json();
}