In this guide, we show you how to extend your Membership Account page with a link to help members manage their PayPal subscription on the PayPal platform.
This snippet adds a “Manage Subscription at PayPal” link under the Memberships section of the Member Account page, improving the user experience for members with PayPal-managed subscriptions.
About the “Manage Subscription” Link
If your site uses PayPal Express as a payment gateway, offering direct access to subscription management on PayPal improves the member experience, allowing members to:
- Update the payment method used to fund their subscription
- View upcoming recurring payments
- View billing history
Why This Link Must Be Added With Custom Code
PMPro’s PayPal Express gateway integration does not support the new subscription update methods in our payment gateway class. This means that all subscriptions managed via PayPal must be updated directly by the account holder on PayPal’s platform.
For comparison:
- Stripe Integration: Our Stripe gateway includes deeper integration with subscription management. Depending on your configuration, members will see either a link to update their billing information on your site or will be redirected to the Stripe Customer Portal directly from the Membership Account page.
- PayPal: We hope to add similar functionality for PayPal subscriptions in a future PayPal gateway version. Until then, PayPal subscriptions must be managed externally on PayPal’s site.
This snippet bridges the gap by adding a clear “Manage Subscription at PayPal” link to guide members to the appropriate PayPal page.
How the Code Works
This recipe uses the pmpro_member_action_links
filter to insert an additional action link into the Membership Account page’s “My Memberships” section. The code has a few working parts:
- Checks User Subscriptions: First, the recipe retrieves subscriptions for the current user and level being displayed.
- Verifies PayPal Gateway: Next, the code confirms that the subscription’s payment gateway is PayPal Express.
- Adds the Link: Finally, the logic is met to output a “Manage Subscription at PayPal” link that points to PayPal’s Autopay page.
The Code Recipe
Adding the Recipe to Your Website
You can add this recipe to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.
How to Customize This Code Recipe
- Modify the Link Text: You can change the text “Manage Subscription at PayPal” to suit your tone, e.g., “Update Billing on PayPal.”
- Different PayPal URL: Update the URL in
esc_url()
if PayPal changes its subscription management URL or if you operate a site outside the US and the PayPal domain is different.
Free Course: Membership Site Development—The Basics
Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.