{"id":25716309,"url":"https://github.com/interledgerjs/web-monetization-polyfill","last_synced_at":"2025-08-17T08:03:55.881Z","repository":{"id":72491023,"uuid":"137539782","full_name":"interledgerjs/web-monetization-polyfill","owner":"interledgerjs","description":"Polyfill for web monetization that requires no extension","archived":false,"fork":false,"pushed_at":"2018-12-19T22:25:04.000Z","size":152,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-05T20:52:25.328Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interledgerjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-06-15T23:28:03.000Z","updated_at":"2020-05-19T03:26:28.000Z","dependencies_parsed_at":"2023-04-06T08:05:31.415Z","dependency_job_id":null,"html_url":"https://github.com/interledgerjs/web-monetization-polyfill","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/interledgerjs/web-monetization-polyfill","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Fweb-monetization-polyfill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Fweb-monetization-polyfill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Fweb-monetization-polyfill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Fweb-monetization-polyfill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interledgerjs","download_url":"https://codeload.github.com/interledgerjs/web-monetization-polyfill/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interledgerjs%2Fweb-monetization-polyfill/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270820793,"owners_count":24651534,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-25T14:52:54.607Z","updated_at":"2025-08-17T08:03:55.851Z","avatar_url":"https://github.com/interledgerjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web Monetization Polyfill\n\u003e Use [web monetization](https://github.com/interledger/rfcs/blob/master/0028-web-monetization/0028-web-monetization.md#web-monetization) without a browser extension\n\n- [Usage](#usage)\n- [Specification](#specification)\n  - [Register Web Monetization Handler](#register-web-monetization-handler)\n  - [Monetize a Web Page](#monetize-a-web-page)\n- [TODOs](#todos)\n\n## Usage\n\nYou can include the polyfill with the following script tag:\n\n```html\n\u003cscript src=\"https://polyfill.webmonetization.org/polyfill.js\"\u003e\u003c/script\u003e\n```\n\nIf you want to use Web Monetization in your webpage, most users will have an easier time using the [pre-written web monetization scripts,](https://github.com/interledgerjs/web-monetization-scripts) intended for common use cases. The Web Monetization API should only be used directly if you need to write advanced functionality or are familiar with the Interledger stack.\n\n## Specification\n\nThe exact specification of these methods can be found [in the Web Monetization RFC](https://github.com/interledger/rfcs/blob/master/0028-web-monetization/0028-web-monetization.md#web-monetization). This README just describes how the polyfill implements these functions.\n\n### Register Web Monetization Handler\n\nAssociates a 'handlerUri' as this browser's web monetization handler so that they can send and receive Interledger packets on behalf of the user. Unless you're a Web Monetization provider like [Coil](https://coil.com) you don't need to use this function. If you want to implement a handler, the API can be found in [the Web Monetization RFC](https://github.com/interledger/rfcs/blob/master/0028-web-monetization/0028-web-monetization.md#web-monetization).\n\n```js\nwindow.WebMonetization.register({ name: string, handlerUri: string })\n```\n\n- A page pulls in the polyfill script.\n- The page calls `window.WebMonetization.register` with the url of their web monetization handler.\n- A popup is created, asking the user to confirm their web monetization handler\n- The user confirms and the popup is dismissed\n\n### Monetize a Web Page\n\nCreates an [Interledger/STREAM connection](https://github.com/interledger/rfcs/blob/master/0028-web-monetization/0028-web-monetization.md#ilp-connection-class) that allows the webpage to send money over Interledger.\n\n```js\nasync window.WebMonetization.monetize({\n  destinationAccount: string,\n  sharedSecret: string\n})\n```\n\n- A page pulls in the polyfill script.\n- When `monetize` is called, the polyfill pulls in the STREAM library.\n- The polyfill creates an iframe for `polyfill.webmonetization.org`.\n- The polyfill's iframe pulls in an iframe to the user's `handlerUri`.\n- The polyfill calls `createIlpConnection` with the ILP address and shared secret to use.\n- The polyfill creates an `IlpPluginIframe` pointing to the polyfill's iframe\n- The polyfill instantiates an IlpStream connection with the address, shared secret, and plugin\n- Ilp packets are passed via `IlpPluginIframe` to the polyfill's iframe, then passed to the user's handler handler iframe so they can be sent over the Interledger network.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterledgerjs%2Fweb-monetization-polyfill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterledgerjs%2Fweb-monetization-polyfill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterledgerjs%2Fweb-monetization-polyfill/lists"}