How to implement PayPal recurring payments in Magento 2?
A convenient way to set recurring payments through PayPal is the Subscriptions & Recurring Payments extension. To set up this function with the help of the extension, do the following:
Step 1. Navigate to Stores > Configuration > Sales > Payment Methods > PayPal Express Checkout > Configure.
Step 2. Fill in the following data (you can get credentials from PayPal):
- Email Associated with PayPal Merchant Account
- API Username, Password, and Signature.
Step 3. Enable Sandbox Mode and sign in with your PayPal credentials.
Step 4. Choose whether you want to enable API Uses Proxy setting.
Step 5. ?hoose the Yes option in the Enable this solution dropdown to enable the PayPal payment method.
Step 6. Then click the Save Config and clear the cache so that the configurations are displayed correctly on the front page.
Step 7. If you need to get Merchant Account ID, open the PayPal admin panel and navigate to Sandbox > Accounts > View/Edit Account:
Step 8. Then fill it in the Merchant Account ID field.
Step 9. Go to Magento account and navigate to Subscriptions and recurring payments > Configuration > PayPal to authorize and link your store with the PayPal account.
Step 10. Fill in the Client ID and Client Secret fields with the credentials from your developer’s PayPal account.
Step 11. Then go to the PayPal account, navigate to the My Apps & Credentials window and click the Create App button. Now the administrator can copy the Client ID and Secret from this page:
Step 12. Paste the copied info into the Client ID and Client Secret fields in the PayPal Configuration window and click Save Config to enable Webhook ID generation.
Step 13. After that, click Create to generate Webhook ID.
Step 14. Then navigate to the Magento account, go to Subscriptions & Recurring Payments > Configuration> General and select PayPal Express Checkout in the Supported Payment Gateways section. Click Save Config and clear Magento Cache so that the configurations are displayed correctly on the front page:
If you want to implement other payment systems using this extension, then check out the user guide.
Check out the Recurring billing can get your Magento 2 store back in line article to know why recurring payments are important.