There doesn't appear to be a direct way to list all of your subscriptions, but you can use the Transaction Search API to retrieve a list of your transactions (one month at a time, max 500 results per page) and grab the paypal_reference_id
of each transaction object, which will be a valid subscription ID if the paypal_reference_id_type
is "SUB"
.
Here's an example of the GET URL, which requires an Oauth token:
https://api-m.sandbox.paypal.com/v1/reporting/transactions?start_date=2022-07-01T00:00:00-0700&end_date=2022-07-31T23:59:59-0700&fields=all&page_size=500&page=1
Here's a simplified example of the response data:
{
"transaction_details":
[
"transaction_info":
{
"paypal_reference_id": "I-ABCDEFGHIJKL",
"paypal_reference_id_type": "SUB",
}
]
}
Once you've retrieved all of your subscription IDs, you can use the Subscriptions API to retrieve their details (such as its status) via an authenticated GET request:
https://api-m.sandbox.paypal.com/v1/billing/subscriptions/I-ABCDEFGHIJKL
Here's a simplified example of the response data:
{
"status": "ACTIVE",
}