Checkout Storefront API

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:

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,