Locating the Correlation ID when using Orders/Payments v2 API?

Frigidman
Contributor
Contributor

In the older NVP/SOAP API, there was a clear return in every api call of "CORRELATIONID". We would log this with every api call for internal monitoring/debugging and correlating calls to the merchant terminal. Very useful.

 

We are trying to find such an ID in the return from the newer Orders / Payments v2 REST APIs. Is there one? We noticed that upon an ERROR condition (only), there is a noted "debug_id" which the documentation states is "The PayPal internal ID. Used for correlation purposes.". Would this be the only reference made?

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

Frigidman
Contributor
Contributor

After some poking, I have discovered what I need.

 

These instructions are for if using the Checkout PHP SDK (however the solution can also be found with any SDK using curl). After receiving a response (that is not an Exception) from a REST request, the Correlation ID can be found in the return headers by the name of "Paypal-Debug-Id".

 

To access these headers with the Checkout PHP SDK, you can simply pull it via:

// following the same format as the example code provided with the SDK
$request  = new WhateverMethodYouAreDoing();
$client   = PayPalClient::client();
$response = $client->execute($request);

// thankfully $response->headers is exposed and not set as private or protected!
$correlationid = $response->headers['Paypal-Debug-Id'];

 

And then you now have the ID like we are used to getting in prior versions of the paypal processes. Which can then be used to lookup these calls and debug.

View solution in original post

Login to Me Too
1 REPLY 1
Solved

Frigidman
Contributor
Contributor

After some poking, I have discovered what I need.

 

These instructions are for if using the Checkout PHP SDK (however the solution can also be found with any SDK using curl). After receiving a response (that is not an Exception) from a REST request, the Correlation ID can be found in the return headers by the name of "Paypal-Debug-Id".

 

To access these headers with the Checkout PHP SDK, you can simply pull it via:

// following the same format as the example code provided with the SDK
$request  = new WhateverMethodYouAreDoing();
$client   = PayPalClient::client();
$response = $client->execute($request);

// thankfully $response->headers is exposed and not set as private or protected!
$correlationid = $response->headers['Paypal-Debug-Id'];

 

And then you now have the ID like we are used to getting in prior versions of the paypal processes. Which can then be used to lookup these calls and debug.

Login to Me Too

Haven't Found your Answer?

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