CanMakePaymentEvent: CanMakePaymentEvent() constructor
Web-Based Payment Handler APIservice
Web-Based Payment Handler APIservice
The **`CanMakePaymentEvent()`** constructor creates a new CanMakePaymentEvent object instance.
## Syntax
```js-nolint
new CanMakePaymentEvent(type)
```
### Parameters
- `type`
- : A string representing the type of event. In the case of `CanMakePaymentEvent` this is always `canmakepayment`.
## Examples
A developer would not use this constructor manually. A new `CanMakePaymentEvent` object is constructed when a handler is invoked as a result of the canmakepayment event firing.
```js
self.addEventListener("canmakepayment", (e) => {
e.respondWith(
new Promise((resolve, reject) => {
someAppSpecificLogic()
.then((result) => {
resolve(result);
})
.catch((error) => {
reject(error);
});
}),
);
});
```
## Specifications
## Browser compatibility
## See also
-
- [Web-based payment apps overview](https://web.dev/articles/web-based-payment-apps-overview)
- [Setting up a payment method](https://web.dev/articles/setting-up-a-payment-method)
- [Life of a payment transaction](https://web.dev/articles/life-of-a-payment-transaction)
- [Using the Payment Request API](/docs/Web/API/Payment_Request_API/Using_the_Payment_Request_API)
- [Payment processing concepts](/docs/Web/API/Payment_Request_API/Concepts)
Cite this
"CanMakePaymentEvent: CanMakePaymentEvent() constructor". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/CanMakePaymentEvent/CanMakePaymentEvent JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy