This quick tutorial shows you how to create an “Unsubscribe” button for your customers when they are registered for recurring billing via PayPal subscriptions. This can come in handy when you use a WordPress plugin (i.e. Gravity Forms) to register your customers/clients for PayPal recurring payments. If your system allows users to subscribe directly from your website but not unsubscribe, this will force them to either sign into their PayPal account to cancel the subscription manually or contact you to cancel it for them. Either way, this will likely lead to some UX issues, complaints and, worst of all, appearing shady to your users. Therefore, if we are accepting subscriptions via our website, it’s best for everyone that we include a clear way for subscribers to cancel their subscription without needing to jump through hoops.
The Unsubscribe Code
To find a way to include a PayPal Unsubscribe button directly on your own website, I had to do some digging into PayPal’s developer documentation. After a bit of searching, I found this HTML.
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_subscr-find&alias=SGGGX43FAKKXN"> <img src="https://www.paypalobjects.com/en_US/i/btn/btn_unsubscribe_LG.gif" BORDER="0"> </a>
Customizing the Unsubscribe Code
This HTML makes it very easy for us to create an Unsubscribe button and place it wherever we want. Before we can use this, though, we need to make one change to the href attribute. At the end of the URL for the href, you’ll see alias=SGGGX43FAKKXN. This alias parameter is defined by PayPal as “the secure merchant account ID of the subscription provider’s PayPal account. This value is in the My business info section of your PayPal account profile.” Replace the value SGGGX43FAKKXN with your own ID.
Customizing the Unsubscribe Button
Next, and optionally, you can change the image being used to represent the button or style the link yourself by adding a class or ID to the anchor As long as the href URL is correct, you can do whatever you want to make the button match your website.
Conclusion
Once you insert your customized link, you’re finished. When a user clicks the Unsubscribe button, he or she will be redirected to PayPal to log in and be taken to their active subscription for your merchant ID. Once there, the customer can cancel with ease. No more unpleasant user experiences and no more having to search through PayPal logs for a specific subscription.
Jaclyn says
I am not seeing where the alias parameter is under business account. Did they move it around or rename it?
Barbara says
All I want to do is unsubscribe
Jeff says
Thanks Ren, This is just what I was looking for!
Stefhan says
Hi.
Thanks for the awesome tip. I’m playing around with sandbox.paypal.com. Unfortunately, when I use the button / link and logs into the PayPal account, it just takes me to the front page of the account. After I’m logged in, only then will the unsubscribe URL take me where I want to go. Do you have any tips?
Thanks.
Ren says
Hey, Stefhan. I see what you’re saying and I definitely understand how you’d want that to work. I’m not aware of any way to resolve it because those redirects are handled completely on the PayPal side. I’d suggest getting in touch with a tech-support rep who may be able to shed some light on this. If you do learn of a solution, please let me know because I’d be very interested in knowing.
Kate says
I’m having the same problem, I wonder if they’ve changed something?
Beth says
Big help, big thanks!
bob says
Thanks brother! Just the code I needed. May the Lord bless you for your tireless efforts to teach and assist others.
Ren says
Hey, Bob. I’m glad to have helped! 🙂