diff --git a/astro.config.mjs b/astro.config.mjs index 1b7e8551..c36d0c3f 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -89,78 +89,65 @@ export default defineConfig({ collapsed: true, items: [ { - label: 'Web Monetization API', + label: 'Wallet linking', items: [ { - label: 'HTML rel=monetization', + label: 'Webpage (HTML)', link: '/docs/references/html', }, { - label: 'Monetization events', - collapsed: true, - items: [ - { - label: 'MonetizationEvent', - link: '/docs/references/monetizationevent', - }, - { - label: 'amountSent', - link: '/docs/references/attributes/amountsent', - }, - { - label: 'incomingPayment', - link: '/docs/references/attributes/incomingpayment', - }, - { - label: 'paymentPointer', - link: '/docs/references/attributes/paymentpointer', - }, - { - label: 'amount', - link: '/docs/references/attributes/amount', - badge: { text: 'deprecated', variant: 'danger' }, - }, - { - label: 'assetCode', - link: '/docs/references/attributes/assetcode', - badge: { text: 'deprecated', variant: 'danger' }, - }, - { - label: 'assetScale', - link: '/docs/references/attributes/assetscale', - badge: { text: 'deprecated', variant: 'danger' }, - }, - { - label: 'receipt', - link: '/docs/references/attributes/receipt', - badge: { text: 'deprecated', variant: 'danger' }, - }, - ], + label: 'Feed (RSS, Atom, JSON Feed)', + link: '/docs/references/rss-atom-jsonfeed', }, + { + label: 'Social (Activity Streams)', + link: '/docs/references/activitystreams', + } ], }, { - label: 'HTTP headers', + label: 'Browser events', + collapsed: true, items: [ { - label: 'Content-Security-Policy: monetization-src', - link: '/docs/references/csp-monetization-src', + label: 'GlobalEventHandlers: onmonetization', + link: '/docs/references/onmonetization', }, { - label: 'Permissions-Policy: monetization', - link: '/docs/references/permissions-policy-monetization', + label: 'MonetizationEvent', + link: '/docs/references/monetizationevent', + }, + { + label: 'amountSent', + link: '/docs/references/attributes/amountsent', + }, + { + label: 'incomingPayment', + link: '/docs/references/attributes/incomingpayment', + }, + { + label: 'paymentPointer', + link: '/docs/references/attributes/paymentpointer', }, ], }, { - label: 'Events', + label: 'HTTP headers', items: [ { - label: 'GlobalEventHandlers: onmonetization', - link: '/docs/references/onmonetization', + label: 'Content-Security-Policy: monetization-src', + link: '/docs/references/csp-monetization-src', + }, + { + label: 'Permissions-Policy: monetization', + link: '/docs/references/permissions-policy-monetization', }, ], }, + { + label: 'Deprecations', + link: '/docs/references/deprecations', + } ], }, { diff --git a/src/content/docs/docs/references/activitystreams.mdx b/src/content/docs/docs/references/activitystreams.mdx new file mode 100644 index 00000000..64c499a2 --- /dev/null +++ b/src/content/docs/docs/references/activitystreams.mdx @@ -0,0 +1,111 @@ +--- +title: 'Activity Streams JSON-LD' +--- + +Social web community servers and apps can expose the wallet address of a user’s profile or post to a Web Monetization client, such as the Web Monetization browser extension or embedded SDK. + +Web Monetization links are represented in [Activity Streams 2.0](https://www.w3.org/TR/activitystreams-core/) [Object Types](https://www.w3.org/TR/activitystreams-vocabulary/#dfn-object) using the `monetization` property from the Open Payments namespace (`https://interledger.org/ns/openpayments`). + +### User `Profile` example + +```jsonc +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + "https://w3id.org/security/v1", + + // Add the Open Payments namespace + "https://interledger.org/ns/openpayments", + + { + "Hashtag": "as:Hashtag" + } + ], + "id": "https://alpaca.gold/users/Jeremiah", + "type": "Person", + "following": "https://alpaca.gold/users/Jeremiah/following", + "followers": "https://alpaca.gold/users/Jeremiah/followers", + "inbox": "https://alpaca.gold/users/Jeremiah/inbox", + "outbox": "https://alpaca.gold/users/Jeremiah/outbox", + "preferredUsername": "Jeremiah", + "name": "Jeremiah Lee", + "summary": "

I want you to get paid when you go viral. #WebMonetizationRocks

", + "url": "https://alpaca.gold/@Jeremiah", + "published": "2023-01-06T00:00:00Z", + "publicKey": {}, + "endpoints": { + "sharedInbox": "https://alpaca.gold/inbox" + }, + "tag": [{ + "type": "Hashtag", + "href": "https://alpaca.gold/tags/WebMonetizationRocks", + "name": "#WebMonetizationRocks" + }], + + // Wallet address when viewing this user’s profile + "monetization": "https://fynbos.me/jeremiah" +} +``` + +### User post (`Note`) example + +```jsonc +{ + "@context": [ + "https://www.w3.org/ns/activitystreams", + + // Add the Open Payments namespace + "https://interledger.org/ns/openpayments", + + { + "ostatus": "http://ostatus.org#", + "atomUri": "ostatus:atomUri", + "inReplyToAtomUri": "ostatus:inReplyToAtomUri", + "conversation": "ostatus:conversation", + "sensitive": "as:sensitive", + "Hashtag": "as:Hashtag" + } + ], + "id": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618", + "type": "Note", + "published": "2024-12-19T02:56:24Z", + "url": "https://alpaca.gold/@Jeremiah/113677237228956618", + "attributedTo": "https://alpaca.gold/users/Jeremiah", + "to": ["https://www.w3.org/ns/activitystreams#Public"], + "cc": ["https://alpaca.gold/users/Jeremiah/followers"], + "sensitive": false, + "atomUri": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618", + "inReplyToAtomUri": null, + "conversation": "tag:alpaca.gold,2024-12-19:objectId=3727991:objectType=Conversation", + "content": "

When you go viral, you should get paid. #WebMonetizationRocks

", + "attachment": [], + "tag": [{ + "type": "Hashtag", + "href": "https://alpaca.gold/tags/webmonetizationrocks", + "name": "#webmonetizationrocks" + }], + "replies": { + "id": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/replies", + "type": "Collection", + "first": { + "type": "CollectionPage", + "next": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/replies?only_other_accounts=true&page=true", + "partOf": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/replies", + "items": [] + } + }, + "likes": { + "id": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/likes", + "type": "Collection", + "totalItems": 42 + }, + "shares": { + "id": "https://alpaca.gold/users/Jeremiah/statuses/113677237228956618/shares", + "type": "Collection", + "totalItems": 9 + }, + + // Wallet address when viewing this Note + "monetization": "https://fynbos.me/jeremiah" +} +``` diff --git a/src/content/docs/docs/references/deprecations.mdx b/src/content/docs/docs/references/deprecations.mdx new file mode 100644 index 00000000..f620e667 --- /dev/null +++ b/src/content/docs/docs/references/deprecations.mdx @@ -0,0 +1,25 @@ +--- +title: 'Deprecations' +--- + +import { LinkOut } from '@interledger/docs-design-system' + +## 2024-01-01 + +### `` element removed + +Earlier versions of the Web Monetization specification supported both the `` and `` elements. Now, only the `` element is supported. + +### Interledger Protocol payment pointers replaced with Open Payments wallet addresses + +Web Monetization now uses the [Open Payments API specification](https://openpayments.dev/) instead of the [STREAM Interledger Transport protocol](https://interledger.org/developers/rfcs/stream-protocol/). A monetization link now must be the URL of an Open Payments wallet address. Open Payments wallet addresses do not support payment pointer shorthand (e.g. `$wallet.example/alice`) and must be fully expressed URLs (e.g. `https://wallet.example/alice`). + +If your Web Monetization provider has not provided you a wallet address, try converting your payment pointer from a shorthand form to URL on paymentpointers.org. + +### `MonetizationEvent` attributes `amount`, `assetCode`, `assetScale`, `receipt` removed + +Web Monetization now uses the [Open Payments API specification](https://openpayments.dev/) instead of the [STREAM Interledger Transport protocol](https://interledger.org/developers/rfcs/stream-protocol/). + +`MonetizationEvent` now represents the amount sent instead of the amount received. The new `incomingPayment` attribute may be used to determine the amount received. Therefore, `amount`, `assetCode`, `assetScale` are no longer attributes on the event. Consider using [`amountSent`](/docs/references/attributes/amountsent) instead. + +STREAM receipts are no longer relevant to the `MonetizationEvent` and have been removed. diff --git a/src/content/docs/docs/references/html.mdx b/src/content/docs/docs/references/html.mdx index 00a14fe3..e63957ce 100644 --- a/src/content/docs/docs/references/html.mdx +++ b/src/content/docs/docs/references/html.mdx @@ -7,28 +7,22 @@ import BrowserCompat from '/src/components/docs/BrowserCompat.astro' import data from '/src/data/browser-compat-data/link.json' import { LinkOut } from '@interledger/docs-design-system' -The `` element enables you to [add Web Monetization to an HTML document](/docs/guides/monetize-page). The `rel` value must be `monetization`. The `href` value must be a URL representing an Open Payments-enabled wallet address, such as a payment pointer. +Web Monetization wallet addresses are represented in HTML documents using the `` element with the `rel="monetization"` attribute. The `rel` value must be `monetization`. The `href` value must be a URL of an Open Payments-enabled wallet address. ```html ``` -A single HTML document can contain multiple monetization `` elements; however, it's up to each WM provider to decide how they want to handle this scenario. We recommend WM providers split the payments evenly between the links. - -## Payment pointers and meta elements - -The first version of the Web Monetization spec supported both the `` and `` elements. The `` element supported payment pointers written in shorthand form (e.g., `$wallet.example/alice`). - -Now, Web Monetization only supports the `` element. The `` element does not support shorthand and requires payment pointers be in URL format (e.g., `https://wallet.example/alice`). In most cases, you can simply replace the `$` with `https://`. However, we suggest entering your payment pointer into the input field on paymentpointers.org to convert it from shorthand to URL. - -:::note -The Web Monetization specification references payment pointers, but any Open Payments-enabled wallet address in URL form can be used as the 'href' value. -::: +An HTML document may contain multiple monetization `` elements. Web Monetization providers decide how handle this scenario. We recommend Web Monetization providers split the payments evenly between the links. ## Specifications +## Related + +- [Guide: Add Web Monetization to a webpage](/docs/guides/monetize-page) + {/* ## Browser compatibility */} {/* */} diff --git a/src/content/docs/docs/references/rss-atom-jsonfeed.mdx b/src/content/docs/docs/references/rss-atom-jsonfeed.mdx new file mode 100644 index 00000000..57d1af86 --- /dev/null +++ b/src/content/docs/docs/references/rss-atom-jsonfeed.mdx @@ -0,0 +1,188 @@ +--- +title: 'RSS, Atom, and JSON Feed' +--- + +Web Monetization links can be used with content syndication formats [RSS 2.0](#rss-20), [Atom XML](#atom), and [JSON Feed](#json-feed). Feed readers and podcasting apps can expose a piece of content’s wallet address to a Web Monetization client, such as the Web Monetization browser extension or embedded SDK. + + +## RSS 2.0 + +Web Monetization wallet addresses are represented in RSS 2.0 using the `` element. The `rel` attribute value must be `monetization`. The `href` attribute must be a URL of an Open Payments-enabled wallet address. + +RSS must be extended with the Atom Syndication Format by adding the Atom namespace to the `rss` element: `` + +Monetization `` elements may be children of `` and `` elements. + +Monetization `` elements added as children of the `` element apply to the channel itself and its items. + +An `` element inherits the channel’s monetization links unless the `` element has monetization `` child elements of its own. + +### Podcast example + +```xml + + + + + Fintech News Podcast + 0000a0a0-0000-0000-0000-0a000aa0a0a0 + https://podcast.example/fintech-news + podcast + episodic + Technology + + Fintech News + + + + + + Support the show! + + + + Big Fun Conference announcements + + https://example.com/bfc-2024/ + Thu, 05 Dec 2024 15:56:55 GMT + Episode description… + 123 + https://example.com/bfc-2024/ + + 1 + 1 + full + 1 + 1 + + + + + Canada is calling + + https://example.com/2024-canada/ + Thu, 05 Dec 2024 16:06:17 GMT + Episode description… + 321 + https://example.com/2024-canada/ + + 2 + 1 + full + 1 + 2 + + + + + + +``` + + +## Atom + +Web Monetization wallet addresses are represented in [Atom Syndication Format](https://www.rfc-editor.org/rfc/rfc4287) using the `` element with the `rel="monetization"` attribute. The `rel` value must be `monetization`. The `href` value must be a URL of an Open Payments-enabled wallet address. + +Monetization `` elements may be added as children of `` and `` elements. + +Monetization `` elements added as children of the `` element apply to the feed itself and its entries. + +An `` element inherits the feeds’s monetization links unless the `` element has monetization `` child elements of its own. + +### Example + +```xml + + + Fintech News + + + https://example.com/atom.xml + 2024-12-18T19:54:03Z + + + + + + + Big Fun Conference announcements + + 2024-12-05T16:56:55+01:00 + https://example.com/bfc-2024/ + Article content here… + + + + + Canada is calling + + + + 2024-12-05T17:06:17+01:00 + https://example.com/2024-canada/ + Article content here… + + +``` + + +## JSON Feed + +Web Monetization wallet addresses are represented in [JSON Feed 1.1](https://www.jsonfeed.org/version/1.1/) using the `_monetization` [extension object](https://www.jsonfeed.org/version/1.1/#extensions). + +Per the JSON Feed 1.1 specification, extensions must have a property name that begins with an underscore and be assigned an object. + +### `_monetization` extension object + +- `about` (optional, string) is a link to this page explaining the extension object’s purpose. It should appear in the first use of the extension object only. +- `links` (required, array of strings) specifies one or more Open Payments-enabled wallet addresses. + +The `_monetization` extension may be added to the top-level document and to individual items in the `items` array. + +An item in the `items` array inherits the top-level `_monetization` values unless the item contains a `_monetization` extension object of its own. + +### Example + +```jsonc +{ + "version": "https://jsonfeed.org/version/1.1", + "title": "Fintech News", + "home_page_url": "https://example.com/", + "feed_url": "https://example.com/jsonfeed.json", + + // Web Monetization wallet address for feed and items + "_monetization": { + "about": "https://webmonetization.org/docs/references/rss-atom-jsonfeed/", + "links": ["https://wallet.example/fintech-news"] + }, + + "items": [ + { + // This item will inherit the feed’s _monetization + "title": "Big Fun Conference announcements", + "date_published": "2024-12-05T16:56:55+01:00", + "id": "https://example.com/bfc-2024/", + "url": "https://example.com/bfc-2024/", + "content_html": "Article content here…" + }, + { + // This item specifies its own monetization links + "title": "Canada is calling", + "date_published": "2024-12-05T17:06:17+01:00", + "id": "https://example.com/2024-canada/", + "url": "https://example.com/2024-canada/", + "_monetization": { + "links": [ + "https://wallet.example/fintech-news", + "https://wallet.example/erica" + ], + }, + "content_html": "Article content here…" + } + ] + } +```