Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I want to use the checkout api -> https://apikey:[email protected]/admin/api/2020-01/checkouts.json.
I tired both ways by using a sales channel sdk public app and tried to use the private app. Inside the private and public app I have mentioned all the required read and write access for checkouts to work from my end.
But unfortunately it gives me a 200 response code with below html as a response from API. I want to create an empty checkout for now to just make sure that the API will work so that I can make more custom checkouts at my end. The end goal for me is to get the checkout id, 201 response code from api
To Do
Create a checkout with a product variant and quantity
POST /admin/api/2020-01/checkouts.json
{
"checkout": {
"line_items": [
{
"variant_id": 447654529,
"quantity": 5
}
]
}
}
I will substitute the apikey and passowrd/shared secret from my account with variant id of my product to create a simple checkout which will give me
Location: https://apple.myshopify.com/admin/api/2020-01/checkouts/07aa86bb01cda55f32a5eaf3895d4444.json
a Checkout ID to proceed further. but instead the api returns 200 response with html code. Request you to please help me as soon as possible. Thanks in advance.
Hi @adishesh ,
If you are using the Admin API and you are getting a response of an HTML page with the href URL of "https://app.shopify.com/services/login/identity?destination_uuid=598acb97-45bf-4ce5-a385-56231d401f5..." ... this means that your API request does not have proper authentication. Since your API request does not have authentication or its not formatted in the way Shopify expects, Shopify cannot determine who your app is and is asking you to log in.
In order to avoid this, please ensure that your app is properly authenticating all of it's requests using OAuth as per this document: https://shopify.dev/tutorials/authenticate-with-oauth
Also, in order to build a Sales Channel use the Checkout API your app needs to request for payment processing first. This is the only way your app can get the "write_checkout" scopes. Read here for more details https://shopify.dev/tutorials/build-a-sales-channel#request-payment-processing
To learn more visit the Shopify Help Center or the Community Blog.