Skip to content
Web Monetization logo Web Monetization
GitHub

amountSent

The monetization event’s amountSent attribute returns you the amount (value) and currency code The ISO 4217 alphabetic code that represents a currency (USD, CAD, etc.) (currency) of the Web Monetization payment sent to you.

Value

The value uses the same data structure as the PaymentCurrencyAmount dictionary in the Payment Request API. The returned value is the value it was initialized with.

Example

<link rel="monetization" href="https://wallet.example/alice" />
<script>
const link = document.querySelector('link[rel="monetization"]')
link.addEventListener('monetization', (event) => {
// See how much was sent and in what currency
const {
amountSent: { value, currency },
} = event
console.log(`Browser sent ${currency} ${value}.`)
})
</script>

Specifications