'How to solve paymentsAppConfigure error (You do not have permission to access this website)

On Shopify, I'm getting paymentsAppConfigure error (You do not have permission to access this website).

$queryArr = [
    'query'     => 'mutation PaymentsAppConfigure($externalHandle: String, $ready: Boolean!) {
            paymentsAppConfigure(externalHandle: $externalHandle, ready: $ready) {
                paymentsAppConfiguration {
                    externalHandle
                    ready
                }
                userErrors{
                    field
                    message
                }
            }
        }',
    'variables' => [
        'externalHandle' => 'API_token_key',
        'ready'          => true
    ]
];

$query = json_encode($queryArr);

$ch     = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Shopify-Access-Token:<My_token>', 'Content-Type: application/json'));
$result = curl_exec($ch);
$err    = curl_error($ch);

curl_close($ch);
// echo "<pre>";
//  print_r($err);
print_r($result);

This query is giving the following error:

You do not have permission to access this website

Also, what is the externalHandle API_token_key? I have used the App API key but it's not working.



Solution 1:[1]

Your app should have write_payment_gateways and write_payment_sessions permissions in order to make that call. You need to contact Shopify support to enable these permissions. Reference: https://shopify.dev/apps/payments/onboarding-a-merchant-payments-apps#permissions

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mehar