W3C home > Mailing lists > Public > public-payments-wg@w3.org > October 2017

Custom events for payment methods

From: Andy Estes <aestes@apple.com>
Date: Wed, 04 Oct 2017 12:44:02 -0700
Message-id: <F9E3622F-BF90-4552-8A0E-9F39CB8329D6@apple.com>
To: public-payments-wg@w3.org
Hi folks,

In Apple Pay JS, there are two events that do not have equivalents in the Payment Request API (validatemerchant and paymentmethodselected). A PaymentRequest implementation that supports Apple Pay needs to account for these events, and I can think of two ways to do this:

1. Make the “data” object in the PaymentMethodData dictionary be an event target for Apple Pay. Unfortunately the spec requires this object to be JSON-stringified then re-parsed before being passed to the payment handler, but I suppose an implementation could keep around a reference to the original object for the purposes of firing events. If the spec didn’t require JSON round-tripping for all payment method objects, this is unquestionably the option I’d choose.

2. Fire payment method-specific events on the PaymentRequest object with prefixed names (e.g. applepayvalidatemerchant and applepaypaymentmethodselected). This seems distasteful, but simpler.

I’m wondering if anyone else has encountered this issue when implementing a payment method, and if so, how they went about solving it. Is there a recommended way for extending PaymentRequest with payment method-specific events?

Received on Wednesday, 4 October 2017 19:45:22 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 4 October 2017 19:45:23 UTC