Re: Custom events for payment methods

Eiji: You wrote https://github.com/GoogleChrome/appr-wrapper. How did you
deal with "validatemerchant" and "paymentmethodselected" events?

On Wed, Oct 4, 2017 at 3:44 PM, Andy Estes <aestes@apple.com> wrote:

> 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?
>
> Thanks,
> Andy
>
>

Received on Wednesday, 4 October 2017 20:56:27 UTC