Skip to content

How to detect if visitor can make web payments? #13

@billythekid

Description

@billythekid

Hi all,

Yeah like the title says, is there a way, preferably server side / twig but can be JS if that's the only way, to detect if the current visitor has the capability to use web payments (so not even show the option in the gateway select dropdown if they can't use it)

In one site I have we use a select dropdown for the html form code to be used for each option. if you select the credit card gateway for example you get the sagepay form, finance gives another gateway's form, paypal gives the paypal button and apple pay / google pay gives this plugin's rendered button. With the finance option I don't show the dropdown if the cart isn't "financable" (minimum price etc.) I'd like to do something similar for the web payments option, if the visitor's browser/device doesn't support it, don't give them the option to select it in the first place.

I found the docs for apple pay and the docs for google pay to check if each is supported by the current visitor's browser/device but not sure how this is handled in the plugin already (since I don't actually get a button in a browser that doesn't support it but is that because it doesn't support it (so it's failing) or because that's been checked by the plugin.)

Is there a test we can wrap the template code in to decide whether to show it or not?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions