How to use the PayPal Subscriptions API with Node.js to manage recurring payments on serverless cloud functions.

Our  Google add-on store uses PayPal Subscriptions with  Digital Goods to process recurring payments and the invoices are sent to customers through  Document Studio.

There are two steps.

  1. Customers makes the payment and completes the order on our website.
  2. PayPal sends a BILLING.SUBSCRIPTION.ACTIVATED webhook to a serverless function.
  3. The function (running on Firebase, Google Cloud) verifies the subscription and checks if the status is active.
  4. It invokes the Apps Script API to complete the order.

The cloud function was previously using the official PayPal SDK for Node.js but it has been recently deprecated and no longer supports the new PayPal subscriptions API endpoints. Migrating from the PayPal Node SDK to your own solution is relatively simple and involves two steps:

1. Get the PayPal Access Token

2. Verify PayPal Subscription

#node.js #node

How to Use PayPal Subscriptions API with Node.js
3.95 GEEK