Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add way to update `total` and `displayItems` before `.show()` #639
We’ve heard from merchants that they’d like a way to update the
One solution may be to just create new
Payment Handlers get passed
Thank you for bringing this to our attention. We've been recommending merchants with this requirement to call
We don't recommend calling
Is this helpful or do you still see room for improvement in the API?
P.S.: One neat trick in Chrome that not many people know is to "warm up"
@rsolomakhin Ah, fascinating! Thanks for detailed response and Chrome details!
That sounds like a great workaround, but it sort of falls out of some assumptions about the API rather than specific contracts, right?
It's true that the spec does not specify when the scan for the payment apps should happen. There's a fine line between predictability of API behavior and tying the hands of browser manufacturers. I see your point here, though. Perhaps this is good behavior to standardize across browsers, so that web developers can rely on it. @ianbjacobs Can we put this on agenda for the next call or the face-to-face in November?
I have a proposal in the works to optionally fire
In summary, the corresponding events between the merchant and the payment app are:
This can get a little confusing, so let's clarify a bit. According to the spec, calling
// CASE 1: This is fine: pr = new PaymentRequest(); pr.canMakePayment(); pr.show(); // CASE 2: This is also fine: pr = new PaymentRequest(); pr.show(); // CASE 3: This will throw in canMakePayment(): pr = new PaymentRequest(); pr.show(); pr.canMakePayment(); // InvalidStateError
Is it possible, however, that a browser implements the PaymentRequest spec correctly, but does not work in
Note that the opposite is not true. The
I hope this information is useful. Please let me know if I can help with any other concerns you might have.