Activities API Integration for Third-Party Providers

Docs

Last updated: Feb 27th, 8:23am

 

Set up your development environment

Before you can integrate Activities, you must:

  1. Be enrolled as a third-party provider (TPP). For more information, contact PayPal.

    During the enrollment process, PayPal gives you OAuth 2.0 credentials that authorize you to make subsequent REST API calls.

  2. Get consent from the user to call the Activities API on the user's behalf. To get user consent, integrate Log in with PayPal. Then, request a user's permission to access their PayPal financial activities by passing the following scope value:

    http://uri.paypal.com/services/identity/activities/psd2
  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

Parameter Type Description
start_time string Filters the list by a time range. The start_time is the lower bound of the time range in Internet date and time format.

Default: end_time value minus 30 days
end_time string Filters 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_token number The 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_size integer The number of items to return in the list.

Maximum value: 150
  • You can only access the last 90 days of financial activities.
    • If you omit a date range or other filters, the response lists all available activities for the last 90 days.
    • If you include a start and end date to specify a date range, the dates must be within the last 90 days to return available activities. If you specify a date range that includes dates outside of the last 90 days, the response won't include the activities that occurred outside the last 90 days.
  • The default number of activities is 30.


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 activities for the date range that the request defines:

    1{
    2 "items": [{
    3 "extensions": {
    4 "payment_properties": {
    5 "invoice_number": "19371196219753670",
    6 "debit_credit_code": "DEBIT"
    7 }
    8 },
    9 "status": "COMPLETED",
    10 "gross": {
    11 "currency_code": "USD",
    12 "value": "10.00"
    13 },
    14 "counterparty": {
    15 "email": "counterparty@example.com",
    16 "name": "Matthew Cecile"
    17 },
    18 "subtype": "REFUND",
    19 "id": "9JM17152VJ518213T",
    20 "time_created": "2018-08-22T14:26:47.000Z",
    21 "activity_type": "PAYMENT"
    22 }, {
    23 "extensions": {
    24 "payment_properties": {
    25 "invoice_number": "$19371196219753670",
    26 "debit_credit_code": "CREDIT"
    27 }
    28 },
    29 "status": "REFUNDED",
    30 "gross": {
    31 "currency_code": "USD",
    32 "value": "10.00"
    33 },
    34 "counterparty": {
    35 "email": "counterparty@example.com",
    36 "name": "Matthew Cecile"
    37 },
    38 "subtype": "PAYMENT",
    39 "id": "0TE09793TX730351S",
    40 "time_created": "2018-08-22T14:25:58.000Z",
    41 "activity_type": "PAYMENT"
    42 }]
    43}


    Additional information