Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to emulate iOS user agent on Chrome, to enable Apple Pay to show?

For development-only reasons, how can one make Chrome running on non-Apple desktops trick "Apple Pay" buttons into showing themselves on enabled sites?

The "Apple Pay" button doesn't have to be functional, just get displayed.

like image 360
Marius Avatar asked Sep 01 '25 10:09

Marius


2 Answers

As a slight update to @anibe's answer, it is also required to add a callback method to return the supported version, as such:

<script>
    window.ApplePaySession = { 
        canMakePayments: function() { return true; }, 
        supportsVersion: function() { return 8; },
        canMakePaymentsWithActiveCard: function() { 
            return jQuery.Deferred().resolve(true).promise(); 
        } 
    };
</script>
like image 124
Q Studio Avatar answered Sep 04 '25 03:09

Q Studio


This 'trick' worked for my team to enable simulate Apple Pay support. However, note that the styling for the Apple Pay buttons are only available to iOS devices using custom CSS rules

window.ApplePaySession = { canMakePayments: function() { return true; }, 
canMakePaymentsWithActiveCard: function() { return 
$.Deferred().resolve(true).promise(); } };

Assumptions:

  • The snippet runs early before the rest of your Apple Pay session validation code
  • You are using jquery deferred to resolve the promise to true
like image 33
Anibe Agamah Avatar answered Sep 04 '25 02:09

Anibe Agamah