Scripts to help you web monetize your site and/or API
Switch branches/tags
Nothing to show
Clone or download

Web Monetization Scripts

Client-side scripts to Web Monetize sites



The donate script is used for a page that's supported through donations in the background. It shows the user a coil logo when payment is being sent, and if the Interledger connection drops it will re-establish it.

This is useful for Web Monetizing static sites (i.e. replacing advertising). For cases where you want to replace a paywall, you'll want something that can securely detect when payment occurs (scripts for that use case will be added soon).

Including the Script

<script src=""></script>

The script also exists at, or can be built locally and served from your site.


Example of usage at examples/donate.html, source code at src/donate.js.

  paymentPointer: '$',
  noRetry: false,
  noWidget: false


  • opts: Object - Required. Options for donation.
  • opts.paymentPointer: String - Required. Payment pointer to receive donations.
  • opts.noRetry: Boolean - Optional, default false. If noRetry is set then the ILP connection will not be re-established when it goes down. You can manually re-establish it by calling donate again.
  • opts.noWidget: Boolean - Optional, default false. If noWidget is set then no Coil logo will appear in the bottom left of the screen when payment occurs.

Return Value

  • ret: Promise<EventTarget> - Listen for money to get a notification when a packet of money has been sent (ev.detail.amount has the exact amount). Listen for close to get a notification whenever the connection drops.
  • ret.connection: WebConnection - Web Monetization Connection currently used by the donation.
  • WebStream - Web Monetization Stream currently used by the donation.