1

I'm trying to fetch Subscription details by its Subscription ID, but i'm unable to get it. It raised this error: {"name":"INVALID_RESOURCE_ID","message":"INVALID_RESOURCE_ID","information_link":"https://developer.paypal.com/docs/api/orders/v1/#error-INVALID_RESOURCE_ID","debug_id":"9fc43dc5ea630"}

Below is my code:

$accessToken='A21AAEk8KaihyonOUmmnSsx_2MLCXocZIMHjRxJreQtQ8Tck7fpxC_Q17u-OPRlnAdYWHRRwbiz-hLfBlbOJj_7SwOYVDoOaw';
$curl = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-BW452GLLEP1G");
curl_setopt($curl, CURLOPT_POST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer ' . $accessToken,
    'Accept: application/json',
    'Content-Type: application/json'
));
$response = curl_exec($curl);
$result = json_decode($response);
print_r($response);

[![Error Screenshot][1]][1]


  [1]: https://i.stack.imgur.com/xcvlW.png
Kamal Kumar
  • 200
  • 3
  • 11
  • 2
    What's the error? – Brett Gregson Feb 06 '20 at 12:06
  • Error: {"name":"INVALID_RESOURCE_ID","message":"INVALID_RESOURCE_ID","information_link":"https://developer.paypal.com/docs/api/orders/v1/#error-INVALID_RESOURCE_ID","debug_id":"9fc43dc5ea630"} – Kamal Kumar Feb 06 '20 at 12:10
  • 1
    Check it please - https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_create – Dmitry Leiko Feb 06 '20 at 12:10
  • I'm not so perfect in PHP and APIs, can you please guide me a little to add these actions or call cURL? – Kamal Kumar Feb 06 '20 at 12:11
  • 1
    Could you please show more code – Dmitry Leiko Feb 06 '20 at 12:12
  • @Dmitry i have updated the code in description please check and if you can help me out here? – Kamal Kumar Feb 06 '20 at 12:14
  • Paypal doesn’t seem to recognize the resource ID you are passing. Since there are no other parameters here, I assume that can only be referring to the `I-BW452GLLEP1G` part of the URL then(?) - so double-check that is correct. – 04FS Feb 06 '20 at 12:42
  • @04FS yes i checked the code twice, but didn't found anything else, only this error – Kamal Kumar Feb 06 '20 at 12:46
  • @04FS you can also check this screenshot https://i.stack.imgur.com/xcvlW.png error – Kamal Kumar Feb 06 '20 at 12:54
  • 1
    So where does `I-BW452GLLEP1G` come from then? – 04FS Feb 06 '20 at 13:03
  • It is the subscription ID where i'm getting user's recurring payments. There are multiple subscription IDs, this is one of them. – Kamal Kumar Feb 06 '20 at 13:05
  • **[You should not switch off `CURLOPT_SSL_VERIFYHOST` or `CURLOPT_SSL_VERIFYPEER`](https://paragonie.com/blog/2017/10/certainty-automated-cacert-pem-management-for-php-software)**. It could be a security risk! [Here is how to get the certificate bundle if your server is missing one](https://stackoverflow.com/a/32095378/1839439) – Dharman Feb 08 '20 at 17:47

0 Answers0