I'm in the same boat as @marcoscaceres in that I believe the current API can accommodate the use case. I would recommend to use of [payment handler API](https://w3c.github.io/payment-handler/), if we decide to go with the `CanMakePayment` event firing design. Your `PaymentRequest` code would look like this:
```javascript
let paymentRequest = new PaymentRequest(
[{supportedMethods: 'https://chadcampbell.com/preauth'}], ...);
// Send `CanMakePayment` event to the payment handler.
paymentRequest.canMakePayment()
.then(function(res) {
if (res) {
// The payment handler has pre-authorized a transaction
// with some static amount, e.g., USD $1.00.
} else {
// Pre-authorization failed or payment handler not installed.
}
})
.catch(function(ex1) {
// Unexpected error occurred.
})
;
```
In your payment handler, you would write the following:
```javascript
self.addEventListener('canmakepayment', function(evt) {
// Pre-authorize here.
let preAuthSuccess = ...;
evt.respondWith(preAuthSuccess);
});
```
This payment handler would need to live in a service worker at `https://chadcampbell.com/preauth` scope.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-request/issues/633#issuecomment-332523214