Skip to main content

Apple Pay and Google Pay with Drupal Commerce

One of the frustrating issues we have had with Drupal Commerce is the lack of a standard method for offering Apple Pay and Google Pay to mobile customers. We're pleased to say that there is now a simple option for Drupal Commerce users via the Stripe payment gateway.

Having got sponsorship, but being busy with other projects ourselves, we asked one of our partners (DevBranch) to develop a patch and then release it to the community via This has been done and you can see the patch here:

The patch works well. We have it installed on the sponsor's busy sites without issue. Here's a step by step on getting it working.

Step 1 - Install the patch

In the patches section of your composer.json file:

            "drupal/commerce_stripe": {
                "3058094: Applepay/Googlepay": ""
Then run a composer update and the patch will be applied.

Step 2 -  Add Apple Merchant Association

The ApplePay process requires that the merchant be identified via a file in the /.well-known/ folder of the website using it. In this case the actual Apple Merchant is Stripe and so you simply need to use the file Stripe provide here.

Step 3 - Update Payment Gateway Configuration

If you access the configuration for the Stripe Payment Gateway you will now see an option to  'Enable The Payment Request Button Element' which you need to select.

You then need to add your Stripe Account ID in the box revealed.

That's It!

That is all that is required to get this working. Your Stripe checkout will now have a checkbox to 'Pay by Apple/Google Pay'. If this is checked a test is made to see if an appropriate wallet is available on that device, and show a branded button if it is. If no wallets are available a suitable message is displayed.

You can then, of course, spend a little time on the front end cosmetics if you need to, but that's up to you and/or your client.