Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Checkout Storefront API

Checkout Storefront API

radovanhodor
Tourist
11 0 3

What am i doing wrong ?

 

Thx in advance.

 

 

mutation checkoutCompleteWithCreditCardV2($checkoutId: ID!, $payment: CreditCardPaymentInputV2!) {
    checkoutCompleteWithCreditCardV2(checkoutId: $checkoutId, payment: $payment) {
      checkout {
        id
      }
      checkoutUserErrors {
        field
        message
      }
      payment {
        amount {
          amount
          currencyCode
        }
      }
    }
  }

Variables:

 

{
  "checkoutId": "gid://shopify/Checkout/94bff5bd482f989594e90273061c5e9e?key=392bee90552eafcbb9ddb5728f4fb9e3",
  "payment": {
    "billingAddress": {
      "address1": "",
      "address2": "",
      "city": "",
      "company": "",
      "country": "",
      "firstName": "",
      "lastName": "",
      "phone": "",
      "province": "",
      "zip": ""
    },
    "idempotencyKey": "",
    "paymentAmount": {
      "amount": "99",
      "currencyCode": "EUR"
    },
    "test": true,
    "vaultId": ""
  }
}

response:

{
  "data": {
    "checkoutCompleteWithCreditCardV2": null
  },
  "errors": [
    {
      "message": "Access denied for checkoutCompleteWithCreditCardV2 field. Required access: `unauthenticated_write_checkouts` access scope.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "checkoutCompleteWithCreditCardV2"
      ],
      "extensions": {
        "code": "ACCESS_DENIED",
        "documentation": "https://shopify.dev/api/usage/access-scopes",
        "requiredAccess": "`unauthenticated_write_checkouts` access scope."
      }
    }
  ]
}

 

 

Storefront permissions:

 

Snímka obrazovky 2023-07-28 o 15.42.52.png

Reply 1 (1)

Liam
Community Manager
3108 344 889

Hi Radovanhodor,

 

The mutation does look correct so one thing I would check for is that the access token you're using for the API call is correct and has the necessary access scopes. If you're using an old or incorrect token, it might not have the required permissions. Also which version of the Storefront API is your app on? 

 

Hope this helps,

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog