API call to retrieve transaction - errors getting "Specified resource ID does not exist"

Inkeyes
Contributor
Contributor

Hello,

We have a webhook receiving paypal transaction information. Our webhook immediately decodes the payload, and calls the PayPal API to retrieve the transaction associated with the webhook message.

 

We are now seeing in about 20% of the calls, in production, the error message "Specified resource ID does not exist"

 

Can someone please suggest a solution?

Thanks

Nick

 

 

We are using the PayPal SDK to create a PayPalHTTPClient

 

private function _getPayPalClient() {
$clientId = $this->getClientId();
$clientSecret = $this->getSecretKey();
if($this->isLive() == true) {
error_log('creating production environment: '.$clientId.', '.$clientSecret);
$environment = new ProductionEnvironment($clientId, $clientSecret);
} else {
error_log('creating sandbox environment: '.$clientId.', '.$clientSecret);
$environment = new SandboxEnvironment($clientId, $clientSecret);
}
return new PayPalHttpClient($environment);
}

 

public function getTransaction($transactionId)
{
$client = $this->_getPayPalClient();

try {
Log::Info(__FILE__,__METHOD__,', fetching paypal transaction id: '.$transactionId);

$response = $client->execute(new OrdersGetRequest($transactionId));

Log::Info(__FILE__,__METHOD__,', paypal transaction response: '.print_r($response,true));

return $response;
} catch (Exception $ex) {
Log::Info(__FILE__,__METHOD__,', paypal transaction fetch error: Exception: '.$ex->getMessage());
return false;
}

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.