Search code examples
node.jspaypalpaypal-subscriptions

Integrate Paypal subscription in node app


After reading some source code I saw that neither checkout-server-sdk nor payouts-server-sdk contain libraries to implement easily subscriptions.

So what is the right way to proceed today? Use deprecated paypal-rest-sdk? Implement REST api? Render Paypal Smart Button and use webhooks or anything else?


Solution

  • The Subscriptions documentation explains how to integrate it. Any API calls you implement require a direct HTTP integration, as there is no SDK for subscriptions.

    Do not use a deprecated SDK -- apart from the fact that it is deprecated and should not be used for anything, it is also not compatible with the current version of PayPal Subscriptions.

    Webhooks are necessary for notification of future events. Webhook event names for subscriptions are listed here, but essentially you can just listen for PAYMENT.SALE.COMPLETED and have all logic be driven based on initial receipt and noting when you expect the next one for the subscription to continue.

    For reconciliation, the parameter custom_id can be set when a subscription is created; its value will be returned in future webhooks and other queries of the subscription's status.