Hi, I am trying to add back in stock in Shopify using new Klaviyo api as previous one is depreciated and not working but i am getting Cors policy error.
Following is the code please help me what I am doing wrong.
const settings = {
async: true,
crossDomain: true,
url: 'https://a.klaviyo.com/api/back-in-stock-subscriptions',
method: 'POST',
headers: {
accept: 'application/vnd.api+json',
revision: '2024-10-15',
'content-type': 'application/vnd.api+json',
Authorization: 'XBfV5N pk_0d7d1911eb8824c6ee8265ac16f16bcf9f'
},
data: {
"type": "back-in-stock-subscription",
"attributes": {
"profile": {
"data": {
"type": "profile",
"attributes": {
"email": "matt.kemp@klaviyo-demo.com"
}
}
},
"channels": ["EMAIL"],
},
"relationships": {
"variant": {
"data": {
"type": "catalog-variant",
"id": "$shopify:::$default:::40800102350963"
}
}
}
}
};
$.ajax(settings).done(res => {
console.log(res);