pronamic / wp-pronamic-pay-woocommerce

WooCommerce driver for the WordPress payment processing library.
http://www.wp-pay.org/extensions/woocommerce/
6 stars 2 forks source link

Only display Apple Pay payment method if supported #33

Closed remcotolsma closed 1 year ago

remcotolsma commented 1 year ago

In https://github.com/pronamic/wp-pronamic-pay-adyen/issues/11 it was discussed that Apple Pay is currently available at checkout, even though this might not be supported by the browser/device.

This PR makes sure to only displays Apple Pay if the device is capable of making Apple Pay payments by:

  • implementing canMakePayment in the WooCommerce checkout block;
  • using a hidden field to determine Apple Pay availability in legacy checkout.

Note: the changes do not verify if there is an active card through https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/1778000-canmakepaymentswithactivecard as this would require the merchantIdentifier, a customer might also want to set up Apple Pay on their device if Apple Pay is listed as an accepted payment method.

rvdsteege commented 1 year ago

Closing this PR as it has been open for some time now without being merged. If we only want to show Apple Pay on capable devices in the future, we can then see if there are other ways to resolve this.