Skip to content

Instantly share code, notes, and snippets.

  • Save hardevine/5234bee666be03024f343f956c1c843c to your computer and use it in GitHub Desktop.
Save hardevine/5234bee666be03024f343f956c1c843c to your computer and use it in GitHub Desktop.
How to list all PayPal subscriptions and billing agreements and recurring ids API retrieve fetch all

How to list all PayPal subscriptions and billing agreements and recurring ids API retrieve fetch all

  1. Go to https://www.paypal.com/billing/subscriptions.

  2. Open Devtools and run the following script:

const arr = [];

const interval = setInterval(function() {
    for (const el of document.getElementsByClassName('list-plan__link')) {
      if (!arr.includes(el.innerHTML)) arr.push(el.innerHTML);
    }

    
    const buttons = document.getElementsByClassName('pagination__page');
    let match = false;
    for (const btn of buttons) {
      if (btn.getAttribute('data-pa-click') === 'pageination-next') {
          btn.click();
          match = true;
          break;
      }
    }
    if (!match) {
      clearInterval(interval);
      alert('done');
    }
}, 3000);

console.log(JSON.stringify(arr, null, 2));
  1. When it is finished, you will get an alert saying "done", and in the console will be the array of ID's for you to copy/paste.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment