Get Transaction List By Subscription Id

samdanibinate
Contributor
Contributor

I have add pay pal subscription button in my website. now i need to fetch the list of transaction by  subscription id .i have received the subscription id through the IPN . But when i call https://api.sandbox.paypal.com/v1/billing/subscriptions/I-A4D69FWCE3PR/transactions?  is says invalid subscription id ,..what is the way to get the transaction list.

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

MTS_Jennifer
Moderator
Moderator

Hello,

Thank you for posting to the PayPal Merchant Technical Support Community.

If your subscription was created through the Subscription API then the below get request will show you the details of the subscription:

https://api.sandbox.paypal.com/v1/billing/subscriptions/I-A4D69FWCE3PR

And you will receive a response similar to this (I replaced all Profile ID information with {{}}):

{
    "status": "ACTIVE",
    "status_update_time": "2020-02-21T21:37:30Z",
    "id": "{{Subscription ID here}}",
    "plan_id": "{{Plan ID}} ",
    "start_time": "2020-02-21T08:00:00Z",
    "quantity": "1",
    "shipping_amount": {
        "currency_code": "USD",
        "value": "0.0"
    },
    "subscriber": {
        "name": {
            "given_name": "Buyer",
            "surname": "BuyerTest"
        },
        "email_address": "buyertest@sandboxpaypal.com",
        "shipping_address": {
            "address": {
                "address_line_1": "1 Main St",
                "admin_area_2": "San Jose",
                "admin_area_1": "CA",
                "postal_code": "95131",
                "country_code": "US"
            }
        }
    },
    "billing_info": {
        "outstanding_balance": {
            "currency_code": "USD",
            "value": "0.0"
        },
        "cycle_executions": [
            {
                "tenure_type": "TRIAL",
                "sequence": 1,
                "cycles_completed": 0,
                "cycles_remaining": 1,
                "total_cycles": 1
            },
            {
                "tenure_type": "REGULAR",
                "sequence": 2,
                "cycles_completed": 0,
                "cycles_remaining": 12,
                "current_pricing_scheme_version": 1,
                "total_cycles": 12
            }
        ],
        "next_billing_time": "2020-02-21T10:00:00Z",
        "final_payment_time": "2021-02-21T10:00:00Z",
        "failed_payments_count": 0
    },
    "create_time": "2020-02-21T21:35:08Z",
    "update_time": "2020-02-21T21:37:30Z",
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{RecurringProfile}}/cancel",
            "rel": "cancel",
            "method": "POST"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{recurringprofile}}",
            "rel": "edit",
            "method": "PATCH"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{recurringprofile}}",
            "rel": "self",
            "method": "GET"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{recurringprofile}}/suspend",
            "rel": "suspend",
            "method": "POST"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{recurringprofile}}/capture",
            "rel": "capture",
            "method": "POST"
        }
    ]
}

If your plan was create through an HTML payment button then it will probably give you the error, invalid resource ID.

Thanks,

Jennifer

PayPal

View solution in original post

Login to Me Too
1 REPLY 1
Solved

MTS_Jennifer
Moderator
Moderator

Hello,

Thank you for posting to the PayPal Merchant Technical Support Community.

If your subscription was created through the Subscription API then the below get request will show you the details of the subscription:

https://api.sandbox.paypal.com/v1/billing/subscriptions/I-A4D69FWCE3PR

And you will receive a response similar to this (I replaced all Profile ID information with {{}}):

{
    "status": "ACTIVE",
    "status_update_time": "2020-02-21T21:37:30Z",
    "id": "{{Subscription ID here}}",
    "plan_id": "{{Plan ID}} ",
    "start_time": "2020-02-21T08:00:00Z",
    "quantity": "1",
    "shipping_amount": {
        "currency_code": "USD",
        "value": "0.0"
    },
    "subscriber": {
        "name": {
            "given_name": "Buyer",
            "surname": "BuyerTest"
        },
        "email_address": "buyertest@sandboxpaypal.com",
        "shipping_address": {
            "address": {
                "address_line_1": "1 Main St",
                "admin_area_2": "San Jose",
                "admin_area_1": "CA",
                "postal_code": "95131",
                "country_code": "US"
            }
        }
    },
    "billing_info": {
        "outstanding_balance": {
            "currency_code": "USD",
            "value": "0.0"
        },
        "cycle_executions": [
            {
                "tenure_type": "TRIAL",
                "sequence": 1,
                "cycles_completed": 0,
                "cycles_remaining": 1,
                "total_cycles": 1
            },
            {
                "tenure_type": "REGULAR",
                "sequence": 2,
                "cycles_completed": 0,
                "cycles_remaining": 12,
                "current_pricing_scheme_version": 1,
                "total_cycles": 12
            }
        ],
        "next_billing_time": "2020-02-21T10:00:00Z",
        "final_payment_time": "2021-02-21T10:00:00Z",
        "failed_payments_count": 0
    },
    "create_time": "2020-02-21T21:35:08Z",
    "update_time": "2020-02-21T21:37:30Z",
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{RecurringProfile}}/cancel",
            "rel": "cancel",
            "method": "POST"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{recurringprofile}}",
            "rel": "edit",
            "method": "PATCH"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{recurringprofile}}",
            "rel": "self",
            "method": "GET"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{recurringprofile}}/suspend",
            "rel": "suspend",
            "method": "POST"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/{{recurringprofile}}/capture",
            "rel": "capture",
            "method": "POST"
        }
    ]
}

If your plan was create through an HTML payment button then it will probably give you the error, invalid resource ID.

Thanks,

Jennifer

PayPal

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.