2
votes

SetExpressCheckout only posts to the ReturnURL the following ACK CORRELATIONID TIMESTAMP VERSION BUILD

To complete a transaction though we must first call GetTransactionDetails with TRANSACTIONID to get the PAYERID to ultimately use with DoExpressCheckout to complete the transaction.

Where do we obtain TRANSACTIONID? I can't find information anywhere.

If I use the CORRELATIONID as TRANSACTIONID, I get 'Transaction Id is invalid'.

The sample files just have 'example_transactionId' and no indication of where it is supposed to come from.

From paypal

  1. Invoke an API operation, such as SetExpressCheckout, that sets up the return URL to which PayPal redirects your buyer’s browser after the buyer finishes on PayPal. Other setup also can be performed by this API operation.
  2. Invoke additional API operations after receiving the buyer’s permission on PayPal, for example, GetExpressCheckoutDetails or DoExpressCheckoutPayment.

Step one works because we have all the information and returns this.

enter image description here

Step 2 can't be completed without at least TRANSACTIONID which isn't given.

What the?

3

3 Answers

2
votes

you have to do the TransactionSearch first. it will return the transactions with id. you can then use the id for GetTransactionDetails

1
votes

When paypal redirects the user back to RETURNURL (which you should set in your call to SetExpressCheckout) you get a TOKEN parameter in the request.

You then fetch the transaction information using GetExpressCheckoutDetails passing TOKEN as a parameter. The response will contain AMT, PAYERID and TOKEN among other things.

To finalize the transaction you pass those parameters to DoExpressCheckoutPayment.

Btw the only time you need to use CORRELATIONID is when you are talking to PayPal support. It has no practical use for handling payments.

Hope it helps! :)

0
votes

In DGdoExpressCheckout.php, response is received in $DoECResponse. Transaction Id can be found deep inside this object:

$tranId = $DoECResponse->DoExpressCheckoutPaymentResponseDetails->PaymentInfo[0]->TransactionID;

You can get the whole object's details in a file:

file_put_contents('debug.log', print_r($DoECResponse, true));

$DoECResponse object provides some of the basic information about the transaction, and GetTransactionDetails can be used to get more verbose information. Mostly, one would not much require to call GetTransactionDetails.