MonetizationEvent
The MonetizationEvent
interface of the Web Monetization API is the event object for web monetization events, which contains the details to facilitate payments.
Properties
- amount (deprecated) : An integer amount delivered by an ILP packet.
- amountSent : A dictionary containing the currency code and amount sent.
- assetCode (deprecated) : A string representing the currency code (eg USD, EUR) of the received amount.
- assetScale (deprecated) : The scale of the received amount.
- receipt (deprecated) : The base-64 encoded Interledger Stream receipt that the browser received.
- paymentPointer : A URL representing the payment end-point.
Examples
<link rel="monetization" href="https://example.com/pay" />
<script>
// Checking via DOMTokenList
const link = document.querySelector('link[rel="monetization"]') || document.createElement('link')
if (link.relList.supports('monetization')) {
console.log('Web Monetization is supported.')
}
// Checking global scope for MonetizationEvent
if (window.MonetizationEvent) {
console.log('Web Monetization is supported.')
}
// Checking if it's a global event handler
if (window.hasOwnProperty('onmonetization')) {
console.log('Web Monetization is supported.')
}
</script>
Specifications
Specification |
---|
Web Monetization API #events |
Browser Compatibility
desktop | mobile | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on iOS | Samsung Internet | Puma Browser | |
MonetizationEvent | Yes | Yes | Yes | No | Yes | No | No | No | No | No | No | No | Yes |
- Full Support
- No Support
- You'll need to use a Web Monetization Extension