Creating checkout using GraphiQL

aabb02
New Member
1 0 0

Hello,

So I fetched "X-Shopify-Storefront-Access-Token" from meta tag with the name "shopify-checkout-api-token" on my page, when I put this as my header and run:

{
    shop{
        name
    }
}

 

I get the name of the shop, but when I try to create a checkout:

 

mutation checkoutCreate($input: CheckoutCreateInput!) {
    checkoutCreate(input: $input) {
        checkout {
            id
        }
        checkoutUserErrors {
            code
            field
            message
         }

    }
}

 

I get:

 

"message": "CheckoutCreate access denied"

What am I doing wrong?

Replies 2 (2)
KarlOffenberger
Shopify Partner
1873 184 863

Have you applied the required Storefront API permissions for reading and modifying checkouts? Namely unauthenticated_write_checkouts and unauthenticated_read_checkouts.

 

Check these access scopes and try again.

Liked this post? You might also like our fantastic upsell apps Candy Rack, Last Upsell post-purchase and Candy Cart or offer free gifts with Gift Box. All made with ❤️  and care by Digismoothie
jmaroa
New Member
1 0 0

Could you please give an example of how to set new scope?