how get the subscription detail using subscription ID

Moserab
Contributor
Contributor

Hi,

My pay pal subscription plan was created through an HTML payment button. The test payment was successful.

Now I want to get the details of subscription plan and use this code

  use PayPal\Api\Agreement;

    $agreement = new \PayPal\Api\Agreement();

   

    try {

        $agreement = Agreement::get('I-W1H1BL0CB9WY', $apiContext);   

    }

    catch (PayPal\Exception\PayPalConnectionException $ex) {

        echo $ex->getCode();

        echo $ex->getData();

        die($ex);

    } catch (Exception $ex) {

        die($ex);

    }

  

    echo $agreement;

 

 It gives the error, invalid ID:

400{"name":"INVALID_PROFILE_ID","debug_id":"3164aafd4fa49","message":"The profile ID is invalid","information_link":"https://developer.paypal.com/docs/api/payments.billing-agreements#errors"}PayPal\Exception\PayPalCon...: Got Http response code 400 when accessing https://api.sandbox.paypal.com/v1/payments/billing-agreements/I-W1H1BL0CB9W......

If I call the

 

https://api.sandbox.paypal.com/v1/billing/subscriptions/I-W1H1BL0CB9WY/transactions?

it says:

{"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}

 

how can I get the subscription information using subscription ID?

Thanks 

Tatjana

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

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