How can I access abandoned checkouts for a public app?

Gumptastic
New Member
2 0 1

Hello,

 

I've been following the primary Shopify public app tutorial (using React, Koa, etc.) and need to access abandoned checkouts.

 

I've developed a scheduler that runs every 5 minutes and gets a list of all the Shopify stores using my app and then acquires the abandoned checkouts like so:

 

 

const store = doc.id;

const url = `https://${ SHOPIFY_API_KEY }:${ SHOPIFY_API_SECRET_KEY }@${ store }/admin/api/2020-04/checkouts.json`;

console.log(url);

fetch(url).then((response) => response.json()).then((data) => {
	console.log(data);
});

 

When I toss the URL into Google Chrome, I get the appropriate JSON response, but when I do it through a scheduler which runs on a timer, I get the following error:

 

{
  errors: '[API] Invalid API key or access token ' +
    '(unrecognized login or wrong password)'
}

 

What do I need to do to make this work?

 

 

 

0 Likes