unable to use the checkout api in public app/private app

New Member
1 0 0

I want to use the checkout api -> https://apikey:password@store-name.myshopify.com/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 

<html>
<body>
  <noscript>
    <a
  </noscript>
  <script type="text/javascript">
    window.location = "https:\/\/app.shopify.com\/services\/login\/identity?destination_uuid=598acb97-45bf-4ce5-a385-56231d401f5d\u0026enforce_merge=false\u0026merge_ignore_postponed=false\u0026prompt=merge\u0026return_to=https%3A%2F%2Fapp.shopify.com%2Fservices%2Flogin%2Fidentity_callback%3Ffrom_signup%3Dfalse%26locale%3Den%26shop_name%3Dshoptype-123%26state%3D-No_FnVDUUxxeocU2ppowGi_5rVcTILnEIPazxvPEtTh2gut7854XrrtG0vEgyrxIIJs-s_IW7lvxyt92Tl43Zl7d7xqPvp40v4zyIQrAbwkapjYF8I_GGOrZSERlQPU6mFCbWqAUfxvbxvEFsPhCL9h3lNHhKo-8yCeCTCOkWM4fi6coV8Mm_uDYmM8aiJCwAcvsWnWsd7R8iaMSoF4Q1Wwsb0mfyKgl5W3dWxpwiY%253D\u0026ui_locales=en\u0026ux=shop";
  </script>
</body>
</html>
 
I am refering to this doc https://shopify.dev/docs/admin-api/rest/reference/sales-channels/checkout for creating a custom checkout. 

 

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. 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
426 57 65

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

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes