Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save titanism/955f0c21d53e8c98068c549fb79e75d4 to your computer and use it in GitHub Desktop.
Save titanism/955f0c21d53e8c98068c549fb79e75d4 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.
@hardevine
Copy link

Thanks a lot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment