Skip to content

Specify how to construct PaymentRequestDetailsUpdate from PaymentDetailsUpdate #376

Open
@danyao

Description

@danyao

The "paymentmethodchange" event allow a payment handler to communicate with the merchant before the payment request completes. It involves the following interfaces:

  1. Payment handler side:
partial interface PaymentRequestEvent {
  Promise<PaymentRequestDetailsUpdate?> changePaymentMethod(DOMString methodName, optional object? methodDetails = null);
}
  1. Merchant side:
partial interface PaymentRequestUpdateEvent : Event {
  void updateWith(Promise<PaymentDetailsUpdate> detailsPromise);
};

The Payment Handler API spec is unspecific about how to turn the PaymentDetailsUpdate object the merchant provides to the PaymentRequestDetailsUpdate object the payment handler receives. Section 7.2 Change Payment Method Algorithm [1] simply says:

5. Construct and return a PaymentRequestDetailsUpdate from the detailsPromise in event.updateWith(detailsPromise).

Proposal:
I think we should either merge the two object definition, or specify clearly how to convert one object from another. We should also do the same for the "shippingaddresschange" and "shippingoptionchange" events.

[1] https://w3c.github.io/payment-handler/#dfn-change-payment-method-algorithm

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