How to Search for and Retrieve Transaction Data Using the Merchant API

Important: This integration method is Deprecated as of January 1, 2017. For new integrations, see the PayPal Express Checkout Integration Guide.

In the Merchant API, searching for and retrieving transaction data requires:

  1. Searching an account's transaction history.
  2. Retrieving information about a specific transaction.

For how to use API credentials and endpoints, see Apps 101. For how to create test transactions, see How to Create One-Time Payments Using Express Checkout.

Note: Below are samples that contain parameters for POST requests.

Step 1: Search an Account's Transaction History

Specify your search criteria in a TransactionSearch call. The example below uses a one-month time range. For other search criteria, see TransactionSearch.

The TransactionSearch response contains data about matching transactions. Store the value of L_TRANSACTIONID0 for use in Step 2.

In the following example, data for transactions after the first transaction have been omitted.

Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=TransactionSearch
&STARTDATE=2012-01-01T05:38:48Z    #Start date of the time range for the search
&ENDDATE=2012-01-31T05:38:48Z     #End date of the time range for the search
&VERSION=94

Response
--------
L_TIMESTAMP0=2012%2d01%2d11T06%3a39%3a13Z
...
&L_TIMEZONE0=GMT
...
&L_TYPE0=Payment
...
&L_EMAIL0=test_user%40x%2ecom
...
&L_NAME0=TestName%20Q
...
&L_TRANSACTIONID0=9XJ88717E86951234
...
&L_STATUS0=Completed
...
&L_AMT0=0%2e11
...
&L_CURRENCYCODE0=USD
...
&L_FEEAMT0=0%2e00
...
&L_NETAMT0=0%2e11
...
&TIMESTAMP=2012%2d10%2d01T17%3a55%3a54Z
&ACK=Success
...

When multiple transactions are returned, each output field is appended with a number. Thus, if two transactions are returned, the output fields for the first transaction are appended with 0 and the output fields for the second transaction are appended with 1. For example, the transaction IDs are returned as follows:

L_TRANSACTIONID0=9XJ88717E86951234
&L_TRANSACTIONID1=34A53358N84361234

Data for a maximum of 100 transactions can be returned. If a TransactionSearch call would result in more than 100 transactions, the response includes the following: error code 11002, ACK=SuccessWithWarning, and a message stating that search results were truncated. If you receive error code 11002, narrow your search criteria.

Step 2: Retrieve Information about a Specific Transaction

In a GetTransactionDetails call, specify a transaction ID. The transaction ID can be the value of L_TRANSACTIONID0 from Step 1.

Alternatively, you may have a transaction ID from another PayPal API.

The GetTransactionDetails response contains extensive information about the transaction. For descriptions of the output fields, see GetTransactionDetails.

Request
-------
Endpoint URL: https://api-3t.sandbox.paypal.com/nvp
HTTP method: POST
POST data:
USER=merchant_user_name
&PWD=merchant_password
&SIGNATURE=merchant_signature
&METHOD=GetTransactionDetails
&TRANSACTIONID=9XJ88717E86951234   #The ID of the transaction to retrieve
&VERSION=94

Response
--------
RECEIVERBUSINESS=test_user%40x%2ecom
&RECEIVEREMAIL=test_user%40x%2ecom
&RECEIVERID=NVBNRFH9T1234
&EMAIL=test_user2%40x%2ecom
&PAYERID=XX5394Z2H1234
&PAYERSTATUS=verified
&COUNTRYCODE=US
&BUSINESS=Testing%202
&ADDRESSOWNER=PayPal
&ADDRESSSTATUS=None
&TIMESTAMP=2012%2d10%2d01T19%3a07%3a43Z
&CORRELATIONID=3f7aa50671234
&ACK=Success
&FIRSTNAME=Test
&LASTNAME=User
&TRANSACTIONID=9XJ88717E86951234
&TRANSACTIONTYPE=sendmoney
&PAYMENTTYPE=instant
&ORDERTIME=2012%2d01%2d11T06%3a39%3a13Z
&AMT=0%2e11
&CURRENCYCODE=USD
&PAYMENTSTATUS=Completed
&PENDINGREASON=None
&REASONCODE=None
&PROTECTIONELIGIBILITY=Ineligible
&PROTECTIONELIGIBILITYTYPE=None
&L_CURRENCYCODE0=USD
&L_TAXABLE0=false