App reviews, troubleshooting, and recommendations
Hi Shopify Team And Community,
I on developing payment app and now i try to call api Resolve A Payment like at this documentation below:
https://shopify.dev/apps/payments/processing-a-payment#resolve-a-payment
But when i call it with PHP Http Guzzle. Response from API quite strange like this image
This is code that i create under PHP:
<?php
namespace App\Services\Shopify\Api\Payment;
use App\Services\Shopify\Api\ApiService;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
class PaymentSessionResolveApi extends ApiService
{
protected $id = "";
protected $authorizationExpiresAt = "";
public function setId($id)
{
$this->id = $id;
}
public function setAuthorizationExpiresAt($authorizationExpiresAt)
{
$this->authorizationExpiresAt = $authorizationExpiresAt;
}
public function handle()
{
$params = [
'query' => $this->getQueryString(),
'variables' => [
'id' => $this->id,
'authorizationExpiresAt' => $this->authorizationExpiresAt
]
];
try {
$client = new Client();
return $client->post($this->getUrl(), [
'body' => json_encode($params),
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/graphql',
'X-Shopify-Access-Token' => $this->getToken()
],
'verify' => false
]);
} catch (\Exception $e) {
Log::error($e);
}
}
private function getQueryString()
{
$queryString = <<<'GRAPHQL'
{
mutation PaymentSessionResolve($id: ID!, $authorizationExpiresAt: DateTime) {
paymentSessionResolve(id: $id, authorizationExpiresAt: $authorizationExpiresAt) {
paymentSession {
id
status {
code
}
nextAction {
action
context {
... on PaymentSessionActionsRedirect {
redirectUrl
}
}
}
}
userErrors {
field
message
}
}
}
}
GRAPHQL;
return $queryString;
}
}
Anyone can help me please for this api. Did i missing some step or passing data?
The toke of shop and domain of shop already set but the result of response still dont readable for me.
Thank you for your helping.
Hi @adiputra22
Could you tell me what you are passing for authorizationExpiresAt because when I am trying to resolve the payment I am getting this response
(
[data] => Array
(
[paymentSessionResolve] => Array
(
[paymentSession] =>
[userErrors] => Array
(
[0] => Array
(
[field] => Array
(
[0] => id
)
[message] => Argument 'authorization_expires_at' was given, but payment session kind is not authorization.
)
)
)
)
[extensions] => Array
(
[cost] => Array
(
[requestedQueryCost] => 13
[actualQueryCost] => 10
[throttleStatus] => Array
(
[maximumAvailable] => 54600
[currentlyAvailable] => 54590
[restoreRate] => 2730
)
)
)
)
What exactly will be the value for $authorizationExpiresAt??
Thanks!
Learn these 5 things I had to learn the hard way with starting and running my own business
By Kitana Jan 27, 2023Would you love to unleash the unbridled power of the Google Shopping Channel into your sho...
By Gabe Jan 6, 2023How can you turn a hobby into a career? That’s what Emmanuel did while working as a wa...
By Skye Dec 30, 2022