How to Use the Merchant API to Get Transaction Data

Important: This integration method is deprecated as of January 1, 2017. PayPal continues to support existing merchants using this method, but please be advised new features and enhancements will not be applied to these integrations. For new integrations, see the PayPal Checkout Integration Guide.

To use the Merchant API to get transaction data:

  1. List an account's transaction history.
  2. Show details for a transaction.

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

Note: The following samples show POST requests.

Step 1: List transaction history for an account

Specify your search criteria in a TransactionSearch call. The following example 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: Show transaction details

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