Hello.
When I try to call the mutation PaymentSessionResolve on php curl its return a HTML wich says: “You don’t have permission to access this website”.
Using postman it work perfectly.
Here is my php code:
$headers = [
‘Content-Type’ => ‘application/json’,
‘X-Shopify-Access-Token’ => ‘mytoken’
];
$graphqlQuery = [
“query” => ‘mutation PaymentSessionResolve($id: ID!, $authorizationExpiresAt: DateTime) {
paymentSessionResolve(id: $id, authorizationExpiresAt: $authorizationExpiresAt) {
paymentSession {
id
state {
… on PaymentSessionStateResolved {
code
}
}
nextAction {
action
context {
… on PaymentSessionActionsRedirect {
redirectUrl
}
}
}
}
userErrors {
field
message
}
}
}’,
‘variables’ => [
‘id’ => $gid
]
];
$query = json_encode($graphqlQuery);
$log->write(“graphql” . print_r($graphqlQuery, true), 8);
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => “https://mystore.myshopify.com/payments_apps/api/2023-01/graphql.json”,
CURLOPT_CUSTOMREQUEST => “POST”,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => $query,
]);
$response = curl_exec($curl);
curl_close($curl);