Chuck Watson
Chuck Watson

Reputation: 31

PayPal REST API cross reference transaction with payment

I have managed to complete a PayPal payment using the REST PHP API. However, I want to know how to cross reference the REST transaction with the PayPal web user interface.

On the REST side I have payment id (getID()) received before the transaction is approved. It looks like 'PAY-5BH83448XN85470XXXXXXXXXXX'.

After the transaction is approved, I receive back at my redirect URL three other pieces of information:

- success=true
- token=EC-51Y92978Mxxxxxxxx
- PayerID=4Q7YVxxxxxxxx

When I log into PayPal and review the payment, none of these IDs match up with what is shown. The details for the payment show a Unique Transaction ID like #4PP59868EXXXXXXXX that does not match anything above.

How do I cross reference these different pieces of data?

Upvotes: 3

Views: 2345

Answers (1)

Finn K
Finn K

Reputation: 620

The response to the payment call will contain a list of transactions, which contains a set of related resources. For a completed payment there will be a sale item, the id of the sale is the PayPal transaction id.

For ex (pseudo): payment.transactions[0].related_resources[sale].id

Sample here: https://developer.paypal.com/webapps/developer/docs/integration/direct/accept-credit-cards/

Upvotes: 1

Related Questions