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

Viewed 212

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.

2 Answers

As mentioned by Mehar above, you app should have requested permissions.

Below is payload that I'm sending and works as expected, you can try that if you want.

{
    "query": "mutation {  paymentsAppConfigure(externalHandle : \"Activation request at 2020-04-09 11:24:14.785868848\" ,ready: true) {   paymentsAppConfiguration {      externalHandle      ready    }    userErrors {    field      message    }  } }",
    "variables": {}
}

Below are the header details that I send with the request

X-Shopify-Access-Token -> Your token
Content-Type -> application/json
Cookie -> request_method=POST
Related