Activities API Integration

Docs

Last updated: Feb 27th, 8:25am

 

Set up your development environment

Before you can use the Activities API, you must:

  1. Be enrolled in the pilot program. For information, contact your PayPal account manager.

  2. Get permission from the user to access their activity history through the PayPal login experience. The merchant's web site must provide the user with the PayPal login experience to grant consent. The developer uses the returned access token in calls to the Activities API to access the user's activity list.

  3. Create sandbox accounts to test your web and mobile apps.

List activities

Use the Activities API to list financial activities for a user. Define query parameters in the request to filter the information that appears in the response.

Query parameters

ParameterTypeDescription
start_timestringFilters the list by a time range. The start_time is the lower bound of the time range in Internet date and time format. The start_time cannot be greater than one year before the end_time.

Default: end_time value minus 30 days
end_timestringFilters the list by a time range. The end_time is the upper bound of the time range in Internet date and time format.

Default: current time
next_page_tokennumberThe token for the next page of results. The list activities call returns this token in the HATEOAS links in the response. If you omit this parameter, the API returns the first page of data.
page_sizeintegerThe number of items to return in the list.

Maximum value: 150
  • If you omit a date range or other filters, the response lists all available activities for the last 90 days.
  • If you include only a start and end date, the response lists all available activities for the specified date range.
  • The default number of activities is 30.


Example

This example request specifies a start date, an end date, a time, and a page size:

  1. cURL
  2. Node
  3. Java
  4. PHP
  5. Python
  6. Ruby
  7. .NET
1curl -i -X GET https://api-m.sandbox.paypal.com/v1/activities/activities?start_time=2018-08-22T00:00:01.000Z&end_time=2018-08-22T23:59:59.999Z&page_size=10
2-H "Authorization: Bearer <Access-Token>"

This sample response lists all possible activities for the date range defined in the request:

    1{
    2 "items": [{
    3 "extensions": {
    4 "payment_properties": {
    5 "invoice_number": "19371196219753670",
    6 "debit_credit_code": "DEBIT"
    7 }
    8 },
    9 "fee": {
    10 "currency_code": "USD",
    11 "value": "0.29"
    12 },
    13 "net": {
    14 "currency_code": "USD",
    15 "value": "7.71"
    16 },
    17 "status": "COMPLETED",
    18 "gross": {
    19 "currency_code": "USD",
    20 "value": "10.00"
    21 },
    22 "counterparty": {
    23 "email": "[email protected]",
    24 "name": "Matthew Cecile"
    25 },
    26 "subtype": "REFUND",
    27 "id": "9JM17152VJ518213T",
    28 "partner_fee": {
    29 "currency_code": "USD",
    30 "value": "2.00"
    31 },
    32 "time_created": "2018-08-22T14:26:47.000Z",
    33 "activity_type": "PAYMENT"
    34 }, {
    35 "extensions": {
    36 "payment_properties": {
    37 "invoice_number": "$19371196219753670",
    38 "debit_credit_code": "CREDIT"
    39 }
    40 },
    41 "fee": {
    42 "currency_code": "USD",
    43 "value": "0.59"
    44 },
    45 "net": {
    46 "currency_code": "USD",
    47 "value": "7.41"
    48 },
    49 "status": "REFUNDED",
    50 "gross": {
    51 "currency_code": "USD",
    52 "value": "10.00"
    53 },
    54 "counterparty": {
    55 "email": "[email protected]",
    56 "name": "Matthew Cecile"
    57 },
    58 "subtype": "PAYMENT",
    59 "id": "0TE09793TX730351S",
    60 "partner_fee": {
    61 "currency_code": "USD",
    62 "value": "2.00"
    63 },
    64 "time_created": "2018-08-22T14:25:58.000Z",
    65 "activity_type": "PAYMENT"
    66 }]
    67}

    Additional information