Search Payment Details

APIDeprecatedLast updated: March 16th 2023, @ 11:23:55 am


You can use the Payments API to list completed payments with transaction details. Then, use the transaction IDs in the response to complete other payment operations. For example, you can issue a refund for a payment, by transaction ID.

List payments with transaction details

To list payments with transaction details, enter query parameters to specify the time range of the transaction, how many payments to list, and the sort order of the payments in the response.

Note: All query parameters are optional and not passing any returns all completed payments.

Query parametersDescription
start_time end_timeSpecify the start and end times Internet date and time format.

For example: start_time=2017-03-06T11:00:00Z and end_time=2017-03-06T16:00:00Z
start_idThe ID of the starting resource in the response. When results are paged and you're making subsequent payments calls, you can use the next_id value as the start_id to continue with the next set of results.
countThe number of items to list in the response. The default is 10 with a maximum of 20.
start_indexThe start index of the payments to list. Typically, you use the start_index to jump to a specific position in the resource history based on its cart. For example, to start at the second item in a list of results, specify ?start_index=2.
sort_bySort payments by the payment create_time or update_time.

Request

This example request lists ten payments by update time in ascending order:

curl -v -X GET https://api-m.sandbox.paypal.com/v1/payments/payment?count=10&start_index=0&sort_by=update_time&sort_order=desc \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Access-Token>"

Response

The JSON response body lists payments that match the search criteria. The count field indicates the number of payments in the response. In a subsequent list payments call, set start_id to the next_id value to list the next set of payments.

{
  "payments": [
  {
    "id": "PAY-0US81985GW1191216KOY7OXA",
    "create_time": "2017-06-30T23:48:44Z",
    "update_time": "2017-06-30T23:49:27Z",
    "state": "approved",
    "intent": "order",
    "payer":
    {
      "payment_method": "paypal"
    },
    "transactions": [
    {
      "amount":
      {},
      "description": "The payment transaction description.",
      "item_list":
      {},
      "related_resources": []
    }],
    "links": []
  },
  {},
  {}],
  "count": 3,
  "next_id": "PAY-9X4935091L753623RKOZTRHI"
}

Show payment with transaction details

The show payment details, show sale details, and show captured payment details calls return an array of transactions that include transaction IDs. To show transaction details, call show payment details with a transaction ID.

For example, a payment request returns the following ID:

"id": "PAY-1B56960729604235TKQQIYVY"

Request

To show transaction details, specify the id in the following call:

curl -v -X GET https://api-m.sandbox.paypal.com/v1/payments/payment/PAY-1B56960729604235TKQQIYVY \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Access-Token>"

Response

The response lists transactions:

{
  "id": "PAY-5YK922393D847794YKER7MUI",
  "create_time": "2017-02-19T22:01:53Z",
  "update_time": "2017-02-19T22:01:55Z",
  "state": "approved",
  "intent": "sale",
  "payer":
  {
    "payment_method": "credit_card",
    "funding_instruments": []
  },
  "transactions": [
  {
    "amount":
    {},
    "description": "The payment transaction description.",
    "note_to_payer": "Contact us for any questions on your order.",
    "related_resources": [
    {
      "sale":
      {
        "id": "36C38912MN9658832",
        "create_time": "2017-02-19T22:01:53Z",
        "update_time": "2017-02-19T22:01:55Z",
        "state": "completed",
        "amount":
        {},
        "protection_eligibility": "ELIGIBLE",
        "protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE",
        "transaction_fee":
        {},
        "parent_payment": "PAY-5YK922393D847794YKER7MUI",
        "links": [
        {},
        {},
        {}]
      }
    }]
  }],
  "links": []
}

Additional information