Seem like whenever I add headers to the sandbox fetch in checkout ui extension, it causes cors issue. When I remove them it works as expected. May I know why this is happening?
eg. this doesnt work
const postPurchaseOffer = await fetch(`${APP_URL}/api/offer`, {
method: "POST",
headers: {
Authorization: `Bearer ${inputData.token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({data}),
}).then((response) => response.json());
but this works
const postPurchaseOffer = await fetch(`${APP_URL}/api/offer`, {
method: "POST",
body: JSON.stringify({data}),
}).then((response) => response.json());