Categories
Code Web Development

Allow customers to update their cards in disabled gateways using Easy Digital Downloads Recurring Payments

Last year, GravityView was using PayPal Pro to process credit card transations with our shopping cart, Easy Digital Downloads. Over time, we became frustrated with the error rate of PayPal notifications: PayPal kept telling us the country code wasn’t set. But it was. This was preventing customers from checking out, so GravityView switched to using Stripe for credit card transactions.

Now, a year later, customers with outdated credit cards who paid with PayPal aren’t able to update their billing information on the GravityView website. Customers can’t see the “Update Card” link because the PayPal Pro gateway is disabled. Because the PayPal Pro gateway is inactive, the link to update the credit card details for a subscription isn’t visible.

Update: There were bigger issues than just the “Update Card” link

It turns out that PayPal was sending GravityView site PayPal Pro payment notifications but since the gateway was not active on the checkout page, the notifications were not being “listened” for. This resulted in a few subscriptions not being renewed properly.

With this in mind, here’s what you should do instead:

  1. Enable the PayPal Pro payment gateway in Easy Digital Downloads (“Downloads” menu, then “Settings” page, then “Payment Gateways” tab)
  2. Add this code to your site to disable the gateway on the checkout page:

The rest of the original post is below:


To reproduce the problem:

  1. Create a subscription in payment gateway
  2. Disable payment gateway
  3. There’s no way for users to update their credit card details

But here’s a fix (isn’t code great?)

Edit: See the updated solution below!

The solution to this problem is to enable the gateway on the account page only—that way, the gateway can respond to Easy Digital Downloads asking whether a subscription’s payment can be updated (using the can_update() method).

Here’s the code (Make sure to update line 16 with the page for your site):

By Zack Katz

Zack Katz is the founder of GravityKit and TrustedLogin. He lives in Leverett, Massachusetts with his wife Juniper.