I ran into this tutorial using every technology in the world which is supposed to show how to build a react app from the ground up to leverage the shopify API. However there also this page describing a simple API call to do more or less what I need.
The goal is to have an entirely custom (extremely simple) checkout process that ends up in the shopify system. It would go something like this:
Stripe purchase ok -> shopify order saved -> thank you page redirect.
EDIT: It appears that the format https://api_key:[email protected]/admin/api/2019-07/orders.json
solves the authentication problem. The call:
GET https://key:[email protected]/admin/api/2019-07/orders.json
returns a pleasant
{
so the authentication is a-ok.
"orders": []
}
However, doing a POST https://key:[email protected]/admin/api/2019-07/orders.json
Seems to return a cryptic page, instead of an error like so (which simply leads to your demo store/app):
2
Answers
Are you sure there are no cookies on the request? Because I can reproduce your exact issue if I add cookies.
It might be easier to use
curl
in order to have absolute clarity into what is being posted. For example:Response:
But if you want to stick with Postman, here are the supporting screenshots showing success without cookies, and failure with:
Confirming there are no cookies set:
Successful post to
orders.json
endpoint:Now, add a cookie:
And I get the response shown in your question:
If you read the documentation of the private apps
https://help.shopify.com/en/api/getting-started/authentication/private-authentication
This is on purpose, doing this on a client side is criminal. If you are doing something server side then it is ok to use basic auth. But on client side you shouldn’t be using it
If you want to use in postman then you need to use it with
access_token