Select PayPal landing page for Easy Digital Downloads

This post is more than 6 years old.

Easy Digital Downloads comes with a PayPal Standard payment gateway, which lets us get our store up and selling quickly and cheaply. Let’s get it to select a better landing page with PayPal Standard, and make our credit card customers happier.

Update: for Gravity Forms PayPal, see the end of this article

When our customer buys something from our Easy Digital Downloads store and pays through PayPal, the default landing page on PayPal assumes that our customer uses PayPal. They can also select to use a credit card, but that’s not especially obvious. PayPal lets us switch that around, if we ask it to show a special landing page called Billing. This is what it looks like, and I think you’ll agree that it’s more intuitive for credit card customers:

PayPal Standard with the Billing landing page
PayPal Standard with the Billing landing page

We can get PayPal to show that page by sending it a variable called landing_page with the value Billing. If we know the customer’s country code, we can send that too and PayPal will customise the page in their language. Easy Digital Downloads has a filter hook that allows us to change what is sent to PayPal:

add_filter('edd_paypal_redirect_args', function($args, $purchase) {
    // select the Billing landing page, which makes the Credit Card fields more obvious
    $args['landing_page'] = 'Billing';

    // attempt to set the country code, for a better customer experience
    if (!empty($purchase['post_data']['billing_country'])) {
        $args['lc'] = $purchase['post_data']['billing_country'];
    }

    return $args;
}, 10, 2);

To make it easy, you can download the code from this gist and install it as a plugin in WordPress.

Update: and one for making Gravity Forms PayPal select a better landing page too.

Job is done more easily for credit card customers now.