{"id":21367513,"url":"https://github.com/thejustinwalsh/web-monitization-jam-2020","last_synced_at":"2026-04-16T07:31:44.780Z","repository":{"id":145369398,"uuid":"311826055","full_name":"thejustinwalsh/web-monitization-jam-2020","owner":"thejustinwalsh","description":"Incomplete entry into the Defold Web Monitization Jam of 2020","archived":false,"fork":false,"pushed_at":"2020-11-24T21:51:13.000Z","size":3308,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T08:11:31.353Z","etag":null,"topics":["defold","defold-game","lua","madewithdefold","ts-defold","typescript"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thejustinwalsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-11-11T01:08:16.000Z","updated_at":"2021-10-01T22:38:17.000Z","dependencies_parsed_at":"2023-05-26T17:45:45.164Z","dependency_job_id":null,"html_url":"https://github.com/thejustinwalsh/web-monitization-jam-2020","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thejustinwalsh/web-monitization-jam-2020","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thejustinwalsh%2Fweb-monitization-jam-2020","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thejustinwalsh%2Fweb-monitization-jam-2020/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thejustinwalsh%2Fweb-monitization-jam-2020/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thejustinwalsh%2Fweb-monitization-jam-2020/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thejustinwalsh","download_url":"https://codeload.github.com/thejustinwalsh/web-monitization-jam-2020/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thejustinwalsh%2Fweb-monitization-jam-2020/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31876330,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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":["defold","defold-game","lua","madewithdefold","ts-defold","typescript"],"created_at":"2024-11-22T07:19:30.688Z","updated_at":"2026-04-16T07:31:44.762Z","avatar_url":"https://github.com/thejustinwalsh.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Web Monetization\n\u003ca href=\"https://discord.gg/eukcq5m\"\u003e\u003cimg alt=\"Chat with us!\" src=\"https://img.shields.io/discord/766898804896038942.svg?colorB=7581dc\u0026logo=discord\u0026logoColor=white\"\u003e\u003c/a\u003e\n\n[Web Monetization](https://webmonetization.org/) is a JavaScript browser API which allows the creation of a payment stream from the user agent to the website. Web Monetization is being proposed as a W3C standard at the Web Platform Incubator Community Group.\n\n\n## Web Monetization for Defold\n\nThis repository contains a native extension which integrates the Web Monetization JavaScript API with the [Defold game engine](https://www.defold.com). This allows game developers to detect if a player has an active payment stream or not and offer additional content or perks to paying players.\n\n\n### Installation\n1. Fork this template or use [degit](https://www.npmjs.com/package/degit) to download the template locally\n```bash\nnpx degit ts-defold/tsd-template-web-monetized my-web-monetized-game\n# or\ngit clone https://github.com/ts-defold/tsd-template-web-monetized.git my-web-monetized-game\n```\n\n2. Initialize\n```bash\ncd my-web-monetized-game\nnpm install\n```\n\n3. Generate\n```bash\nnpm run build # Transpile the TypeScript files to lua\n# or\nnpm run dev # Watch for changes and regenerate files on save\n```\n\n4. Code\n```\ncode .\n```\n\n5. Open `app/game.project` in Defold\n- Start making games with TypesScript!\n\n#### Project dependency\n\nTo use Web Monetization in a Defold project this project has to be added as a [Defold library dependency](http://www.defold.com/manuals/libraries/). Open the **game.project** file and in the [Dependencies field in the Project section](https://defold.com/manuals/project-settings/#dependencies) add:\n\nhttps://github.com/defold/extension-webmonetization/archive/master.zip\n\nOr point to the ZIP file of [a specific release](https://github.com/defold/extension-webmonetization/releases).\n\n#### Add payment pointer\n\nThe Web Monetization JavaScript API also requires a payment pointer to create a payment stream. The payment pointer must be added as a `\u003cmeta\u003e` tag in the `\u003chead\u003e` section of the website. The extension will automatically add the `\u003cmeta\u003e` tag when building or bundling a project but the payment pointer must be added to the **game.project** file. Payment pointers are provided by a number of different [companies offering digital wallets](https://webmonetization.org/) (Web Monetization Wallets). Open the **game.project** file using a text editor and add a new section with the payment pointer:\n\n```ini\n[webmonetization]\npayment_pointer = ADD PAYMENT POINTER HERE\n```\n\n### Usage\n\nWhen the extension and a payment pointer has been added to the **game.project** file it is possible to interact with the Web Monetization API from Defold:\n\n```ts\nif (webmonetization != null) {\n    const monetized = webmonetization.is_monetized();\n\n    if (monetized) {\n        print(\"The user has an active payment stream\");\n    }\n\n    webmonetization.set_listener(function(this: unknown, event: webmonetization.Event, details?: webmonetization.EventDetails) {\n        if (event == webmonetization.EVENT_PENDING) {\n            print(\"The user is trying to make a first payment\");\n        } else if (event == webmonetization.EVENT_START) {\n            print(\"The user has started paying\");\n        } else if (event == webmonetization.EVENT_PROGRESS) {\n            print(\"The user is still paying\");\n        } else if (event == webmonetization.EVENT_STOP) {\n            print(\"The user has stopped paying\");\n        }\n        print(details?.requestId);\n    });\n}\n```\n\nThe details table contains additional information about the event. Example:\n\n```js\n{\n  paymentPointer: \"$ilp.uphold.com/QkG86UgXzKq8\",\n  assetScale: 9,\n  amount: \"26009\",\n  requestId: \"a1f728aa-21e0-4376-ae99-0ccb22642956\",\n  assetCode: \"XRP\"\n}\n```\n\n### Awesome\nCheckout [Awesome Web Monetization](https://github.com/thomasbnt/awesome-web-monetization) for more tools, packages, tutorials, etc.  \nInstall [Akita](https://github.com/esse-dev/akita) to explore how Web Monetization works.  \nSign-up for [Coil](https://coil.com/) to start sending micro-payments now!  \n\n\u003cp align=\"center\" class=\"h4\"\u003e\n  TypeScript :heart: Defold\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthejustinwalsh%2Fweb-monitization-jam-2020","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthejustinwalsh%2Fweb-monitization-jam-2020","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthejustinwalsh%2Fweb-monitization-jam-2020/lists"}