w3c / w3c/payment-request

Response timeout could leave page/user in confused state.

Open
#737 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

proposal - needs discussion
Dominant language
HTML
Stars
510
Forks
139
PR merge metrics
No merged PRs in 30d

Description

From Gecko bug, spec says:

After the payment request has been accepted and the PaymentResponse returned to the caller but before the caller calls complete() the payment request user interface remains in a pending state. At this point the user interface ought not offer a cancel command because acceptance of the payment request has been returned. However, if something goes wrong and the developer never calls complete() then the user interface is blocked.

For this reason, implementations MAY impose a timeout for developers to call complete(). If the timeout expires then the implementation will behave as if complete() was called with no arguments.

Problem is that the you have a race condition:

  1. the promise from fetch("/make-payment", {body: response.toJSON()}) may take longer to resolve than the payment sheet being presented (e.g., 5 seconds in Browser X).
  2. As the payment sheet is shutting down due to a timeout, fetch() promise resolves successfully (the user has been charged!).
  3. The merchant is now in an awkward position, having to inform the user that the payment actually went through... but unable to use the payment sheet to do so (i.e.,.complete() now just returns a rejected promise).

We might need a new event to notify the merchant if the sheet has shut down on them. Otherwise, they will try to .complete() and response will just return a rejected promise.

@domenic, @zkoch, @aestes, @adrianba, all, thoughts?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start by reading the cited Payment Request specification and tracing the timeout and complete() behavior described in the issue. Done means reaching agreement on how merchants are notified when the payment sheet closes before complete() and documenting the resulting API behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
api, payments, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.