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.
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.