diff --git a/astro.config.mjs b/astro.config.mjs index 70e5a325..b16107f7 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -44,14 +44,6 @@ export default defineConfig({ label: 'English', lang: 'en', }, - es: { - label: 'Español', - lang: 'es', - }, - fr: { - label: 'Français', - lang: 'fr', - }, }, components: { Header: './src/components/docs/Header.astro', @@ -64,130 +56,136 @@ export default defineConfig({ sidebar: [ { label: 'Intro to Web Monetization', + link: '/docs/', + }, + { + label: 'Support web monetized content', collapsed: true, items: [ { label: 'Overview', - link: '/docs/', + link: '/support/overview', }, { - label: 'Sending payments', - link: '/docs/intro/sending-payments', + label: 'Quick start guide', + link: '/support/quick-start', }, { - label: 'Receiving payments', - link: '/docs/intro/receiving-payments', + label: 'Use the extension', + link: '/support/use-extension', }, { - label: 'Web Monetization flow', - link: '/docs/intro/web-monetization-flow', + label: 'How payments work', + link: '/support/how-payments-work', }, ], }, { - label: 'References', + label: 'Experiment with Web Monetization', collapsed: true, items: [ { - label: 'Web Monetization API', + label: 'Overview', + link: '/experiment/overview', + }, + { + label: 'Quick start guide', + link: '/experiment/quick-start', + }, + { + label: 'How payments work', + link: '/experiment/how-payments-work', + }, + { + label: 'Developer corner', + collapsed: true, items: [ { - label: 'HTML rel=monetization', - link: '/docs/references/html-link-rel-monetization', - }, - { - label: 'Monetization events', + label: 'Guides', collapsed: true, items: [ { - label: 'MonetizationEvent', - link: '/docs/references/monetizationevent', - }, - { - label: 'amountSent', - link: '/docs/references/attributes/amountsent', + label: 'Show content to paying visitors', + link: '/experiment/guides/show-content', }, { - label: 'incomingPayment', - link: '/docs/references/attributes/incomingpayment', + label: 'Remove content for paying visitors', + link: '/experiment/guides/remove-content', }, { - label: 'paymentPointer', - link: '/docs/references/attributes/paymentpointer', + label: 'Show visitors how much they\'ve contributed', + link: '/experiment/guides/contribution-counter', }, { - label: 'amount', - link: '/docs/references/attributes/amount', - badge: { text: 'deprecated', variant: 'danger' }, + label: 'Set up probabilistic revenue sharing', + link: '/experiment/guides/revenue-sharing', }, { - label: 'assetCode', - link: '/docs/references/attributes/assetcode', - badge: { text: 'deprecated', variant: 'danger' }, + label: 'Test Web Monetization', + link: '/experiment/guides/test-web-monetization', }, + ], + }, + { + label: 'APIs', + collapsed: true, + items: [ { - label: 'assetScale', - link: '/docs/references/attributes/assetscale', - badge: { text: 'deprecated', variant: 'danger' }, + label: 'HTML DOM API', + collapsed: false, + items: [ + { + label: 'Monetization element', + link: '/experiment/link-element', + }, + ], }, { - label: 'receipt', - link: '/docs/references/attributes/receipt', - badge: { text: 'deprecated', variant: 'danger' }, + label: 'Web Monetization API', + collapsed: false, + items: [ + { + label: 'Monetization interfaces', + link: '/experiment/wmapi-interfaces', + }, + { + label: 'Monetization events', + link: '/experiment/events', + }, + ], }, ], }, - ], - }, - { - label: 'HTTP headers', - items: [ { - label: 'Content-Security-Policy: monetization-src', - link: '/docs/references/csp-monetization-src', + label: 'HTTP Headers', + collapsed: true, + items: [ + { + label: 'Content Security Policy (CSP)', + link: '/experiment/csp', + }, + { + label: 'Permissions Policy', + link: '/experiment/permissions-policy', + }, + ], }, { - label: 'Permissions-Policy: monetization', - link: '/docs/references/permissions-policy-monetization', + label: 'Libraries', + link: '/experiment/libraries', }, - ], - }, - { - label: 'Events', - items: [ { - label: 'GlobalEventHandlers: onmonetization', - link: '/docs/references/onmonetization', + label: 'Web Monetization Specification', + link: 'https://webmonetization.org/specification/', + attrs: { target: '_blank' }, }, ], }, ], }, { - label: 'Guides', - collapsed: true, - items: [ - { - label: 'Add Web Monetization to a page', - link: '/docs/guides/monetize-page', - }, - { - label: 'Remove ads', - link: '/docs/guides/remove-ads', - }, - { - label: 'Provide exclusive content', - link: '/docs/guides/provide-exclusive-content', - }, - { - label: 'Set up probabilistic revenue sharing', - link: '/docs/guides/set-up-probabilistic-revenue-sharing', - }, - { - label: 'Add a streaming payments counter', - link: '/docs/guides/add-a-streaming-payments-counter', - }, - ], + label: 'Compatible digital wallets', + link: '/resources/wallets', }, { label: 'Resources', @@ -195,49 +193,14 @@ export default defineConfig({ items: [ { label: 'Glossary', - link: '/docs/resources/glossary', - }, - { - label: 'Libraries', - link: '/docs/resources/libraries', - }, - { - label: 'Web Monetization-enabled wallets', - link: '/docs/resources/op-wallets', + link: '/resources/glossary', }, { label: 'Get involved', - link: '/docs/resources/get-involved', - }, - { - label: 'Interledger', - link: 'https://interledger.org/', - attrs: { - target: '_blank', - rel: 'noopener noreferrer', - 'data-icon': 'external', - }, - }, - { - label: 'Open Payments API', - link: 'https://openpayments.guide/', - attrs: { - target: '_blank', - rel: 'noopener noreferrer', - 'data-icon': 'external', - }, + link: '/resources/get-involved', }, ], }, - { - label: 'Specification', - link: 'https://webmonetization.org/specification/', - attrs: { - target: '_blank', - rel: 'noopener noreferrer', - 'data-icon': 'external', - }, - }, ], }), react(), diff --git a/public/img/docs/diagram-wm-flow.svg b/public/img/docs/diagram-wm-flow.svg deleted file mode 100644 index 64ad5a01..00000000 --- a/public/img/docs/diagram-wm-flow.svg +++ /dev/null @@ -1 +0,0 @@ -WM receiverWM providerAuth serverOpen Paymentsreceiving accountWeb pageWM agentOpen Paymentssending accountAuth serverOpen Paymentsreceiving accountWeb pageWM agentOpen Paymentssending accountThe auth server can belocated outside of the WM receiver's domainConnection persists untilrequest moves from 'pending'state to 'sending' statePayment processing and settlement occurs between the WM provider and WM receiver, outside of the WM flowDetects monetization <link> element,extracts payment pointer1Requests the payment pointer's public info2Returns info, including auth server URL3Requests access rights4Returns access token5Requests creation of an incoming payment resource6Responds with unique payment details for addressing the payment to the account7Requests an outgoing payment becreated against the sending account8Responds with details about the'receive', 'send', and 'sent' amounts9Fires monetization event10 \ No newline at end of file diff --git a/public/img/docs/diagram-wm-overview.png b/public/img/docs/diagram-wm-overview.png deleted file mode 100644 index c2190c03..00000000 Binary files a/public/img/docs/diagram-wm-overview.png and /dev/null differ diff --git a/public/img/docs/extension/budget-tab-full-budget.png b/public/img/docs/extension/budget-tab-full-budget.png new file mode 100644 index 00000000..a7dac3ac Binary files /dev/null and b/public/img/docs/extension/budget-tab-full-budget.png differ diff --git a/public/img/docs/extension/connection-failed.png b/public/img/docs/extension/connection-failed.png new file mode 100644 index 00000000..a3a271a3 Binary files /dev/null and b/public/img/docs/extension/connection-failed.png differ diff --git a/public/img/docs/extension/connection-setup-filled.png b/public/img/docs/extension/connection-setup-filled.png new file mode 100644 index 00000000..025ace77 Binary files /dev/null and b/public/img/docs/extension/connection-setup-filled.png differ diff --git a/public/img/docs/extension/connection-setup.png b/public/img/docs/extension/connection-setup.png new file mode 100644 index 00000000..3efd700c Binary files /dev/null and b/public/img/docs/extension/connection-setup.png differ diff --git a/public/img/docs/extension/connection-success.png b/public/img/docs/extension/connection-success.png new file mode 100644 index 00000000..339c0ad6 Binary files /dev/null and b/public/img/docs/extension/connection-success.png differ diff --git a/public/img/docs/extension/connection-wallet.png b/public/img/docs/extension/connection-wallet.png new file mode 100644 index 00000000..7285ef83 Binary files /dev/null and b/public/img/docs/extension/connection-wallet.png differ diff --git a/public/img/docs/extension/default-gray.png b/public/img/docs/extension/default-gray.png new file mode 100644 index 00000000..5c26598a Binary files /dev/null and b/public/img/docs/extension/default-gray.png differ diff --git a/public/img/docs/extension/disabled-warn.png b/public/img/docs/extension/disabled-attention.png similarity index 100% rename from public/img/docs/extension/disabled-warn.png rename to public/img/docs/extension/disabled-attention.png diff --git a/public/img/docs/extension/disabled-has-links.png b/public/img/docs/extension/disabled-monetized.png similarity index 100% rename from public/img/docs/extension/disabled-has-links.png rename to public/img/docs/extension/disabled-monetized.png diff --git a/public/img/docs/extension/disabled-no-links.png b/public/img/docs/extension/disabled-unmonetized.png similarity index 100% rename from public/img/docs/extension/disabled-no-links.png rename to public/img/docs/extension/disabled-unmonetized.png diff --git a/public/img/docs/extension/enabled-warn.png b/public/img/docs/extension/enabled-attention.png similarity index 100% rename from public/img/docs/extension/enabled-warn.png rename to public/img/docs/extension/enabled-attention.png diff --git a/public/img/docs/extension/enabled-has-links.png b/public/img/docs/extension/enabled-monetized.png similarity index 100% rename from public/img/docs/extension/enabled-has-links.png rename to public/img/docs/extension/enabled-monetized.png diff --git a/public/img/docs/extension/enabled-no-links.png b/public/img/docs/extension/enabled-unmonetized.png similarity index 100% rename from public/img/docs/extension/enabled-no-links.png rename to public/img/docs/extension/enabled-unmonetized.png diff --git a/public/img/docs/extension/example-grant.png b/public/img/docs/extension/example-grant.png new file mode 100644 index 00000000..838c6617 Binary files /dev/null and b/public/img/docs/extension/example-grant.png differ diff --git a/public/img/docs/extension/extension-configure.png b/public/img/docs/extension/extension-configure.png deleted file mode 100644 index e88ef322..00000000 Binary files a/public/img/docs/extension/extension-configure.png and /dev/null differ diff --git a/public/img/docs/extension/extension-connection-success.png b/public/img/docs/extension/extension-connection-success.png deleted file mode 100644 index 902729f7..00000000 Binary files a/public/img/docs/extension/extension-connection-success.png and /dev/null differ diff --git a/public/img/docs/extension/extension-disconnect.png b/public/img/docs/extension/extension-disconnect.png deleted file mode 100644 index 3b639b62..00000000 Binary files a/public/img/docs/extension/extension-disconnect.png and /dev/null differ diff --git a/public/img/docs/extension/extension-grant.png b/public/img/docs/extension/extension-grant.png deleted file mode 100644 index 7b7eddfa..00000000 Binary files a/public/img/docs/extension/extension-grant.png and /dev/null differ diff --git a/public/img/docs/extension/extension-pay.png b/public/img/docs/extension/extension-pay.png deleted file mode 100644 index 62b357ec..00000000 Binary files a/public/img/docs/extension/extension-pay.png and /dev/null differ diff --git a/public/img/docs/extension/otp-send-now.png b/public/img/docs/extension/otp-send-now.png new file mode 100644 index 00000000..2b710cb8 Binary files /dev/null and b/public/img/docs/extension/otp-send-now.png differ diff --git a/public/img/docs/extension/otp-success.png b/public/img/docs/extension/otp-success.png new file mode 100644 index 00000000..b0f1bbf3 Binary files /dev/null and b/public/img/docs/extension/otp-success.png differ diff --git a/public/img/docs/extension/rate-tab.png b/public/img/docs/extension/rate-tab.png new file mode 100644 index 00000000..fd0a6687 Binary files /dev/null and b/public/img/docs/extension/rate-tab.png differ diff --git a/public/img/docs/extension/settings-icon.png b/public/img/docs/extension/settings-icon.png new file mode 100644 index 00000000..2abaa3f7 Binary files /dev/null and b/public/img/docs/extension/settings-icon.png differ diff --git a/public/img/docs/extension/wallet-tab.png b/public/img/docs/extension/wallet-tab.png new file mode 100644 index 00000000..0767104e Binary files /dev/null and b/public/img/docs/extension/wallet-tab.png differ diff --git a/public/img/docs/fynbos/fb-pp.png b/public/img/docs/fynbos/fb-pp.png deleted file mode 100644 index b6b3b2f0..00000000 Binary files a/public/img/docs/fynbos/fb-pp.png and /dev/null differ diff --git a/public/img/docs/gatehub/gh-add-funds.png b/public/img/docs/gatehub/gh-add-funds.png deleted file mode 100644 index a77e7a8f..00000000 Binary files a/public/img/docs/gatehub/gh-add-funds.png and /dev/null differ diff --git a/public/img/docs/gatehub/gh-pp.png b/public/img/docs/gatehub/gh-pp.png deleted file mode 100644 index f3e49501..00000000 Binary files a/public/img/docs/gatehub/gh-pp.png and /dev/null differ diff --git a/src/components/docs/PageSidebar.astro b/src/components/docs/PageSidebar.astro index fffa9df9..9aa89d60 100644 --- a/src/components/docs/PageSidebar.astro +++ b/src/components/docs/PageSidebar.astro @@ -3,7 +3,11 @@ import type { Props } from '@astrojs/starlight/props'; import Default from '@astrojs/starlight/components/PageSidebar.astro'; const removeOverview = [ - 'docs/resources/glossary', + 'resources/glossary', + 'resources/get-involved', + 'experiment/quick-start', + 'experiment/how-payments-work', + 'support/how-payments-work', ] const noOverview = removeOverview.includes(Astro.props.slug); const toc = noOverview && Astro.props.toc !== undefined diff --git a/src/components/pages/ProbRevshare/components/_active-view.jsx b/src/components/pages/ProbRevshare/components/_active-view.jsx index 59a7297a..044bc6f3 100644 --- a/src/components/pages/ProbRevshare/components/_active-view.jsx +++ b/src/components/pages/ProbRevshare/components/_active-view.jsx @@ -32,11 +32,7 @@ export function ActiveView() {

If you make any changes to the table, your monetization{' '} link will change. Be sure to replace your old{' '} - link element with the updated version. Check out{' '} - - Add Web Monetization to a page - {' '} - if you need help. + link element with the updated version.

diff --git a/src/components/pages/ProbRevshare/components/_link-tag.jsx b/src/components/pages/ProbRevshare/components/_link-tag.jsx index da547296..de919d56 100644 --- a/src/components/pages/ProbRevshare/components/_link-tag.jsx +++ b/src/components/pages/ProbRevshare/components/_link-tag.jsx @@ -16,7 +16,7 @@ export function SharesLinkTag() { } if (!pointer) { - return

Enter shares with valid payment pointers and weights.

+ return

Enter shares with valid wallet addresses and/or payment pointers and weights.

} return ( diff --git a/src/components/pages/ProbRevshare/components/_share-input-container.jsx b/src/components/pages/ProbRevshare/components/_share-input-container.jsx index 9bfc5b5d..ff3674f2 100644 --- a/src/components/pages/ProbRevshare/components/_share-input-container.jsx +++ b/src/components/pages/ProbRevshare/components/_share-input-container.jsx @@ -7,7 +7,7 @@ export function ShareInputContainer({ children }) { Name - Pointer + Wallet Address/Payment Pointer Weight Percent diff --git a/src/components/pages/ProbRevshare/lib/_index.js b/src/components/pages/ProbRevshare/lib/_index.js index 719eb150..26cf7c0b 100644 --- a/src/components/pages/ProbRevshare/lib/_index.js +++ b/src/components/pages/ProbRevshare/lib/_index.js @@ -77,7 +77,7 @@ export function pointerToShares(pointer) { if (!encodedList) { throw new Error( - 'No share data found. Make sure you copy the whole "content" field from your meta tag.', + 'No share data found. Make sure you copy the whole "content" field from your link tag.', ) } @@ -85,16 +85,16 @@ export function pointerToShares(pointer) { if (!validatePointerList(pointerList)) { throw new Error( - 'Share data is invalid. Make sure you copy the whole "content" from your meta tag.', + 'Share data is invalid. Make sure you copy the whole "content" from your link tag.', ) } return sharesFromPointerList(pointerList) } catch (err) { if (err.name === 'TypeError') { - throw new Error('Meta tag or payment pointer is malformed') + throw new Error('Link tag, wallet address, or payment pointer is malformed') } else if (err.name === 'SyntaxError') { throw new Error( - 'Payment pointer has malformed share data. Make sure to copy the entire pointer.', + 'Wallet address or payment pointer has malformed share data. Make sure to copy the entire address.', ) } else { throw err diff --git a/src/content/docs/docs.mdx b/src/content/docs/docs.mdx index fb2a83f3..db0f691f 100644 --- a/src/content/docs/docs.mdx +++ b/src/content/docs/docs.mdx @@ -2,67 +2,51 @@ title: Intro to Web Monetization --- -import { LargeImg, LinkOut, Tooltip } from '@interledger/docs-design-system' +import { LinkCard, CardGrid } from '@astrojs/starlight/components'; -As a website user, it’s common to encounter a headline that captures your attention, only to find the article locked behind a paywall. How often do you pay for a subscription to read a single article? What if you could pay a fraction of the subscription price to access the article and avoid the subscription altogether? +

Need help with this page

-As a website owner, you anticipate losing a few visitors due to paywalled content. Even if you offer weekly subscriptions, the price may be more than a visitor is willing to pay. But instead of subscriptions, what if you could generate revenue per piece of content, or even based on the amount of time a visitor spends on the content? +People already think they know what WM is when they see the words. Ads, affiliate marketing, etc. -These are just two ways in which Web Monetization can make payments easier. With Web Monetization, website visitors can send payments directly to websites using a browser extension or any browser that natively implements the Web Monetization specification. +Need an overview to WM that's appropriate for users and developers. -## Current payments infrastructure +## Support web monetized content -It can take a bit of work to implement payments on a website. If your site already accepts payments, you may be familiar with what it takes to accept multiple payment methods and currencies. The process typically looks something like this: +

Just playing around with Starlight components here

-1. You sign up with one or more payment providers, depending on the payment methods and currencies you want to accept. -2. You integrate their service(s) into your site. For example, you may create and host your own payment form that is connected to the service, or you use a form supplied by the payment provider. -3. Depending on the payment method your visitor wants to use, they may need to create an account with you or the payment provider. -4. Your visitor fills out the payment form. Ideally, they remain on your site to complete the transaction but may be required to access the provider’s site instead. + -## Introducing Web Monetization - -Web Monetization (WM) aims to simplify the payment experience for you and your website visitors. It’s an open technology that allows websites to automatically receive payments from visitors, facilitated by the visitor’s browser and their preferred WM provider. - -It’s a proposed standard that allows your visitors to pay an amount of their choosing with little to no user interaction. It enables a website to automatically signal to web browsers that it can accept payments and enables web browsers to facilitate a payment by: - -- Obtaining authorization to initiate the payment. -- Gathering details and issuing instructions to start the money movement process. -- Creating a payment session. -- Communicating payment events to the site so the site can optionally respond. For example, the site could [remove ads](/docs/guides/remove-ads) or provide [access to exclusive content](/docs/guides/provide-exclusive-content) for paying visitors. - -### High-level flow - -The following image shows the Web Monetization flow at a high level. Some steps have been combined or excluded. A more in-depth explanation is provided in the [Web Monetization flow](/docs/intro/web-monetization-flow) page. - - -1. Bob visits a [web monetized page](/docs/guides/monetize-page). The monetization `` element is how the website signals its acceptance of payments to the browser. -2. Bob’s browser, either natively or via a browser extension, parses the `` element to get the wallet address for Alice, the site owner. -3. Bob’s browser/extension sends requests to Alice’s wallet address to obtain authorization and instructions for sending a payment. -4. With authorization granted and payment instructions received, the browser/extension sends requests to Bob’s wallet address to initiate the outgoing payment. -5. The Web Monetization flow ends. Payment processing, currency exchange, and settlement occurs between the two accounts via a common payment rail. - -### Specifying payment amounts and currencies - -Web Monetization doesn’t allow a website to specify a payment amount or currency. It only allows the site to tell the browser it can accept payments. - -With the help of a WM provider, your visitor decides whether to make a payment, how much and how often to pay, and in which currency. Your WM receiver can then exchange the currency of incoming payments based on what you want to receive. This flexibility allows you and your visitors to choose the monetization methods that best suit your needs. - -### Processing and settling payments - -Web Monetization’s role is to help coordinate payments. It does not process or settle payments. + -At each end of Web Monetization is an account that supports Open Payments. The WM provider supplies your visitor with a funded sending account. In some cases, the visitor could even act as their own WM provider. The WM receiver supplies you with a receiving account. + -Web Monetization communicates with the sending and receiving accounts to obtain the necessary authorizations and instructions for a payment to be sent and received. Payment processing and settlement then occurs between the sending and receiving accounts, outside of the Web Monetization flow. + -## Prior specification version +## Web monetize your content -A new version of the Web Monetization specification was published in June 2023. Users of the previous version should be aware of the following: + + + -- The previous version only used Interledger's Simple Payment Setup Protocol (SPSP). The new version uses Open Payments. -- The `` element is deprecated in favor of the [``](/docs/references/html-link-rel-monetization/) element. -- The `` element does not support the shorthand form of a payment pointer (e.g., `$wallet.example/alice`). You must use the endpoint URL that the payment pointer resolves to (e.g., `https://wallet.example/alice`). If you need help converting a payment pointer from shorthand to its equivalent URL, enter your payment pointer into the input field on paymentpointers.org. In most cases, you can simply replace the `$` with `https://`. + + \ No newline at end of file diff --git a/src/content/docs/docs/guides/add-a-streaming-payments-counter.mdx b/src/content/docs/docs/guides/add-a-streaming-payments-counter.mdx deleted file mode 100644 index a25b4c61..00000000 --- a/src/content/docs/docs/guides/add-a-streaming-payments-counter.mdx +++ /dev/null @@ -1,102 +0,0 @@ ---- -title: Add a streaming payments counter ---- - -import NoPay from '/src/partials/glitchNoPay.mdx' -import ViewAs from '/src/partials/glitchViewAs.mdx' - -Web Monetization allows you to know exactly how much a web monetized visitor has sent to you. In cases where a web monetized visitor has chosen to pay you in time-based increments (such as per second or per minute), a streaming payments counter can be a helpful tool to show your visitor how much they've sent. The amount updates in real time as more payments come in during the session. - -## Example - -The example below illustrates how to use the `monetization` event to show a web monetized visitor how much they've sent you during their current browsing session. - -```html - - - - - - - - -

- Thanks to you, I've made - 0.00 USD - -

- -``` - -## How it works - -First, we'll bind the `monetization` event if the visitor is web monetized (`window.MonetizationEvent` is defined). - -The `monetization` event contains details about the payments that occur. The `amountSent` attribute of the event returns the amount (`value`) and currency code of the sent payment. A currency code is a three-letter code, like USD, EUR, or GBP. - -```js - if (window.MonetizationEvent) { - const link = document.querySelector('link[rel="monetization"]'); - - link.addEventListener("monetization", (event) => { - const { - amountSent: { value, currency }, - } = event; - console.log(`Browser sent ${currency} ${value}.`); -``` - -The `currency` is set on the first payment and doesn't change. Remember, it represents the sent payment's currency, which may be different from the currency you receive (depending on how your receiving account is set up with your WM receiver). - -```js -// initialize currency on first progress event -if (total === 0) { - document.getElementById('currency').innerText = currency -} -``` - -The amount in `value` is an integer, which we add to our total. - -```js -total += Number(value) -``` - -Finally, we update the text on the page with the new total. We want the total to be in a readable format, so we convert the number to a string and round it to a specified number of decimals, which is `9` in this example. This formatted version of the amount gets written to the `total` span on the page. - -```js -document.getElementById('total').innerText = total.toFixed(9) -``` - -## Interactive example - -This example simulates showing a visitor how much they are sending you based off how long they remain on your web monetized page. - - - - - - diff --git a/src/content/docs/docs/guides/monetize-page.mdx b/src/content/docs/docs/guides/monetize-page.mdx deleted file mode 100644 index bd79b5c5..00000000 --- a/src/content/docs/docs/guides/monetize-page.mdx +++ /dev/null @@ -1,37 +0,0 @@ ---- -title: Add Web Monetization to a page ---- - -import { LinkOut } from '@interledger/docs-design-system' - -This page provides basic instructions for adding Web Monetization to a web page. If you're new to web monetizing content, this guide is a great place to start. - -## Prerequisites - -- Web monetized pages must be secure and served over HTTPS. -- You must have the wallet address assigned to you by your WM receiver. - -## Monetize a page - -To add Web Monetization to a page, add the monetization `` element to the page's ``. - -The element’s `rel` value is always `monetization`. The `href` value is your wallet address. If your wallet address is a payment pointer, it must be entered in URL format. - -For example: - -```html - - - My Site - - - -``` - -### Multiple monetization links - -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. - -## Next steps - -Now that you've web monetized your page, you can choose to [remove ads](/docs/guides/remove-ads), [provide exclusive content](/docs/guides/provide-exclusive-content), or respond to [`monetization` events](/docs/references/monetizationevent) in some other way when a web monetized visitor accesses your page. diff --git a/src/content/docs/docs/guides/provide-exclusive-content.mdx b/src/content/docs/docs/guides/provide-exclusive-content.mdx deleted file mode 100644 index 8bb0beb8..00000000 --- a/src/content/docs/docs/guides/provide-exclusive-content.mdx +++ /dev/null @@ -1,191 +0,0 @@ ---- -title: Provide exclusive content ---- - -import NoPay from '/src/partials/glitchNoPay.mdx' -import ViewAs from '/src/partials/glitchViewAs.mdx' - -Give your paying visitors access to exclusive content when the `monetization` event fires. Since the `monetization` event only fires when an outgoing payment request is successfully created, your exclusive content only appears to web monetized visitors. - -## Example 1 - Simple - -The example below illustrates a simple way to show exclusive content to web monetized visitors. - -```html - - - - - - - - - - -

Content will appear below here if you are Web monetized.

-
- - -``` - -### How it works - -First, we want to check whether Web Monetization is supported. We do this by calling `supports()` on a link element's `relList` and passing `"monetization"` as a parameter. If this check doesn't exist, we can't listen for the `monetization` event to tell us when Web Monetization initializes. - -```jsx -const link = document.querySelector('link[rel="monetization"]') -if (link.relList.supports('monetization')) { -``` - -Next, we add an event listener to the `link` element. The `monetization` event is emitted when Web Monetization initializes. - -```jsx -link.addEventListener('monetization', (ev) => { -``` - -Finally, we select the exclusive content element we want to make available to web monetized visitors. Since we defined a CSS class to hide the content, removing the class will make the content appear. - -```js -document.getElementById('exclusive').classList.remove('hidden') -``` - -### Interactive example - -This example simulates hiding and showing exclusive content based on a visitor's Web Monetization state. - - - - - - - -## Example 2 - Complex - -In reality, you'll probably want your site to do more than simply show and hide content. In this example, we illustrate how to: - -- Show web monetized visitors an indicator while they wait for Web Monetization to initialize -- Tell non-web monetized visitors that there's exclusive content they're missing out on - -The example below covers three states for showing: - -- A call-to-action to non-web monetized visitors -- A loading message to web monetized visitors -- Exclusive content to web monetized visitors - -```html - - - - - - - - - - - - - - -``` - -### How it works - -There are three functions to activate the three states: - -- `showLoading` displays the loader -- `showCTA` displays the call-to-action to non-web monetized users -- `showExclusiveContent` displays the exclusive content to web monetized users - -These functions work just like the [simple example](#example-1---simple) where we turn the `hidden` class on/off for our `div`s. - -When the page loads, we'll check whether the visitor is web monetized. - -```js -window.addEventListener('load', () => { - if (!window.MonetizationEvent) { -``` - -The loader will appear to web monetized visitors and the CTA will appear to everyone else. - -```js -if (!window.MonetizationEvent) { - showCTA() -} else { - showLoading() -} -``` - -If the visitor is web monetized, we'll listen for the `monetization` event that occurs when an outgoing payment request is successfully created. When this event fires, the exclusive content will appear and the other `div`s will be hidden. - -```js -if (window.MonetizationEvent) { - const link = document.querySelector('link[rel="monetization"]') - link.addEventListener('monetization', (ev) => { - showExclusiveContent() -``` - -### Interactive example - -This example simulates hiding and showing exclusive content based on a visitor's Web Monetization state. Web monetized visitors will see exclusive content while non-web monetized users will not. Conversely, non-web monetized users will see the message, "Please install a Web Monetization extension to support me!". - - - - - - diff --git a/src/content/docs/docs/guides/remove-ads.mdx b/src/content/docs/docs/guides/remove-ads.mdx deleted file mode 100644 index 62020cf4..00000000 --- a/src/content/docs/docs/guides/remove-ads.mdx +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: Remove ads ---- - -import NoPay from '/src/partials/glitchNoPay.mdx' -import ViewAs from '/src/partials/glitchViewAs.mdx' - -Give your web monetized visitors an ad-free experience by hiding ads when the `monetization` event fires. Since the `monetization` event only fires when an outgoing payment request is successfully created, your ads will continue to appear to non-web monetized visitors. - -## Before you begin - -For visitors without Web Monetization, ads will appear as soon as the page loads. - -For visitors with Web Monetization in their browser, there's a three-second grace period before ads are shown. This gives Web Monetization a chance to initialize and prevent ads from briefly appearing to paying visitors. - -**If Web Monetization...** - -- Initializes within the grace period, then ads are removed -- Fails to initialize within the grace period, then ads are shown -- Initializes any time after the grace period, then ads are removed - -## Example - -The example below shows how to remove ads from web monetized visitors. - -```html - - - - - - - - - - Here's where your site's content will go! - -``` - -## How it works - -Let's start with the code for showing an ad. - -```jsx -const adCode = - '
Ad! Buy product A! Ad!
' -function showAds() { - document.getElementById('ad').innerHTML = adCode -} -``` - -We want to bind the `monetization` event to its respective event handler if the visitor is web monetized. This prevents the ad from loading on the page once Web Monetization initializes. Assuming it initializes within the grace period, the ad isn't added to the page at all. This means any related images and trackers aren't loaded either. - -The `hasPaid` variable in the timer is for when/if Web Monetization starts after the grace period. - -```jsx -let hasPaid = false -if (window.MonetizationEvent) { - const link = document.querySelector('link[rel="monetization"]') - link.addEventListener('monetization', () => { - hasPaid = true - removeAds() - }) -} -``` - -As soon as the page loads, the ad will immediately appear to any visitor who isn't web monetized. This is handled via `!window.MonetizationEvent`, shown below. - -If the visitor has Web Monetization in their browser, then the `monetization` event must fire within 3 seconds (3000ms) to indicate that Web Monetization has initialized. If it doesn't initialize by the timeout, the ad is shown to the visitor. - -```jsx -window.addEventListener('load', () => { - if (!window.MonetizationEvent) { - showAds() - } else { - setTimeout(() => { - if (!hasPaid) { - showAds() - } - }, 3000) - } -}) -``` - -## Interactive example - -This example simulates showing and hiding an ad based on a visitor's Web Monetization state. - - - - - - diff --git a/src/content/docs/docs/guides/set-up-probabilistic-revenue-sharing.mdx b/src/content/docs/docs/guides/set-up-probabilistic-revenue-sharing.mdx deleted file mode 100644 index 3765131c..00000000 --- a/src/content/docs/docs/guides/set-up-probabilistic-revenue-sharing.mdx +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: Set up probabilistic revenue sharing ---- - -import NoPay from '/src/partials/glitchNoPay.mdx' - -How do you share a portion of a web monetized page's earnings when a monetization `` element only supports one wallet address as its `href` value? - -One way is through probabilistic revenue sharing. Probabilistic revenue sharing works by choosing from a list of predefined wallet addresses each time a web monetized visitor loads the page. Payments are sent to the chosen wallet address until the visitor reloads or closes the page. - -The chance of a wallet address being chosen is based on its assigned weight. For example, if Alice's wallet address has a weight of 50 (out of 100), then her wallet address has a 50% chance of being chosen. The laws of probability state that Alice's share of the page's total revenue will approach 50% as more web monetized visitors access the page. - -## Example - -This example shows how to use probabilistic revenue sharing by including a script on your web monetized page. It also uses payment pointers, but you can use any Open Payments-enabled wallet addresses. - -:::note -If you don't want to include a script on your page, you can use our [Probabilistic Revshare Generator](/prob-revshare). After entering your payment pointers and/or other Open Payments-enabled wallet addresses, along with weights, the generator will provide you with a monetization `` element that contains a unique `href` URL hosted on `https://webmonetization.org/prob-revshare/`. -::: - -The example below shows a list of weighted [payment pointers](/docs/resources/glossary#payment-pointer). The easiest way to establish weight is to assign values that add up to 100. - -```html - - - -``` - -### How it works - -First, we list the payment pointers and assign each one a weight. - -If the combined weights equal 100, then each weight represents the percentage at which each payment pointer will be chosen. For example, `$wallet.example.com/connie` has a 9.5% chance of being chosen, resulting in Connie's share approaching 9.5% of the page's total revenue as more web monetized visitors access the site. - -```js -const pointers = { - '$wallet.example.com/alice': 50, - '$wallet.example.com/bob': 40, - '$wallet.example.com/connie': 9.5, - '$wallet.example.com/dave': 0.5, -} -``` - -:::info -Since this method bypasses the need to include a monetization `` element, you can choose to use a payment pointer's shorthand form (e.g., `$wallet.example.com/alice`) rather than the endpoint URL that the payment pointer resolves to (e.g. `https://wallet.example.com/alice`). -::: - -Next, we define the function to cause payment pointers to be chosen based on weight. - -```jsx -function pickPointer() { - const sum = Object.values(pointers).reduce((sum, weight) => sum + weight, 0) - let choice = Math.random() * sum - - for (const pointer in pointers) { - const weight = pointers[pointer] - if ((choice -= weight) <= 0) { - return pointer - } - } -} -``` - -Finally, we add the code that dynamically inserts the randomly chosen payment pointer into the page on each load/refresh. - -```jsx -window.addEventListener('load', () => { - const monetizationTag = document.createElement('link') - monetizationTag.rel = 'monetization' - monetizationTag.href = pickPointer() - - document.head.appendChild(monetizationTag) -}) -``` - -### Interactive example - -This example shows how the random choices will approach the correct percentages over enough tries. You can customize the number of times to randomly choose a pointer and it will show you the results. - - - -If you see the source files instead of the example, click **View App** in the bottom right. - - diff --git a/src/content/docs/docs/intro/receiving-payments.mdx b/src/content/docs/docs/intro/receiving-payments.mdx deleted file mode 100644 index ba326c36..00000000 --- a/src/content/docs/docs/intro/receiving-payments.mdx +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: Receiving payments ---- - -import { LinkOut } from '@interledger/docs-design-system' - -Two key components of receiving a Web Monetization (WM) payment are WM receivers and Open Payments-enabled accounts. - -:::note -This page describes the role of WM receivers within the Web Monetization ecosystem. It does not explain how to become a receiver. -::: - -## WM receivers - -A WM receiver is an entity that provides an Open Payments-enabled account into which payments can be received. Individuals interested in receiving Web Monetization payments can establish a relationship with a WM receiver of their choice by signing up for an account. - -We anticipate most WM receivers to offer some form of digital wallet to their users. Many digital wallet providers, not just WM receivers, are often required to verify their users’ identities before allowing funds to be withdrawn. - -## Open Payments and wallet addresses - -Open Payments enables open and interoperable payments between WM providers and WM receivers. As such, accounts supplied by both WM providers and WM receivers must implement the Open Payments (OP) specification. - -The OP specification defines standards for **_access_** to accounts. When granted access, applications and other entities can integrate payments into their feature sets by connecting to their users’ accounts. The ability to then **_execute_** payments between OP-enabled accounts relies on the availability of a common payment rail between the accounts. - -### Wallet addresses - -Access to an OP-enabled account, whether for sending or receiving, always starts with a wallet address. In this context, a wallet address is a unique URL that identifies an OP account and provides an entry point for the Open Payments API. - -When an individual establishes an account with a WM receiver, the receiver assigns the account one or more wallet addresses. Wallet addresses allow certain account details to be safely shared with third-parties. Third-parties use the details to initiate payments to or from the account. A WM agent is an example of a third-party. - -A wallet address is required to web monetize a page and must be added as the `href` value within the monetization `` element. - -For example: - -```html - -``` - -The WM agent uses the wallet address to begin the money movement process. - -## Receiving a payment - -When an individual visits a web monetized page, their WM agent detects the monetization `` element and associated wallet address. The WM agent sends a request to the wallet address, which is the beginning of a series of API calls needed to: - -1. Get the details about the underlying receiving account -2. Receive permission to send a payment to the account -3. Create a monetization session within the site visitor's browser tab/window -4. Create the outgoing payment request - -When the payment is successful, the funds are deducted from the WM provider’s account and deposited into the WM receiver’s account. - -For more information, visit the [Web Monetization flow](/docs/intro/web-monetization-flow) page. - -## Specifying a payment amount - -Web Monetization does not enable a site to specify the amount it wants to receive. The amount, frequency, and other payment parameters are controlled by the web monetized visitor, through their relationship with their WM provider. - -If a site should specify a price, then integration with the W3C’s Payment Request API may be a better alternative to Web Monetization. The Payment Request API allows sites to ask to be paid a certain amount, then the browser (typically with the user’s approval) pays that amount. diff --git a/src/content/docs/docs/intro/sending-payments.mdx b/src/content/docs/docs/intro/sending-payments.mdx deleted file mode 100644 index 634f1379..00000000 --- a/src/content/docs/docs/intro/sending-payments.mdx +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: Sending payments ---- - -import { LinkOut, Tooltip } from '@interledger/docs-design-system' - -Three key components of sending a Web Monetization (WM) payment are: - -- WM providers -- Open Payments-enabled accounts -- WM agents - -:::note -This page describes the roles of WM providers and WM agents within the Web Monetization ecosystem. It does not explain how to become a provider or develop an agent. -::: - -## WM providers - -For a site visitor to send a Web Monetization payment, the visitor must have some kind of relationship with a WM provider. A WM provider is an entity that provides a funded Open Payments-enabled account from which payments can be sent. A provider can take a number of different forms, such as: - -- A company that uses its own account to make payments on behalf of its customers -- An app that’s authorized to hook directly into a user’s personal account -- An individual that hooks their personal account up to a WM agent - -In addition to providing funded accounts, WM providers are responsible for defining the payment models they support and implementing business logic and rules. For example, a WM provider might: - -- Only send payments in fiat currencies -- Support one-time payments and micropayments, but not real-time streaming payments -- Stream real-time payments at a fixed rate, for example $0.006 per minute -- Allow user-defined payout rates, frequencies, limits, and so on - -For a provider to send a Web Monetization payment on behalf of an individual, the provider must support the Open Payments specification. - -## Open Payments and wallet addresses - -Open Payments enables open and interoperable payments between WM providers and WM receivers. As such, accounts supplied by both WM providers and WM receivers must implement the Open Payments (OP) specification. - -The OP specification defines standards for **_access_** to accounts. When granted access, applications and other entities can integrate payments into their feature sets by connecting to their users’ accounts. The ability to then **_execute_** payments between OP-enabled accounts relies on the availability of a common payment rail between the accounts. - -### Wallet addresses - -Access to an OP-enabled account, whether for sending or receiving, always starts with a wallet address. In this context, a wallet address is a unique URL that identifies an OP account and provides an entry point for the Open Payments API. - -A wallet address allows certain account details to be safely shared with third-parties. Third-parties use the details to initiate payments to or from the account. A WM agent is an example of a third-party. - -Depending on the form a WM provider takes, the provider's user may not know, nor have a need to know, any details about the sending account's wallet address. - -## WM agents - -One goal of Web Monetization is for vendors to natively build the standard into web browsers. But we aren’t there yet. For now, users must install a separate WM agent, such as an extension, into their browsers. - -The WM agent is code that discovers web monetized pages, exposes the Web Monetization API, and communicates via the Open Payments APIs to obtain authorization and issue instructions for making a payment. - -### How it works - -The WM agent checks each page an individual visits for a monetization `` element. A monetization `` element must contain a valid Open Payments wallet address. For example: - -```html - -``` - -When detected, the WM agent begins a series of API calls to: - -1. Get the details about the underlying account -2. Receive permission to send a payment to the account -3. Create a monetization session within the site visitor's browser tab/window -4. Create the outgoing payment request - -Visit the [Add Web Monetization to a page](/docs/guides/monetize-page) and [Web Monetization flow](/docs/intro/web-monetization-flow) pages for more information. - -### Link a WM agent to a WM provider - -The Interledger Foundation is currently developing an open-source WM agent for users (release date TBD). WM providers could also choose to develop their own WM agents. Regardless of who supplies the WM agent, the agent must have a way to link to a provider. For example, a browser extension could allow individuals to select and sign in to their provider from within the extension UI. By signing in, the individual authorizes the extension to obtain settings from the provider and send payments on their behalf. - -Note that the Web Monetization specification itself doesn’t define the interface between the browser and the WM provider. This is intentional. How a browser ultimately chooses to allow WM providers to integrate is up to the browser. We feel that a browser’s extension system is the ideal way to support integration. diff --git a/src/content/docs/docs/intro/web-monetization-flow.mdx b/src/content/docs/docs/intro/web-monetization-flow.mdx deleted file mode 100644 index 4eb7faa8..00000000 --- a/src/content/docs/docs/intro/web-monetization-flow.mdx +++ /dev/null @@ -1,270 +0,0 @@ ---- -title: Web Monetization flow ---- - -import { Tabs, TabItem } from '@astrojs/starlight/components' -import { - CodeBlock, - LinkOut, - Mermaid, - MermaidWrapper, - Tooltip, -} from '@interledger/docs-design-system' - -Web Monetization (WM) relies on Open Payments (OP) and OP-enabled accounts to coordinate payments. - -The WM agent first issues a series of API calls to the receiving account's wallet address, then to the sending account's wallet address, to obtain the necessary authorization and instructions for sending a payment. - -## Sequence diagram - - - -sending account - end - participant WMA as WM agent - participant page as Web page - box aliceblue WM receiver - participant OPR as Open Payments
receiving account - participant AS as Auth server - end - note over AS,OPR: The auth server can be
located outside of the
WM receiver's domain - WMA->>page: Detects monetization element,
extracts wallet address - WMA->>OPR: Requests the public info for the wallet address - OPR->>WMA: Returns info, including auth server URL - WMA->>AS: Requests access rights - AS->>WMA: Returns access token - WMA->>OPR: Requests creation of an incoming payment resource - OPR->>WMA: Responds with unique payment details for addressing the payment to the account - WMA->>+OPS: Requests an outgoing payment be
created against the sending account - note left of OPS: Connection persists until
request moves from 'pending'
state to 'sending' state - OPS->>-WMA: Responds with details about the
'receive', 'send', and 'sent' amounts - WMA->>WMA: Fires monetization event - note over OPS,OPR: Payment processing and settlement occurs between the WM provider and WM receiver, outside of the WM flow -`} -/> - -
- -## Web Monetization flow example - -This section provides an example of the API calls that occur when a web monetized user visits a web monetized site. - -There's a few points to keep in mind as you review the example. - -- It's up to the site visitor, not the web monetized site, to decide how often and how much to pay, as well as the currency in which to send a payment. -- While Web Monetization and Open Payments work together to coordinate payments, neither moves money. Payment processing and settlement must occur between the sending and receiving accounts over a common payment rail. - -### Scenario - -Alice adds the monetization `` element to her website. Included within the `` is her wallet address, `https://wallet.example/alice`, assigned to her by her WM receiver. - -Bob signs up with a WM provider who supplies him with a funded sending account. The sending account's wallet address is `https://anotherwallet.example/bob`. After installing a WM agent in his browser and linking the WM agent to his WM provider, his WM agent now has permission to request payments be sent from his account. - -:::note -This example assumes the WM provider and WM receiver have already peered with each other and share a common payment rail over which transactions can be processed and settled. -::: - -### 1 - Check for Web Monetization - -As Bob browses Alice's site, his WM agent detects a monetization `` element. - -```html - -``` - -### 2 - Send request to wallet address (receiving account) - - - - The WM agent issues a request to Alice's wallet address to discover the Open Payments service endpoint. - - - ```http - GET /alice HTTP/1.1 - Accept: application/json - Host: wallet.example - ``` - - - - The response includes, among other details, the URL for her WM receiver's grant request endpoint (authorization server). - - - ```http - HTTP/1.1 200 Success - Content-Type: application/json - - { - "id":"https://wallet.example/alice", - "assetCode":"USD", - "assetScale":2, - "authServer":"https://wallet.example/auth" - } - ``` - - - - - -### 3 - Send grant request to WM receiver's auth server - - - - The WM agent issues a request to the WM receiver's grant request endpoint (authorization server) to get an access token. - - In this example, the WM agent requests access to create and read incoming payments (i.e., payments coming in to Alice's WM receiver). - - - ```http - POST /auth/ HTTP/1.1 - Accept: application/json - Content-Type: application/json - Host: wallet.example - Content-Length: 218 - - { - "access_token":{ - "access":[ - { - "type":"incoming-payment", - "actions":[ - "create", - "read" - ], - "identifier":"https://wallet.example/alice" - } - ] - }, - "interact":{ - "finish":{ - "method":"redirect" - } - }, - "client":"https://anotherwallet.example/bob" - } - ``` - - - - The grant request is non-interactive, so the WM receiver grants the request and issues an access token. - - - ```http - { - "access_token":{ - "value":"OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0", - "manage":"https://wallet.example/auth/token/dd17a202-9982-4ed9-ae31-564947fb6379", - "access":[ - { - "type":"incoming-payment", - "actions":[ - "create", - "read" - ], - "identifier":"https://wallet.example/alice" - } - ] - } - } - ``` - - - - -### 4 - Send incoming payment request to wallet address (receiving account) - - - - The WM agent creates an incoming payment for the session (e.g., the open browser tab) by issuing an incoming payment request to Alice's wallet address. The request uses details obtained from the previous API calls. - -:::note -The request is for an _incoming_ payment because the WM agent is requesting that Alice's account accept an incoming payment. The payment itself has not been sent yet. -::: - - - ```http - POST /alice/incoming-payments HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0 - Host: wallet.example - ``` - - - - - Alice's WM receiver (who hosts her account and wallet address) approves the request by supplying unique payment details for the WM agent to use to address the payment to Alice's account. - - - ```http - { - "id":"https://wallet.example/alice/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c", - "walletAddress":"https://wallet.example/alice", - "receivedAmount":{ - "value":"0", - "assetCode":"USD", - "assetScale":2 - }, - "completed":false, - "createdAt":"2022-03-12T23:20:50.52Z", - "updatedAt":"2022-03-12T23:20:50.52Z" - } - ``` - - - - -### 5 - Send outgoing payment request to wallet address (sending account) - - - - The WM agent uses the details obtained thus far to create an outgoing payment request against Bob's account (via his wallet address). Note that this is just a request to send a payment. The payment itself has not been sent and the request is in a pending state. - - - ```http - POST /bob/outgoing-payment HTTP/1.1 - Accept: application/json - Content-Type: application/json - Authorization: {{ outgoingPaymentGrant.accessToken.value }} - Host: anotherwallet.example - ``` - - - - A successful response indicates the request has moved from a pending state to a sending state. This means Bob's account has the funds to cover the payment. Note that the payment itself has still not been sent (`"sentAmount":{"value":"0"}`). - - - ```http - { - "id":"https://anotherwallet.example/bob/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf", - "walletAddress":"https://anotherwallet.example/bob/", - "receiver":"https://wallet.example/alice/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c", - "receiveAmount":{ - "value":"2", - "assetCode":"USD", - "assetScale":2 - }, - "sendAmount":{ - "value":"2", - "assetCode":"USD", - "assetScale":2 - }, - "sentAmount":{ - "value":"0", - "assetCode":"USD", - "assetScale":2 - }, - "createdAt":"2022-03-12T23:20:55.52Z", - "updatedAt":"2022-03-12T23:20:55.52Z" - } - ``` - - - The Web Monetization flow is complete. It's now up to the WM provider to process the payment and settle with the WM receiver. - - - diff --git a/src/content/docs/docs/references/attributes/amount.mdx b/src/content/docs/docs/references/attributes/amount.mdx deleted file mode 100644 index 7ac493f5..00000000 --- a/src/content/docs/docs/references/attributes/amount.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: amount ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/amount.json' - -:::danger[Caution - Deprecated Attribute] -The `amount` attribute is deprecated. Consider using the [amountSent](/docs/references/attributes/amountsent) attribute instead. -::: - -The `MonetizationEvent` `amount` attribute returned the amount of money that was successfully received on the last payment. - -### Value - -An integer representing the amount of money received. - -### Example - -```html - - -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/attributes/amountsent.mdx b/src/content/docs/docs/references/attributes/amountsent.mdx deleted file mode 100644 index 4dbd94cb..00000000 --- a/src/content/docs/docs/references/attributes/amountsent.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: amountSent ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/amountSent.json' -import { LinkOut, Tooltip } from '@interledger/docs-design-system' - -The `monetization` event's `amountSent` attribute returns you the amount (`value`) and currency code (`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 - -```html - - -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/attributes/assetcode.mdx b/src/content/docs/docs/references/attributes/assetcode.mdx deleted file mode 100644 index b05c8bf7..00000000 --- a/src/content/docs/docs/references/attributes/assetcode.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: assetCode ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/assetCode.json' - -:::danger[Caution - Deprecated Attribute] -The `assetCode` attribute is deprecated. Consider using the [amountSent](/docs/references/attributes/amountsent) attribute instead. -::: - -The `MonetizationEvent` `assetCode` attribute returned the currency code of the last payment received. - -### Value - -A string representing the three-character currency code on the last payment received. - -### Example - -```html - - -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/attributes/assetscale.mdx b/src/content/docs/docs/references/attributes/assetscale.mdx deleted file mode 100644 index 261f056d..00000000 --- a/src/content/docs/docs/references/attributes/assetscale.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: assetScale ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/assetScale.json' - -:::danger[Caution - Deprecated Attribute] -The `assetScale` attribute is deprecated. Consider using the [amountSent](/docs/references/attributes/amountsent) attribute instead. -::: - -The `MonetizationEvent` `assetScale` attribute returned the scale of the paid amount - -### Value - -An integer that represents the scale on the amount of money received in the last payment. - -### Example - -```html - - -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/attributes/incomingpayment.mdx b/src/content/docs/docs/references/attributes/incomingpayment.mdx deleted file mode 100644 index 06645da7..00000000 --- a/src/content/docs/docs/references/attributes/incomingpayment.mdx +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: incomingPayment ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/incomingPayment.json' -import { LinkOut, Hidden } from '@interledger/docs-design-system' - -:::tip[Experimental Attribute] -`incomingPayment` is an experimental technology. -::: - -The `monetization` event's `incomingPayment` attribute can be used to verify the receipt of a payment. Today, the `monetization` event fires when the WM agent successfully creates an outgoing payment request at the WM provider. Since it's only a request to send an outgoing payment, there's no guarantee at this point that a payment has been received. - -The `incomingPayment` attribute returns the URL that represents the incoming payment at the WM receiver. The returned value is the value it was initialized with. By querying the URL, you can get the `receivedAmount`. - -## Example - -```jsx -/** @type {MonetizationEvent} event */ -async function verifyPayment(event) { - // Legacy receivers don't support returning incoming payment URLs - if (!event.incomingPayment) { - throw new Error('No incoming payment URL') - } - - const response = await fetch(event.incomingPayment, { - method: 'GET', - credentials: 'same-origin', - mode: 'same-origin', - cache: 'no-cache', - headers: { - 'Content-Type': 'application/json', - }, - }) - - if (response.ok) { - // The incoming payment was fetched successfully - const { receivedAmount } = await response.json() - const { amount, assetCode, assetScale } = receivedAmount - console.log(`Received ${assetCode}${amount / Math.pow(10, assetScale)}.`) - } -} -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/attributes/paymentpointer.mdx b/src/content/docs/docs/references/attributes/paymentpointer.mdx deleted file mode 100644 index 32ab3cf4..00000000 --- a/src/content/docs/docs/references/attributes/paymentpointer.mdx +++ /dev/null @@ -1,28 +0,0 @@ ---- -title: paymentPointer ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/paymentPointer.json' - -The `monetization` event's `paymentPointer` attribute returns the URL representing the payment endpoint used by the incoming Web Monetization payment. The returned value is the value it was initialized with. - -## Example - -```html - - -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/attributes/receipt.mdx b/src/content/docs/docs/references/attributes/receipt.mdx deleted file mode 100644 index 4b417e63..00000000 --- a/src/content/docs/docs/references/attributes/receipt.mdx +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: receipt ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/receipt.json' - -:::danger[Caution - Deprecated Attribute] -Receipts and its associated `receipt` attribute are deprecated. Consider using the [incomingPayment](/docs/references/attributes/incomingpayment) attribute instead. -::: - -The `MonetizationEvent` `receipt` attribute returned an optional proof-of-payment receipt. It was issued from the monetization receiver to the monetization provider as proof of the total current amount received in a stream. - -### Value - -A base64-encoded STREAM receipt. Returned null if receipts were not enabled on the payment pointer. The receipt had the total running amount streamed in the current session. - -### Example - -```html - - -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/csp-monetization-src.mdx b/src/content/docs/docs/references/csp-monetization-src.mdx deleted file mode 100644 index 699068a2..00000000 --- a/src/content/docs/docs/references/csp-monetization-src.mdx +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: 'Content-Security-Policy: monetization-src' ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/csp-monetization-src.json' -import { LinkOut } from '@interledger/docs-design-system' - -The `monetization-src` directive within the HTTP Content-Security-Policy (CSP) allows you to restrict the URLs from which an Open Payments-enabled wallet address, such as a payment pointer, can be loaded. - - - - - - - - - - - - -
- CSP version - 3
- Directive type - - - Fetch directive - -
- -## Syntax - -The basic syntax is as follows, where `source` is a serialized source list. More than one source can be allowed for the `monetization-src` policy: - -```http -Content-Security-Policy: monetization-src ; -Content-Security-Policy: monetization-src , ; -``` - -### Sources - -`` can be any one of the values listed in CSP Source Values. - -## Example - -### Violation case - -A website administrator wants to restrict the URLs from which a wallet address can be loaded. - -Given this CSP header: - -```http -Content-Security-Policy: monetization-src https://www.wallet.example; -``` - -Fetches for the following monetization source will return a network error and not load, as the URL does not match the URL defined in the CSP source list. - -```html - -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/html-link-rel-monetization.mdx b/src/content/docs/docs/references/html-link-rel-monetization.mdx deleted file mode 100644 index ac789416..00000000 --- a/src/content/docs/docs/references/html-link-rel-monetization.mdx +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: 'HTML rel=monetization' ---- - -import Specification from '/src/components/docs/Specification.astro' -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. - -```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. -::: - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/monetizationevent.mdx b/src/content/docs/docs/references/monetizationevent.mdx deleted file mode 100644 index a6460781..00000000 --- a/src/content/docs/docs/references/monetizationevent.mdx +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: MonetizationEvent ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/monetizationevent.json' - -The `MonetizationEvent` DOM events provide information about payments sent to WM receivers. - -The `monetization` event fires when a WM agent successfully creates an outgoing payment request at the WM provider. There’s no guarantee that any payments will follow or, if they do, how often or how large the payments will be. - -By listening for `monetization` events, you can use the returned details to verify the receipt of a payment. You can then choose to have the page programmatically respond to successful payments. For example, you could [remove ads](/docs/guides/remove-ads) or provide access to [exclusive content](/docs/guides/provide-exclusive-content). - - - - - - - - - - - - - - - - - - -
BubblesYes
CancelableNo
InterfaceMonetizationEvent
Event handler property - onmonetization -
- -## Current attributes - -- [amountSent](/docs/references/attributes/amountsent) - Returns the amount and currency code of the sent payment -- [incomingPayment](/docs/references/attributes/incomingpayment) - Returns the incoming payment URL -- [paymentPointer](/docs/references/attributes/paymentpointer) - A URL representing the payment pointer endpoint - -## Deprecated attributes - -- [amount](/docs/references/attributes/amount) - An integer amount delivered by an Interledger packet -- [assetCode](/docs/references/attributes/assetcode) - A string representing the currency code of the received amount -- [assetScale](/docs/references/attributes/assetscale) - The scale of the received amount -- [receipt](/docs/references/attributes/receipt) - The base-64 encoded Interledger STREAM receipt that the browser received - -## Example - -```html - - -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/onmonetization.mdx b/src/content/docs/docs/references/onmonetization.mdx deleted file mode 100644 index ac22915b..00000000 --- a/src/content/docs/docs/references/onmonetization.mdx +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: 'GlobalEventHandlers: onmonetization' ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/onmonetization.json' -import { Tooltip } from '@interledger/docs-design-system' - -The `onmonetization` attribute of the `GlobalEventHandlers` mixin is used to process `monetization` events sent to the `Window`. - -`onmonetization` can be applied to any element and is used by the user agent (such as a web browser or WM agent) to notify that some `` element is monetized. - -## Syntax - -```js -window.onmonetization = functionRef -``` - -## Example - -Show a visitor an alert box and message when a Web Monetization event is triggered. - -```js -window.onmonetization = function () { - alert('This page supports Web Monetization.') -} -``` - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/references/permissions-policy-monetization.mdx b/src/content/docs/docs/references/permissions-policy-monetization.mdx deleted file mode 100644 index 003e77cb..00000000 --- a/src/content/docs/docs/references/permissions-policy-monetization.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: Permissions Policy ---- - -import Specification from '/src/components/docs/Specification.astro' -import BrowserCompat from '/src/components/docs/BrowserCompat.astro' -import data from '/src/data/browser-compat-data/permissionpolicy.json' -import { LinkOut } from '@interledger/docs-design-system' - -The `monetization` directive within the HTTP Permissions-Policy header controls whether the current document and any nesting browsing contexts (iframes) are allowed to use the Web Monetization API. - -## Syntax - -The basic syntax is as follows, where `allowlist` is a list of origins permitted to use Web Monetization. - -```http -Permissions-Policy: monetization=(allowlist) -``` - -## Example - -Allow Web Monetization in the document and in all nested browsing contexts (iframes) in the same origin. - -```http -Permissions-Policy: monetization=(self) -``` - -This is the default policy for `monetization`. - -:::note -The `allowlist` attributes only take effect when the _content navigable_ of the iframe is navigated. Adding or removing the monetization attribute has no effect on an already-loaded document. -::: - -## Specifications - - - -{/* ## Browser compatibility */} - -{/* */} diff --git a/src/content/docs/docs/resources/get-involved.mdx b/src/content/docs/docs/resources/get-involved.mdx deleted file mode 100644 index 42567c41..00000000 --- a/src/content/docs/docs/resources/get-involved.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: Get involved ---- - -import { LinkOut } from '@interledger/docs-design-system' - -## Participation - -- Join our WM Community calls. -- Begin a new discussion or contribute to existing discussions in the WICG Web Monetization GitHub repo. -- Contribute something you've built, open a new issue, or contribute to existing issues in the WICG Web Monetization GitHub repo. -- Suggest changes to the specification by submitting a pull request. For more details about spec contributions and development, visit contributing.md. - -## Coding - -- Update the existing Web Monetization v1 [tools/libraries](/docs/resources/libraries/) to the latest spec. -- Create new Web Monetization tools/plugins for frameworks and libraries. -- Build applications with new and varied use cases around Web Monetization. For example, you could: - - Add Web Monetization to your favorite open source project. - - Create tools to allow websites to interact with web monetized visitors. Visual indicators, like celebration confetti, thank you notes, or payment counters are just a few ways to promote interaction. -- Contribute to the ILF's Web Monetization extension by coding or testing. - -## Community events and hackathons - -- Join us at the Interledger Summit and participate in our annual hackathon. -- Organize your own hackathons, coding sprints, and installa-thons, both online and offline. Run campaigns and encourage participants to develop, collaborate on, and test projects. - -## Localization - -- Translate and localize the [Intro to Web Monetization](/docs/) page into one of the following languages: - - Arabic - - Chinese - - French - - German - - Japanese - - Portuguese - - Spanish -- Review translated and localized content. - -## Documentation - -- Contribute to the docs by suggesting additions and improvements. -- Create tutorials and guides to help others in the community work with Web Monetization. - -Review our contribution guide for details. \ No newline at end of file diff --git a/src/content/docs/docs/resources/glossary.mdx b/src/content/docs/docs/resources/glossary.mdx deleted file mode 100644 index 83754662..00000000 --- a/src/content/docs/docs/resources/glossary.mdx +++ /dev/null @@ -1,130 +0,0 @@ ---- -title: Glossary ---- - -import { LinkOut } from '@interledger/docs-design-system' - -## A - -
- -### Account - -The definition of account depends on its context. When we refer to an account, we typically mean an Open Payments-enabled payment account. A payment account is an arrangement by which an entity sends, receives, holds, and keeps records of a user's credit or debit transactions. An Open Payments-enabled account is an account that supports the Open Payments APIs. - -An account can also be an arrangement by which a user is given access to a service by entering a username and password. - -### Account servicing entity (ASE) - -An entity that provides and maintains a payment account for a payer and/or payee. An ASE is a regulated entity within the country or countries it operates. Examples include digital wallets, banks, crypto wallets, and mobile money providers. - -## D - -
- -### Digital wallet - -The term _digital wallet_ means different things to different people, services, and technologies. We try to avoid over-using the term for this reason. However, in cases where we do reference digital wallets, it's within the context of Open Payments. As such, we assume the digital wallets have implemented the Open Payments standard. - -Open Payments defines a digital wallet as any Internet-connected system that acts as an agent of a person or business that is capable of sending and receiving payments from or to that person or business. - -## O - -
- -### Open Payments (OP) - -Open Payments is a specification -that aims to define standards for access to digital wallets. When a digital wallet -provider implements the spec, third-party applications and other entities can integrate -payments into their feature sets by connecting to their users' existing financial -accounts, rather than requiring users to create new accounts. The ability to then -execute payments between accounts contained within Open Payments-enabled wallets -relies on the availability of a common payment rail between the wallets.{' '} - -Web Monetization relies on Open Payments though its use of wallet addresses. - -## P - -
- -### Payment pointer - -A payment pointer is a type of Open Payments-enabled [wallet address](#wallet-address). Payment pointers usually begin with a `$`. For example: `$wallet.example.com/alice`. Visit paymentpointers.org for additional information. - -### Payment session - -A session between a Web Monetization provider and Web Monetization receiver, initialized by a user agent, whereby the provider initiates a payment to the receiver. - -The provider can initiate multiple payment sessions during a Web Monetization session: - -- At the same time, when there’s multiple monetization `` elements on a page -- Sequentially, when an incoming payment completes/expires and a new incoming payment is created on the same wallet address - -## U - -
- -### User agent - -A user agent is any software that retrieves, renders and facilitates end user interaction with Web content, or whose user interface is implemented using Web technologies. (W3C) - -A web browser is an example of a user agent. - -## W - -
- -### Wallet address - -Every Open Payments account within a digital wallet, or the Open Payments-enabled digital wallet itself (depending on implementation), is identified by a unique URL called a wallet address. The URL not only identifies the account or wallet, but also provides the entry point to the Open Payments APIs. - -Conceptually, a wallet address is like an email address for an account or wallet. It's a publicly shareable address used to request and/or grant authorization to interact with the underlying account or wallet. Example interactions include sending and receiving payments. - -The `` value within the monetization `` element must be an Open Payments-enabled wallet address. - -### Web Monetization (WM) - -A specification for allowing websites to automatically receive payments from users, facilitated by a user agent or Web Monetization agent, and the site visitor's preferred Web Monetization provider. - -### Web Monetization agent - -Code within a web browser that discovers web monetized pages, exposes the Web Monetization API and communicates with the Open Payments APIs. - -When a vendor natively builds Web Monetization into their browser, the browser (user agent) acts as the Web Monetization agent. Until then, a separate Web Monetization agent, such as a browser extension, is required. - -Visit the [Sending Payments](/docs/intro/sending-payments/#wm-agents) page for additional information. - -### Web Monetization payment - -A payment that occurs due to a web monetized visitor accessing a web monetized page. Typically shortened to _payment_ within the docs. - -Visit the [Web Monetization flow](/docs/intro/web-monetization-flow) page for additional information. - -### Web Monetization provider - -An entity or collection of entities that together enable Web Monetization payments to be sent on behalf of an individual when the individual visits a web monetized page. At minimum, a Web Monetization provider is an account servicing entity that supplies a funded Open Payments-enabled account from which to send payments. - -Visit the [Sending Payments](/docs/intro/sending-payments/#wm-providers) page for additional information. - -### Web Monetization receiver - -An entity or collection of entities that together enable Web Monetization payments to be received and held on behalf of an individual. At minimum, a Web Monetization receiver is an account servicing entity that supplies an Open Payments-enabled account capable of receiving payments. - -Visit the [Receiving Payments](/docs/intro/receiving-payments/#wm-receivers) page for additional information. - -### Web Monetization session - -A way to describe a web session on a Web Monetized page/site. Each page load or refresh is a unique Web Monetization session (sometimes shortened to _monetization session_). The web browser generates a unique session ID which the website can use to correlate incoming payments to a client-side context. - -### Web monetized page/site - -Describes a page/site that has implemented Web Monetization. - -The terms _page_ and _site_ are used interchangeably within the docs; however, there is a technical difference to be aware of. - -Web Monetization is configured at the page level. A web monetized page is a page that contains a well-formed monetization `` element. For an entire site to be web monetized, each page of the site must have a `` element. - -### Web monetized user - -A website visitor who has a relationship with a Web Monetization provider and on whose behalf the Web Monetization provider sends payments. diff --git a/src/content/docs/docs/resources/op-wallets.mdx b/src/content/docs/docs/resources/op-wallets.mdx deleted file mode 100644 index d991245c..00000000 --- a/src/content/docs/docs/resources/op-wallets.mdx +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: Web Monetization-enabled wallets -next: false ---- - -import { Tabs, TabItem } from '@astrojs/starlight/components' -import { LinkOut } from '@interledger/docs-design-system' - -A Web Monetization-enabled wallet is required to send and/or receive payments. The wallet providers on this page are set up to support Web Monetization. - -Be sure to select a provider that is available in your **region** and supports your preferred **currency**. - -Your provider will assign you a payment address, called either a wallet address or a payment pointer. - -## Wallet providers - -| Provider | Payment Address Label | -| --------------- | --------------- | -| Fynbos | Wallet address | -| GateHub | Payment pointer | \ No newline at end of file diff --git a/src/content/docs/es/docs.mdx b/src/content/docs/es/docs.mdx deleted file mode 100644 index 1e82e8a3..00000000 --- a/src/content/docs/es/docs.mdx +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Introducción a la Monetización Web ---- - -import { LargeImg, LinkOut, Tooltip } from '@interledger/docs-design-system' - -Como usuario de un sitio web, es común encontrar un titular que capte tu atención, sólo para encontrar el artículo bloqueado detrás de un muro de pago. ¿Con qué frecuencia pagas una suscripción para leer un solo artículo? ¿Qué pasaría si pudieras pagar una fracción del precio de la suscripción para acceder al artículo y evitar la suscripción por completo? - -Como propietario de un sitio web, anticipas perder algunos visitantes debido al contenido de pago. Incluso si ofreces suscripciones semanales, el precio puede ser mayor de lo que un visitante está dispuesto a pagar. Pero en lugar de suscripciones, ¿qué pasaría si pudieras generar ingresos por contenido, o incluso en función de la cantidad de tiempo que un visitante dedica al contenido? - -Éstas son sólo dos formas en que la monetización web puede facilitar los pagos. Con la monetización web, los visitantes del sitio web pueden enviar pagos directamente a los sitios web utilizando una extensión de navegador o cualquier navegador que implemente de forma nativa la especificación de monetización web. - -## Infraestructura de pagos actual - -Puede llevar un poco de trabajo implementar pagos en un sitio web. Si tu sitio ya acepta pagos, es posible que estés familiarizado con lo que se necesita para aceptar múltiples métodos de pago y monedas. El proceso normalmente se parece a esto: - -1. Te registras con uno o más proveedores de pago, según los métodos de pago y las monedas que desees aceptar. -2. Tú integras sus servicios en tu sitio. Por ejemplo, puedes crear y alojar tu propio formulario de pago que esté conectado al servicio, o utilizar un formulario proporcionado por el proveedor de pagos. -3. Dependiendo del método de pago que tu visitante desee utilizar, es posible que deba crear una cuenta contigo o con el proveedor de pagos. -4. Tu visitante completa el formulario de pago. Lo ideal es que permanezcan en tu sitio para completar la transacción, pero es posible que deban acceder al sitio del proveedor. - -## Introduciendo la Monetización Web - -La Monetización Web (WM por sus siglas en inglés) tiene como objetivo simplificar la experiencia de pago para ti y los visitantes de tu sitio web. Es una tecnología abierta que permite a los sitios web recibir automáticamente pagos de los visitantes, facilitados por el navegador del visitante y su proveedor de WM preferido. - -Es un estándar propuesto que permite a los visitantes pagar una cantidad de su elección con poca o ninguna interacción del usuario. Permite que un sitio web indique automáticamente a los navegadores web que puede aceptar pagos y permite a los navegadores web facilitar un pago mediante: - -- Obtención de autorización para iniciar el pago. -- Recopilar detalles y emitir instrucciones para iniciar el proceso de movimiento de dinero. -- Crear una sesión de pago. -- Comunicar eventos de pago al sitio para que el sitio pueda responder opcionalmente. Por ejemplo, el sitio podría [eliminar anuncios](/es/docs/guides/remove-ads) o proporcionar [acceso a contenido exclusivo](/es/docs/guides/provide-exclusive-content) para los visitantes que pagan. - -### Flujo de alto nivel - -La siguiente imagen muestra el flujo de monetización web en un nivel alto. Algunos pasos se han combinado o excluido. Se proporciona una explicación más detallada en la página [Flujo de monetización web](/es/docs/intro/web-monetization-flow). - - - -1. Bob visita una [página web monetizada](/es/docs/guides/monetize-page). El elemento de monetización `` es la forma en que el sitio web indica su aceptación de pagos al navegador. -2. El navegador de Bob, ya sea de forma nativa o mediante una extensión del navegador, analiza el elemento `` para obtener dirección de billetera de Alice, la propietaria del sitio. -3. El navegador/extensión de Bob envía solicitudes a la dirección de la billetera de Alice para obtener autorización e instrucciones para enviar un pago. -4. Con la autorización concedida y las instrucciones de pago recibidas, el navegador/extensión envía solicitudes a la dirección de la billetera de Bob para iniciar el pago. -5. El flujo de Monetización Web finaliza. El procesamiento de pagos, el cambio de divisas y la liquidación se realizan entre las dos cuentas a través de una vía de pago común. - -### Especificación de montos de pago y monedas - -La monetización web no permite que un sitio web especifique un monto de pago o moneda. Solo permite que el sitio le indique al navegador que puede aceptar pagos. - -Con la ayuda de un proveedor de WM, tu visitante decide si realiza un pago, cuánto y con qué frecuencia y en qué moneda. Tu receptor de WM puede entonces cambiar la moneda de pagos entrantes en función de lo que deseas recibir. Esta flexibilidad te permite a ti y a tus visitantes elegir los métodos de monetización que mejor se adapten a sus necesidades. - -### Procesamiento y liquidación de pagos - -La función de la monetización web es ayudar a coordinar los pagos. No procesar ni liquidar pagos. - -En cada extremo de la monetización web hay una cuenta que admite Open Payments. El proveedor de WM proporciona a tu visitante una cuenta de envío con fondos. En algunos casos, el visitante podría incluso actuar como su propio proveedor de WM. El receptor WM te proporciona una cuenta receptora. - -La monetización web se comunica con las cuentas emisoras y receptoras para obtener las autorizaciones e instrucciones necesarias para que un pago sea enviado y recibido. Luego, el procesamiento y la liquidación de pagos se producen entre las cuentas emisoras y receptoras, fuera del flujo de monetización web. - -## Versión de la especificación anterior - -En junio de 2023 se publicó una nueva versión de la especificación de Monetización web. Los usuarios de la versión anterior deben tener en cuenta lo siguiente: - -- La versión anterior solo utilizaba el Protocolo de configuración de pago simple (SPSP) de Interledger. La nueva versión utiliza Open Payments. -- El elemento `` está obsoleto en favor del elemento [``](/es/docs/references/html-link-rel-monetization/). -- El elemento `` no admite la forma abreviada de un puntero de pago (por ejemplo, `$wallet.example/alice`). Debes utilizar la URL completa a la que se resuelve el puntero de pago (por ejemplo, `https://wallet.example/alice`). Si necesitas ayuda para convertir un indicador de pago de una abreviatura a su URL equivalente, ingresa su indicador de pago en el campo de entrada en paymentpointers.org. En la mayoría de los casos, puedes simplemente reemplazar `$` por `https://`. diff --git a/src/content/docs/experiment/csp.mdx b/src/content/docs/experiment/csp.mdx new file mode 100644 index 00000000..bf09ceee --- /dev/null +++ b/src/content/docs/experiment/csp.mdx @@ -0,0 +1,70 @@ +--- +title: Content Security Policy (CSP) +--- + +import { LinkOut, Hidden } from "@interledger/docs-design-system"; +import Specification from '/src/components/docs/Specification.astro' +import BrowserCompat from '/src/components/docs/BrowserCompat.astro' +import data from '/src/data/browser-compat-data/csp-monetization-src.json' + +A Content Security Policy (CSP) is an extra layer of security that allows you to control the resources a user agent, such as a web browser, is allowed to load for a given page. CSPs use directives to describe the policies for a certain resource type. + +The `monetization-src` fetch directive allows you to define the payment pointer and wallet address URLs that a browser can load. If an attempt is made to load an undefined URL, a network error will occur and the URL will not load. + + + + + + + + + + + + + + +
CSP Version3
Directive`monetization-src`
Directive typeFetch directive
+ +## Syntax + +```http +Content-Security-Policy: monetization-src ; +Content-Security-Policy: monetization-src , ; +``` + +Where `` is a payment pointer or wallet address URL that's allowed to load. + +```http +Content-Security-Policy: monetization-src https://example.com; +``` + +## Example + +Your wallet address is `https://wallet.example.com/alice`. You want to ensure that no other URLs can be loaded. + +You configure your web server to return the following `Content-Security-Policy` HTTP header on each applicable page of your website. + +```http +Content-Security-Policy: monetization-src https://wallet.example.com/alice; +``` + +A bad actor injects their wallet address into your site. + +```html + +``` + +However, fetches for the injected URL will return a network error and not load because the URL doesn't match what you've defined in your CSP. + + + +// ## Browser compatibility + + + + + +## Specifications + + \ No newline at end of file diff --git a/src/content/docs/experiment/events.mdx b/src/content/docs/experiment/events.mdx new file mode 100644 index 00000000..c98955c4 --- /dev/null +++ b/src/content/docs/experiment/events.mdx @@ -0,0 +1,244 @@ +--- +title: Monetization events +--- + +import { LinkOut, Hidden, Tooltip } from "@interledger/docs-design-system"; +import Specification from '/src/components/docs/Specification.astro' +import { Tabs, TabItem, Steps, Badge } from '@astrojs/starlight/components'; +import BrowserCompat from '/src/components/docs/BrowserCompat.astro' +import amountSent from '/src/data/browser-compat-data/amountSent.json' +import incomingPayment from '/src/data/browser-compat-data/incomingPayment.json' +import paymentPointer from '/src/data/browser-compat-data/paymentPointer.json' + + + +One responsibility of the [Web Monetization agent](/resources/glossary/#web-monetization-agent) is to instrument payments. The agent does this by calling the Open Payments APIs, which are APIs implemented by wallet providers. + +The agent makes calls to the `/incoming-payments` endpoint at your wallet provider and to the `/outgoing-payments` endpoint at your site visitor's wallet provider. + +Each time the agent receives a `201 outgoing payment created` response from the site visitor's wallet provider, the agent fires a `monetization` event on the browser window. + +### Specifications + + + +## Event listeners + +When a `monetization` event fires, there's no guarantee that payments will follow or, if they do, how often or how large the payments will be. + +A `monetization` event indicates that the site visitor's wallet provider has created the resources needed for it to send a payment. + +By adding an event listener to the relevant monetization `` element (or one of its ancestors), you can use the `monetization` event properties to verify payments. These properties provide: + +* Information about the [amount and currency](#amountsent) of a sent (not received) payment +* A URL representing an [incoming payment](#incomingpayment) that can be used to determine the amount received, similar to a receipt +* The URL representing the [payment pointer or wallet address](#paymentpointer) that an incoming payment request was sent to + +### High-level flow + + +1. You add an event listener to a monetization ``. +2. The site visitor accesses your page. +3. The site visitor's Web Monetization agent calls the Open Payments APIs to begin setting up the payment. More information about these API calls is provided in the [How payments work](/experiment/how-payments-work#a-deeper-dive-into-payments) page. +4. The Web Monetization agent receives a `201 (outgoing payment created)` response from the site visitor's wallet provider. +5. The Web Monetization agent fires a `monetization` event. +6. Your event listener calls its defined function. + + +## Event properties + +### amountSent + +The `amountSent` property returns the `value` and `currency` of the sent payment. + +* `value` - The amount. A valid decimal monetary value containing the amount that was sent. +* `currency` - The currency code. A well-formed 3-letter ISO4217 code that represents the currency that was sent, such as USD or GBP. + +```js title="Example" +"value": "1.23" +"currency": "USD" +``` + +:::note[Received amount] +The `amountSent` is not necessarily the amount received. For example, if your payment account is set up to receive GBP, but your site visitor's account sends in USD, then exchange rates and currency conversion fees could affect the amount you receive. +::: + +#### Examples using `amountSent` + +In this example, you have a single monetization link element and are listening for `monetization` events on the element. + +```js + + +``` + +In this example, you have multiple link elements (not shown). You're listening for `monetization` events on the `window`, which provides events for all monetization link elements on the page. The `event.target` will correspond to the relevant link element. + +```js + +``` + + + +// #### amountSent browser compatibility + + + + + +#### Specifications + + + +### incomingPayment + +:::tip[Experimental] +`incomingPayment` is an experimental technology. +::: + +The `incomingPayment` property allows you to check whether a payment was received and, if so, the amount received. + +The property returns a URL that represents the incoming payment at your wallet provider. By querying the URL, you can get the `receivedAmount`. + +#### Example using `incomingPayment` + +This example shows a hypothetical verification method that makes a basic request to the `incomingPayment` URL and returns the results. For simplicity, it has no logic for authenticating the request. + +:::note[Authentication] +In many cases, requests to the `incomingPayment` URL must be authenticated because you're fetching sensitive details. The payment account owner should request these specifics from their wallet provider. +::: + +```js +/** @type {MonetizationEvent} event */ +async function verifyPayment(event) { + // Legacy receivers don't support returning incoming payment URLs + if (!event.incomingPayment) { + throw new Error('No incoming payment URL') + } + + const response = await fetch(event.incomingPayment, { + method: 'GET', + credentials: 'same-origin', + mode: 'same-origin', + cache: 'no-cache', + headers: { + 'Content-Type': 'application/json', + }, + }) + + if (response.ok) { + const { receivedAmount } = JSON.parse(response.json()) + const { amount, assetCode, assetScale } = receivedAmount + console.log(`Received ${assetCode}${amount / Math.pow(10, assetScale)}.`) + } +} +``` + + + +// #### incomingPayment browser compatibility + + + + + +#### Specifications + + + +### paymentPointer + +The `paymentPointer` property returns the URL that represents the payment pointer or wallet address that the payment was sent to. In most cases, the value will be the same as the `href` URL in the monetization ``. + +:::note[Property name] +Earlier versions of the Web Monetization specification only used Interledger's Simple Payment Setup Protocol (SPSP), which calls for payment pointers. This is why the property was named `paymentPointer`. + +As of v3, both payment pointers and Open Payments wallet addresses are returned by this property. GitHub issue 439 is opened to discuss changing the property name. +::: + +#### Example using `paymentPointer` + +```js + + +``` + + + +// #### paymentPointer browser compatibility + + + + + +#### Specifications + + + +## Example use cases + +### amountSent + +Program your website to show a thank you message to your site visitor when the `amountSent` returns a non-zero amount. In this use case, you're only checking that an amount -- any amount -- was sent. + +### incomingPayment + +Program your website to remove ads or provide access to exclusive content to your site visitor after receiving a specific amount. + +In this use case, you'll query the URL returned by `incomingPayment` to track the `receivedAmount`. If appropriate, you can ensure the amount is increasing after each `monetization` event to verify that a new payment was received. + +### paymentPointer + +This section describes two use cases: one for vanity payment addresses and one for probabilistic revenue sharing. + +#### Vanity payment address + +Let's say your payment pointer or wallet address is: + +``` +https://wallet.example.com/GK9D420BL42M +``` + +That's hard to remember. Fortunately, your wallet provider offers vanity addresses which act as aliases. Your vanity address is: + +``` +https://wallet.example.com/bob +``` + +You add the vanity address as the `href` value in the monetization ``. Then, you set up an event listener for `paymentPointer`. The value that's returned will be: + +``` +https://wallet.example.com/GK9D420BL42M +``` + +#### Probabilistic revenue sharing + +For this use case, let's assume you are familiar with [probabilistic revenue sharing](/experiment/guides/revenue-sharing), which is iteself an advanced use case. + +When you use our Probabilistic Revshare Generator, you enter multiple payment pointers and/or wallet addresses and assign each one a weight. When finished, the generator creates a unique URL. + +For example, after entering five wallet addresses and weights, the generator creates: + +```http wrap +https://webmonetization.org/api/revshare/pay/W1siJGFsaWNlLndhbGxldC5jb20iLDUwLCIkYWxpY2" +``` + +You add the generated URL as the `href` value in the monetization ``. Then, you set up an event listener for `paymentPointer`. The value that's returned will be which one of the five wallet addresses that the payment was sent to. \ No newline at end of file diff --git a/src/content/docs/experiment/guides/contribution-counter.mdx b/src/content/docs/experiment/guides/contribution-counter.mdx new file mode 100644 index 00000000..01cd36b4 --- /dev/null +++ b/src/content/docs/experiment/guides/contribution-counter.mdx @@ -0,0 +1,128 @@ +--- +title: Show visitors how much they've contributed +--- + +import Wallet from "/src/partials/wallet-prereq.mdx"; +import Disclaimer from "/src/partials/glitch.mdx"; + +This guide describes how to display a counter on your page to show your visitors how much they've contributed while on the page during their current browsing session. The counter updates in real time and reflects both time-based payments (e.g., X amount per minute) and one-time payments. + +### Before you begin + + + +## User experience + +For visitors without Web Monetization, the counter will show 0.00. + +For visitors with Web Monetization, the counter will update based on the amount sent during the current browsing session. The counter resets to 0.00 when your visitor: + +* Closes the tab, browser window, or browser. +* Clicks a link or performs some other action that redirects the visitor to another page. This includes navigating backward or forward. +* Refreshes the page. + +## Example + +This example illustrates how to use the `monetization` event to show a web monetized visitor how much they've sent in USD. + +### The code + +```html + + + + + + + + +

+ Thanks for contributing + 0.00 USD + +

+ +``` + +### How it works + +We’ll bind the `monetization` event if the visitor is web monetized (`window.MonetizationEvent` is defined). + +The `monetization` event contains details about the payments that occur. The `amountSent` attribute of the event returns the amount (`value`) and `currency` code of the sent payment. A currency code is a three-letter code, like USD, EUR, or GBP. + +```javascript {1,6} + if (window.MonetizationEvent) { + const link = document.querySelector('link[rel="monetization"]'); + + link.addEventListener("monetization", (event) => { + const { + amountSent: { value, currency }, + } = event; + console.log(`Browser sent ${currency} ${value}.`); +``` + +The `currency` code is set on the visitor's first payment and doesn’t change. The code represents the sender's currency which may be different from the currency you receive (depending on the currency you chose when setting up your wallet account). + +```javascript +// initialize currency on first progress event +if (total === 0) { + document.getElementById('currency').innerText = currency +} +``` + +The amount in `value` is an integer, which we add to the total. + +```javascript +total += Number(value) +``` + +Lastly, we tell the text on your page to update with the new total. The total should be in a human-readable format, so we need to convert the number to a string and round it to a specified number of decimals. This example uses `9`. + +```javascript +document.getElementById('total').innerText = total.toFixed(9) +``` + +The formatted version of the amount gets written to the `total` span on the page. + +```html {4} + +

+ Thanks for contributing + 0.00 USD + +

+ +``` + +### Interactive example + +This example simulates showing a visitor how much they've sent you based off how long they remain on your web monetized page. + + + + \ No newline at end of file diff --git a/src/content/docs/experiment/guides/remove-content.mdx b/src/content/docs/experiment/guides/remove-content.mdx new file mode 100644 index 00000000..8bd6582f --- /dev/null +++ b/src/content/docs/experiment/guides/remove-content.mdx @@ -0,0 +1,134 @@ +--- +title: Remove content for paying visitors +--- + +import Wallet from "/src/partials/wallet-prereq.mdx"; +import Disclaimer from "/src/partials/glitch.mdx"; + +This guide describes one way you can remove content for paying visitors after the `monetization` event fires. The event only fires after an outgoing payment request is successfully created. If the event doesn't fire, then the content will remain visible on your page. + +### Before you begin + + + +## User experience + +For visitors without Web Monetization, your content appears as soon as your page loads. + +For visitors with Web Monetization, there's a three-second grace period before your content appears. This gives Web Monetization a chance to initialize and prevents the content from briefly appearing to paying visitors. + +**If Web Monetization:** + +* Initializes within the grace period, the content is hidden +* Fails to initialize within the grace period, the content is shown +* Initializes any time after the grace period, the content is hidden + +## Example use case: Remove ads + +In this example, you'll give your paying visitors an ad-free experience by preventing the ad from loading on the page once Web Monetization initializes. + +Assuming Web Monetization initializes within the grace period, neither the ad nor any related images and/or trackers (which aren't part of this example) are loaded onto the page at all. + +### The code + +```html + + + + + + + + + + Here's where your site's content will go! + +``` + +### How it works + +Let’s start with the code for showing your ad. + +```javascript +const adCode = + '
Ad! Buy product A! Ad!
' +function showAds() { + document.getElementById('ad').innerHTML = adCode +} +``` + +We'll bind the `monetization` event to its respective event handler if the visitor is web monetized. This prevents the ad from loading on the page once Web Monetization initializes. Assuming it initializes within the grace period, the ad isn’t added to the page at all. This means any related images and trackers aren’t loaded either. + +The `hasPaid` variable in the timer is for when/if Web Monetization starts after the grace period. + +```javascript {1} +let hasPaid = false +if (window.MonetizationEvent) { + const link = document.querySelector('link[rel="monetization"]') + link.addEventListener('monetization', () => { + hasPaid = true + removeAds() + }) +} +``` + +As soon as the page loads, the ad will immediately appear to any visitor who isn’t web monetized. This is handled via `!window.MonetizationEvent`, shown below. + +```javascript {2} +window.addEventListener('load', () => { + if (!window.MonetizationEvent) { + showAds() + } else { + setTimeout(() => { + if (!hasPaid) { + showAds() + } + }, 3000) + } +}) +``` + +If the visitor has Web Monetization in their browser, then the `monetization` event must fire within 3 seconds (3000ms) to indicate that Web Monetization has initialized. If it doesn’t initialize by the timeout, the ad is shown to the visitor. + +### Interactive example + +This example simulates showing and hiding an ad based on a visitor’s Web Monetization state. + + + + \ No newline at end of file diff --git a/src/content/docs/experiment/guides/revenue-sharing.mdx b/src/content/docs/experiment/guides/revenue-sharing.mdx new file mode 100644 index 00000000..e5ff6e7f --- /dev/null +++ b/src/content/docs/experiment/guides/revenue-sharing.mdx @@ -0,0 +1,89 @@ +--- +title: Set up probabilistic revenue sharing +--- + +import { LinkOut } from "@interledger/docs-design-system"; +import Wallet from "/src/partials/wallet-prereq.mdx"; +import Disclaimer from "/src/partials/glitch.mdx"; + +Probabilistic revenue sharing is a way for a monetized page's total revenue to be split between multiple wallet addresses/payment pointers based on the probability of one address being chosen over the others on each page load. + +Why take this approach? First, the monetization `` element itself only supports one URL as the `href` value. Second, although your page can contain multiple monetization links, there are a [few reasons](/experiment/link-element#multiple-monetization-links) why some of the links might not be monetized. + +Probabilistic revenue sharing works by choosing from a list of predefined wallet addresses/payment pointers in URL format each time a web monetized visitor loads your page. Payments are sent to the chosen address until the visitor reloads or closes the page. + +The chance of and address being chosen is based on its assigned weight. For example, if Alice’s address has a weight of 50 (out of 100), then her address has a 50% chance of being chosen. The laws of probability state that Alice’s share of the page’s total revenue will approach 50% as more web monetized visitors access the page. + +This guide presents two ways in which to set up probabilistic revenue sharing. The first is by adding a [script](#example-dev-scenario-use-a-script) to your page. If you'd prefer to not use a script, you can use our [generator](#example-dev-scenario-use-the-probabilistic-revshare-generator). + +### Before you begin + + + +## User experience + +Probabilistic revenue sharing does not affect the user experience for your web monetized visitors. + +## Example dev scenario: Use a script + +In this scenario, you'll set up probabilistic revenue sharing via a script. For simplicity, the total amount of the assigned weights equal 100. + +### The code + +```html + + + +``` + +### Interactive example + +This example shows how the random choices will approach the correct percentages over enough tries. You can customize the number of times to randomly choose a pointer and it will show you the results. + +The example doesn’t require you to have Web Monetization enabled in your browser and no real payments are occurring. + +If source files appear instead of the example, click **View App** in the bottom-right corner. + + + +## Example dev scenario: Use the Probabilistic Revshare Generator + +As an alternative to including a script in your page, you can use our Probabilistic Revshare Generator. + +Follow the instructions on the page to generate a monetization `` element that contains a unique URL hosted on `webmonetization.org`. Then, include monetization link on each page you want to web monetize. \ No newline at end of file diff --git a/src/content/docs/experiment/guides/show-content.mdx b/src/content/docs/experiment/guides/show-content.mdx new file mode 100644 index 00000000..5831d763 --- /dev/null +++ b/src/content/docs/experiment/guides/show-content.mdx @@ -0,0 +1,206 @@ +--- +title: Show content to paying visitors +--- + +import Wallet from "/src/partials/wallet-prereq.mdx"; +import Disclaimer from "/src/partials/glitch.mdx"; + +This guide describes one way you can show otherwise hidden content to paying visitors after the `monetization` event fires. The event only fires after an outgoing payment request is successfully created. If the event doesn't fire, then the content will remain hidden on your page. + +### Before you begin + + + +## User experience + +For visitors without Web Monetization, your content is always hidden. + +For visitors with Web Monetization, your content appears; however, there's a three-second grace period. This gives Web Monetization a chance to initialize. + +**If Web Monetization:** + +* Initializes within the grace period, the content remains visible +* Fails to initialize within the grace period, the content is hidden +* Initializes any time after the grace period, the hidden content becomes visible + +## Example use case: Show exclusive content + +In this example, you'll give your paying visitors access to exclusive content. + +### The code + +```html + + + + + + + + + + +

Content will appear below here for web monetized visitors.

+
+ + +``` + +### How it works + +First, we'll check whether Web Monetization is supported. We do this by calling `supports()` on a link element’s `relList` and passing `"monetization"` as a parameter. If this check doesn’t exist, we can’t listen for the `monetization` event to tell us when Web Monetization initializes. + +```javascript +const link = document.querySelector('link[rel="monetization"]') +if (link.relList.supports('monetization')) { +``` + +Next, we'll add an event listener to the `link` element. The `monetization` event emits when Web Monetization initializes. + +```javascript +link.addEventListener('monetization', (ev) => { +``` + +Finally, we'll select the exclusive content element we want to make available to web monetized visitors. Since we defined a CSS class to hide the content, removing the class will make the content appear. + +```javascript +document.getElementById('exclusive').classList.remove('hidden') +``` + +### Interactive example + +This example simulates showing and hiding exclusive content based on a visitor’s Web Monetization state. + + + + + +## Example use case: Show an indicator and exclusive content + +In this example, you'll not only give your paying visitors access to exclusive content, but also: + +* Show web monetized visitors an indicator while they wait for Web Monetization to initialize +* Tell non-web monetized visitors that there’s exclusive content they’re missing out on + +### The code + +This example contains three states: + +* A call-to-action for non-web monetized visitors +* A loading message for web monetized visitors +* Exclusive content for web monetized visitors + +```html + + + + + + + + + + + + + +

This is content that everyone can see.

+ +``` + +### How it works + +There are three functions to activate the three states: + +* `showLoading` displays the loading message +* `showCTA` displays the call-to-action for non-web monetized users +* `showExclusiveContent` displays exclusive content to web monetized users + +When the page loads, we’ll check whether the visitor is web monetized. + +```javascript +window.addEventListener('load', () => { + if (!window.MonetizationEvent) { +``` + +The loading message will appear to web monetized visitors and the CTA will appear to everyone else. + +```javascript +if (!window.MonetizationEvent) { + showCTA() +} else { + showLoading() +} +``` + +If the visitor is web monetized, we’ll listen for the `monetization` event that occurs when an outgoing payment request is successfully created. If the event fires, the exclusive content will appear (`
`) and the other divs will be hidden (`
` and `
`) + +```javascript +if (window.MonetizationEvent) { + const link = document.querySelector('link[rel="monetization"]') + link.addEventListener('monetization', (ev) => { + showExclusiveContent() +``` + +### Interactive example + +This example simulates hiding and showing exclusive content based on a visitor’s Web Monetization state. Web monetized visitors will see exclusive content while non-web monetized users will not. Conversely, non-web monetized users will see the message, “Please install a Web Monetization extension to support me!“. + + + + diff --git a/src/content/docs/experiment/guides/test-web-monetization.mdx b/src/content/docs/experiment/guides/test-web-monetization.mdx new file mode 100644 index 00000000..99113f3b --- /dev/null +++ b/src/content/docs/experiment/guides/test-web-monetization.mdx @@ -0,0 +1,3 @@ +--- +title: Test Web Monetization +--- \ No newline at end of file diff --git a/src/content/docs/experiment/how-payments-work.mdx b/src/content/docs/experiment/how-payments-work.mdx new file mode 100644 index 00000000..b56828b9 --- /dev/null +++ b/src/content/docs/experiment/how-payments-work.mdx @@ -0,0 +1,213 @@ +--- +title: How payments work +--- + +import { LinkOut, CodeBlock, Disclosure } from "@interledger/docs-design-system"; +import { Badge, Tabs, TabItem, Steps } from '@astrojs/starlight/components'; + +## Digital wallets + +To receive (and send) payments, you must have an account with a compatible digital wallet. Not all digital wallets support receiving payments with Web Monetization. + +A digital wallet is the entity that supplies you with the financial account you’ll use to receive payments. Withdrawing your funds typically requires you to link a card or bank account to your wallet. + +Since wallet providers are a type of financial entity, they are regulated within the countries they operate. One type of regulation, known as KYC (Know Your Customer), requires such entities to collect personal information and verify your identity before allowing you to open an account. + +## Web Monetization-compatible digital wallets + +You must have an account with a [compatible digital wallet](/resources/wallets) to receive payments. Be sure to select a wallet that: + +* Is available in your region +* Supports your preferred currency +* Allows you to withdraw your funds if you choose to transact in fiat + +Your wallet provider will assign your account a unique identifier called either a *payment pointer* or a *wallet address*. This identifier is kind of like an account name. It is publicly shareable and you will need it when web monetizing your content. + +The format of the identifier depends on whether your wallet provider assigned you a payment pointer or a wallet address. + +| Identifier name | Example format | +| ------- | -------------- | +| Payment pointer | `$wallet.example.com/alice` | +| Wallet address | `https://wallet.example.com/alice` | + + +## Web monetized content + +Once you have your payment pointer or wallet address, you're ready to add the Web Monetization `` element to each page of your site you want to monetize. Visit the [quick start guide](/experiment/quick-start) for more information. + +When you include the `` element on a page, you're telling your visitors' browsers that you can accept payments. Visitors who have installed and configured the [Web Monetization extension](/support/use-extension) can then choose to send you payments in the amount and frequency of their choosing. + +## Payments + +Your visitors' Web Monetization extension acts like a messaging service. When they land on your page, their extension identifies your `` element and sends a message to your payment URL. This begins a number of API requests and responses between the extension and your wallet provider, and the extension and your visitor's wallet provider to facilitate a payment. + +### Micropayments + +If you're already somewhat familiar with Web Monetization, you may have heard about how it supports micropayments. + +In general, a micropayment is a very small payment. Each wallet provider is responsible for a few things: +* Deciding whether to support sending and/or receiving micropayments +* Defining what a micropayment is in the context of their business + +Let's say your wallet provider allows you to receive micropayments and defines a micropayment as any payment under $0.05 USD. This means that you could receive a single payment of, for example, one US cent. Web Monetization is designed to facilitate payments of even a fraction of a cent; however, you can only receive micropayments if your wallet provider supports them. Your wallet provider may also have business rules set up to allow you to accumulate micropayments, but not deposit the payments into your wallet account until you reach a certain amount. + +On the other side of a transaction, your site visitor can only send micropayments if allowed to do so by their own wallet provider. + +### A deeper dive into payments + +#### Open Payments + +For a wallet to be compatible with Web Monetization, the provider must implement the Open Payments standard. When implemented, a set of APIs become available for third-party applications, such as your visitor's [Web Monetization extension](/support/use-extension), to communicate with the wallet provider. + +#### Web Monetization extension + +A component within the extension--called the [Web Monetization agent](/experiment/link-element#web-monetization-agent)--is responsible for communicating with a wallet provider via the Open Payments APIs. The next section describes the series of API calls required to initiate a payment. + +#### Web Monetization payment sequence + +:::note +The examples below are simplified representations of the Open Payments API calls and may not show every required parameter. +::: + + +1. The Web Monetization agent locates your [monetization link](/experiment/link-element) and extracts your payment URL (the `href` value). + + ```html + + ``` + +2. The agent issues a request to the URL. + + ```http + GET /alice HTTP/1.1 + Accept: application/json + Host: wallet.example + ``` + +3. The response to the agent contains information such as the currency your account is denominated in and the URLs for your wallet provider's authorization and resource servers. + + ```http + HTTP/1.1 200 Success + Content-Type: application/json + + { + "assetCode": "USD", + "assetScale": 2, + "authServer": "https://wallet.example/auth", + "resourceServer": "https://wallet.example/resource" + } + ``` + +4. The agent issues a request to your wallet provider's `authServer` URL. The request contains the access permissions the agent is requesting. + + ```http + POST /auth/ HTTP/1.1 + Accept: application/json + Content-Type: application/json + Host: wallet.example + + { + "access_token": { + "access": [ + { + "type": "incoming-payment", + "actions": ["create", "read"], + "identifier": "https://wallet.example/alice" + } + ] + }, + "client": "https://cloudninewallet.example/visitor" + } + ``` + :::note + The `client` in the response above is your visitor's wallet address/payment pointer. This URL is only used by the agent and is not available to you. + ::: + +5. The response to the agent contains an access token that the agent needs to make its next request. + + ```http wrap + { + "access_token": { + "value": "OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0", + "manage": "https://wallet.example/auth/token/dd17a202-9982-4ed9-ae31-564947fb6379", + "access": [ + { + "type": "incoming-payment", + "actions": ["create", "read"], + "identifier": "https://wallet.example/alice" + } + ] + } + } + ``` + +6. The agent issues a request to your wallet provider's `resourceServer` URL. The purpose of this call is to request the information needed by your visitor's wallet provider so their provider correctly addresses the payment to you. + + ```http + POST /alice/incoming-payments HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: OS9M2PMHKUR64TB8N6BW7OZB8CDFONP219RP1LT0 + Host: wallet.example + ``` + +7. The response to the agent contains unique payment details that will be used to address the payment to your payment account. + + ```http wrap + { + "id": "https://wallet.example/alice/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c", + "walletAddress": "https://wallet.example/alice", + "receivedAmount": { + "value": "0", + "assetCode": "USD", + "assetScale": 2 + }, + "completed": false, + "createdAt": "2022-03-12T23:20:50.52Z" + } + ``` + +8. At this point, the agent has finished communicating with your wallet provider. Now, the agent issues a request to your visitor's wallet provider. The purpose of this call is to give your visitor's wallet provider what it needs to send the payment. + + ```http wrap + POST /visitor/outgoing-payment HTTP/1.1 + Accept: application/json + Content-Type: application/json + Authorization: {{ GNAP outgoingPaymentGrant.accessToken.value }} + Host: cloudninewallet.example + + { + "walletAddress": "https://wallet.example/alice", + "quoteId": "https://wallet.example/quotes/ab03296b-0c8b-4776-b94e-7ee27d868d4d", + } + ``` + +9. The response from your visitor's wallet provider indicates whether the outgoing payment was created on their side. A payment could fail if the visitor has insufficient funds, for example. The following example indicates the outgoing payment was successfully created. + + + ```http wrap + { + "id": "https://cloudninewallet.example/visitor/outgoing-payments/8c68d3cc-0a0f-4216-98b4-4fa44a6c88cf", + "walletAddress": "https://cloudninewallet.example/visitor/", + "receiver": "https://wallet.example/alice/incoming-payments/08394f02-7b7b-45e2-b645-51d04e7c330c", + "receiveAmount": { + "value": "2", + "assetCode": "USD", + "assetScale": 2 + }, + "debitAmount": { + "value": "2", + "assetCode": "USD", + "assetScale": 2 + }, + "sentAmount": { + "value": "0", + "assetCode": "USD", + "assetScale": 2 + }, + "createdAt": "2022-03-12T23:20:55.52Z", + "updatedAt": "2022-03-12T23:20:55.52Z" + } + ``` + + \ No newline at end of file diff --git a/src/content/docs/docs/resources/libraries.mdx b/src/content/docs/experiment/libraries.mdx similarity index 100% rename from src/content/docs/docs/resources/libraries.mdx rename to src/content/docs/experiment/libraries.mdx diff --git a/src/content/docs/experiment/link-element.mdx b/src/content/docs/experiment/link-element.mdx new file mode 100644 index 00000000..b7134ee0 --- /dev/null +++ b/src/content/docs/experiment/link-element.mdx @@ -0,0 +1,136 @@ +--- +title: Monetization element +tableOfContents: + maxHeadingLevel: 4 +--- + +import { LinkOut, Hidden } from "@interledger/docs-design-system"; +import Specification from '/src/components/docs/Specification.astro' +import BrowserCompat from '/src/components/docs/BrowserCompat.astro' +import data from '/src/data/browser-compat-data/link.json' +import { Steps, Tabs, TabItem, Badge } from '@astrojs/starlight/components'; + + + +From a creator/developer perspective, the monetization `` element is one of the two key pieces to web monetizing a page. The second piece is a wallet address/payment pointer. + +## Prerequisites + +To web monetize an HTML page, such as a web page: +* You must have an account with a [compatible wallet provider](/resources/wallets) +* You must have the wallet address, or payment pointer in URL format, from your wallet provider +* Your document must be served over HTTPS + +## Monetization `` element + +The monetization `` element is what indicates your HTML page supports Web Monetization. + +### Syntax + +```html + +``` + +* The `rel` attribute is always `monetization` +* The `href` attribute equals your wallet address or your payment pointer in URL format + +For example: + +```html + +``` + +### Placement + +A monetization `` is `body-ok`, meaning it's allowed in your page's `` and/or ``. + +### Multiple monetization links + +An HTML page can contain multiple monetization `` elements; however, your site visitor’s [Web Monetization agent](#web-monetization-agent) could be designed to handle multiple links in a particular way. For example, an agent might: +* Split payments evenly between all links +* Split payments between the first few links it finds +* Send the amount only to the first link it finds and ignore all others + +:::tip[Recommendation] +The Web Monetization agent built into the Interledger Foundation's extension splits payments evenly between all links. We recommend other extension developers follow this approach. +::: + +### Iframes + +Nested browsing contexts (iframes) can contain monetization `` elements; however, your site visitor's [Web Monetization agent](#web-monetization-agent) determines how iframes are monetized. A few examples of how a Web Monetization agent can monetize iframes include: + +* Splitting payments evenly between all monetization links within both the parent and the iframe +* Splitting payments evenly between all monetization links in the parent and the first monetization link it finds in the iframe's ``, while ignoring any other monetization links in the iframe + :::note + This is the approach used in the Interledger Foundation's extension. + ::: +* Sending payments to the first monetization link it finds in the parent browsing context and ignoring all other monetization links in the parent and the iframe + +### Audio, video, and picture elements + +The following HTML elements can be web monetized by adding the `` element between the open and close tags. + + + + ```html + + ``` + + + ```html + + ``` + + + ```html + + + + ``` + + + +## How it works + +### HTMLLinkElement + +The HTML DOM API's `HTMLLinkElement` interface defines how the `` element functions. The `` element is what allows you to link your HTML page to a resource. + +The two most recognizable `HTMLLinkElement` properties are `href` and `rel`. The `href` property defines the URL to the resource. The `rel` property indicates the type of link, or relationship, the resource has to the current page. + +### rel="monetization" link type + +Browsers already know how to interpret certain `rel` values because of web standards. One such standard is `stylesheet`. When a browser loads a page that contains ``, the browser automatically knows to import a style sheet from the given URL. + +The `monetization` link type, however, is not yet a standard. Major web browsers don't automatically know what to do when encountering this link type in a page. Until `monetization` becomes a standard, browsers must rely on a Web Monetization agent. + +### Web Monetization agent + +A Web Monetization agent is a non-user facing component of the Interledger Foundation's extension. + +The purpose of the Web Monetization agent is to recognize when a page is web monetized and automatically carry out certain tasks. These tasks include: + +* Extending the HTML DOM API so that `monetization` is a valid link type +* Processing the monetization link or links within an HTML page +* Instrumenting payments by calling the [Open Payments APIs](/experiment/how-payments-work#a-deeper-dive-into-payments), which are APIs implemented by wallet providers +* Firing [`monetization`](/experiment/events) events after an outgoing payment is created +* Processing `monetization` events sent to the browser window via the `onmonetization` event handler +* Enabling the CSP [`monetization-src`](/experiment/csp) and Permissions Policy [`monetization`](/experiment/permissions-policy) directives + +Until Web Monetization agents are natively built in to web browsers, an agent must be added to browsers in some other way. That's why the agent is included as part of the Interledger Foundation's extension. + + + +// ## Browser compatibility + + + + + +## Specifications + + \ No newline at end of file diff --git a/src/content/docs/experiment/overview.mdx b/src/content/docs/experiment/overview.mdx new file mode 100644 index 00000000..311fb06a --- /dev/null +++ b/src/content/docs/experiment/overview.mdx @@ -0,0 +1,60 @@ +--- +title: Overview +tableOfContents: + maxHeadingLevel: 2 +--- + +import { LinkOut } from '@interledger/docs-design-system' + +Web Monetization is a light-weight and non-intrusive way for you to monetize your content while preserving the privacy of your supporters. You can use Web Monetization to replace or complement your existing revenue models. All it takes is a [wallet address or payment pointer](/resources/wallets) and a [single line of code](/experiment/link-element). + +## Benefits + +### You choose your wallet provider. + +Other solutions may require both you and your supporters to use the same application, platform, or service provider. Web Monetization doesn't have this limitation. As long as both you and your supporters' chosen wallet providers are compatible with Web Monetization, they can send you a payment. + +### Complement existing revenue models. + +* **Reach a wider paying audience.** Some offerings, such as subscriptions, can result in missed revenue opportunities due to concerns about price, renewal frequencies, accepted currencies, and fees. Plus, some supporters simply don't want to create and keep track of another account. Web Monetization can be used to supplement your current offerings by allowing your supporters to pay how, when, and what they want without creating site-by-site accounts. +* **Regain lost ad revenue.** If your site is even partially sustained by ad revenue, then every impression counts. Many ad networks pay per thousand impressions, pay different amounts based on the country your supporter is in, and may require you to earn a minimum amount before you can access your revenue. While ad blockers can improve user experience, they also make earning ad revenue more difficult. Web Monetization can help make up the difference. + +### Use in place of other revenue models. + +Certain recurring revenue models, like subscriptions, can have overhead costs beyond the time, effort, and money required for set up. For example, you may be required to provide customer support, manage chargebacks, and administer records through various Content Management System (CMS) tools. With Web Monetization, payments are anonymous. There are no customer records to maintain. You aren't liable for chargebacks or refunds because your supporters are in control of if, when, and how much they pay. + +### Receive payments to your wallet in real time. + +Some services require you to wait until a given day of the month or until you reach a minimum balance before paying out. Should a platform temporarily or permanently ban you, the platform could choose to keep your balance permanently. Web Monetization removes this issue. When a supporter sends you a payment, the payment is sent directly from their wallet to your wallet. Note that your wallet provider may require you reach a specific balance before you can transfer out your funds. Be sure to check with your wallet provider. + +### Receive payments in your preferred currency. + +Some solutions require both you and your supporters to use the same currency. Web Monetization allows you to receive payments in a currency of your choosing, while your supporters can send payments in their preferred currency. + +### The exclusivity of your content is in your hands. + +Web Monetization allows a supporter to send a payment to a web monetized page. How you want your page to respond is up to you. By listening for the `monetization` event, you can verify the amount and currency of a payment, then programmatically show or hide content or have your page respond in some other way. + +## Constraints + +### The network of Web Monetization-enabled wallet providers is nascent, but growing. + +Sending and receiving payments via Web Monetization requires the sender and the recipient to have an account with a Web Monetization-enabled wallet provider. + +In general, wallet providers are regulated entities within the countries they operate. Obtaining the proper licensing and registration to become a wallet provider can be an expensive, complex, and time consuming process. In addition, there are technical integrations required to support Web Monetization. All of this means a compatible wallet provider may not yet be available in your area. + +### Web Monetization does not track or collect personally identifiable information. + +Web Monetization is designed to preserve the privacy of your supporters. While you can use `monetization` events to determine sent and received amounts, Web Monetization does not track your supporters' names, wallet addresses/payment pointers, IP addresses, or other information that could enable you to correlate a payment with a specific individual or determine their browsing behavior. + +### Web Monetization does not allow you to initiate payments from your supporters' accounts. + +One key differentiator of Web Monetization is that your supporters retain control over if, when, and how much they pay. Web Monetization does not allow you to initiate a payment on behalf of your supporters. When you web monetize a page, you are embedding your wallet address/payment pointer so that your supporters' extension knows you're able to accept Web Monetization payments. It's up to your supporters to decide whether to pay. + +### Coding your page to respond after receiving a specific amount will take some work. + +Web Monetization is designed to allow supporters to control when to pay, how much to pay, and how often to pay. If you want to, for example, unlock exclusive content after receiving a specific amount, you'll need to add your own code to make that happen. + +### There might be fees. + +Web Monetization does not charge or collect fees; however, your digital wallet provider might. For example, you may be charged a currency conversion fee if you are sent a payment in USD, but receive your payments in GBP. Be sure to consider supported currencies and fees when choosing a wallet provider that's best for you. \ No newline at end of file diff --git a/src/content/docs/experiment/permissions-policy.mdx b/src/content/docs/experiment/permissions-policy.mdx new file mode 100644 index 00000000..dda4d048 --- /dev/null +++ b/src/content/docs/experiment/permissions-policy.mdx @@ -0,0 +1,52 @@ +--- +title: Permissions Policy +--- + +import { LinkOut, Hidden } from "@interledger/docs-design-system"; +import Specification from '/src/components/docs/Specification.astro' +import BrowserCompat from '/src/components/docs/BrowserCompat.astro' +import data from '/src/data/browser-compat-data/permissionpolicy.json' + +A Permissions Policy provides a mechanism for you to explicitly declare what functionality can and cannot be used on your website. + +The `monetization` policy directive allows you to enable and disable the Web Monetization API within a document and within any of the document's nested browsing contexts (iframes). + +## Syntax + +```http +Permissions-Policy: monetization=(allowlist) +``` + +Where `(allowlist)` is a list of origins permitted to use the Web Monetization API. + +The default allowlist is `self`. + +```http +Permissions-Policy: monetization=(self) +``` + +:::note +The `allow` attribute determines the container policy that will be used when the permissions policy for a `Document` in the iframe's content navigable is initialized. Adding or removing the `monetization` attribute has no effect on an already-loaded `Document`. +::: + +## Example + +You want to allow Web Monetization on your website and in all nested browsing contexts (iframes) in the same origin. + +You configure your web server to return the `Permissions-Policy` HTTP header on each of your pages. + +```http +Permissions-Policy: monetization=(self) +``` + + + +// ## Browser compatibility + + + + + +## Specifications + + \ No newline at end of file diff --git a/src/content/docs/experiment/quick-start.mdx b/src/content/docs/experiment/quick-start.mdx new file mode 100644 index 00000000..196d9284 --- /dev/null +++ b/src/content/docs/experiment/quick-start.mdx @@ -0,0 +1,62 @@ +--- +title: Web monetize a page +--- + +import { LinkOut } from '@interledger/docs-design-system' +import { Steps } from '@astrojs/starlight/components'; +import Wallet from "/src/partials/wallet-prereq.mdx"; + +## Prerequisites + + + +## Step 1 - Get your payment URL + +### Payment pointer + +If you have a payment pointer that starts with `$`, visit paymentpointers.org. Enter your payment pointer into the _Payment Pointer_ field. Take note of the URL that automatically generates in the adjacent field. This is your payment URL. You'll need it in the next step. + +```http +$wallet.example.com/alice +``` + +### Wallet address + +If you have a wallet address that starts with `https://`, then you have your payment URL. Proceed to the next step. + +```http +https://wallet.example.com/alice +``` + + + +## Step 2 - Web monetize your page + + + +1. Create your Web Monetization link tag using the format below. Add your payment URL as the `href` value. + + ```http + + ``` + + For example: + + ```http + + ``` + +2. Add the `` to the `` section of your page. + ```html title="Example" + + + My Site + + + + ``` + + +Congratulations! Your page is now web monetized. Add the `` to any page of your site you want to monetize. + +For more information, visit the [Monetization link element](/experiment/link-element) page. \ No newline at end of file diff --git a/src/content/docs/experiment/wmapi-interfaces.mdx b/src/content/docs/experiment/wmapi-interfaces.mdx new file mode 100644 index 00000000..155dbb33 --- /dev/null +++ b/src/content/docs/experiment/wmapi-interfaces.mdx @@ -0,0 +1,65 @@ +--- +title: Monetization interfaces +--- + +import { LinkOut, Hidden } from "@interledger/docs-design-system"; +import { Badge } from '@astrojs/starlight/components'; +import Specification from '/src/components/docs/Specification.astro' +import BrowserCompat from '/src/components/docs/BrowserCompat.astro' +import data from '/src/data/browser-compat-data/monetizationevent.json' + + + +The Web Monetization API consists of two interfaces: `MonetizationEvent` and `MonetizationCurrencyAmount`. + +## `MonetizationEvent` + +The `MonetizationEvent` interface describes the [`monetization`](/experiment/events) event that fires when an outgoing payment is successfully created. + + + + + + + + + + + + + + +
BubblesYes
CancelableNo
Event handler property`onmonetization`
+ +By listening for `monetization` events, you can use the information returned in the following properties to verify payments. + +* [amountSent](/experiment/events#amountsent) - The currency amount and code of the sent payment. Contains two variables, `value` and `currency`, constructed by the [`MonetizationCurrencyAmount`](#monetizationcurrencyamount) interface. +* [incomingPayment](/experiment/events#incomingpayment) - A URL you can use to determine if a payment was received and, if so, the amount received. +* [paymentPointer](/experiment/events#paymentpointer) - The URL of the payment pointer or wallet address that the incoming payment request was sent to. + +Visit the [Monetization Events](/experiment/events) page for more information. + + + +// ## Browser compatibility + + + + + +### Specifications + + + +## `MonetizationCurrencyAmount` + +The `MonetizationCurrencyAmount` interface is used to populate the `value` and `currency` variables contained within the `MonetizationEvent amountSent` property. + +* Value - The amount. A valid decimal monetary value containing the amount that was sent. +* Currency - The currency code. An ISO 4217-compliant currency code, when possible, that represents the currency that was sent, such as USD or GBP. + +The `MonetizationCurrencyAmount` interface is modeled on the Payment Request API’s `PaymentCurrencyAmount` dictionary. + +### Specifications + + \ No newline at end of file diff --git a/src/content/docs/fr/docs.mdx b/src/content/docs/fr/docs.mdx deleted file mode 100644 index 9b674f0a..00000000 --- a/src/content/docs/fr/docs.mdx +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: Introduction à la Web Monetization ---- - -import { LargeImg, LinkOut, Tooltip } from '@interledger/docs-design-system' - -En tant qu'utilisateur d'un site web, il est fréquent de tomber sur un titre qui capte l'attention, mais de découvrir que l'article est bloqué derrière un paywall. Combien de fois avez-vous payé un abonnement pour lire un seul article ? Et si vous pouviez payer une fraction du prix de l'abonnement pour accéder à l'article et éviter l'abonnement ? - -En tant que propriétaire d'un site web, vous vous attendez à perdre quelques visiteurs à cause d'un contenu payant. Même si vous proposez des abonnements hebdomadaires, le prix peut être supérieur à ce qu'un visiteur est prêt à payer. Et si, au lieu de proposer des abonnements, vous pouviez générer des revenus par morceau de contenu, ou même en fonction du temps qu'un visiteur passe sur le contenu ? - -Ce ne sont là que deux façons dont la Web Monetization peut faciliter les paiements. Grâce à la Web Monetization, les visiteurs d'un site web peuvent envoyer des paiements directement aux sites web à l'aide d'une extension de navigateur ou de n'importe quel navigateur qui implémente nativement la spécification de Web Monetization. - -## Infrastructure des paiements actuels - -La mise en place de paiements sur un site web peut demander un peu de travail. Si votre site accepte déjà les paiements, vous savez peut-être ce qu'il faut faire pour accepter plusieurs méthodes de paiement et plusieurs devises. Le processus ressemble généralement à ceci : - -1. Vous vous inscrivez auprès d'un ou de plusieurs prestataires de services de paiement, en fonction des méthodes de paiement et des devises que vous souhaitez accepter. -2. Vous intégrez leur(s) service(s) dans votre site. Par exemple, vous pouvez créer et héberger votre propre formulaire de paiement qui est connecté au service, ou vous utilisez un formulaire fourni par le fournisseur de paiement. -3. En fonction de la méthode de paiement que votre visiteur souhaite utiliser, il peut avoir besoin de créer un compte auprès de vous ou du fournisseur de services de paiement. -4. Votre visiteur remplit le formulaire de paiement. Dans l'idéal, il reste sur votre site pour terminer la transaction, mais il peut lui être demandé d'accéder au site du prestataire. - -## Présentation de la Web Monetization - -La Web Monetization (WM) vise à simplifier l'expérience de paiement pour vous et les visiteurs de votre site Web. Il s'agit d'une technologie ouverte qui permet aux sites web de recevoir automatiquement des paiements de la part des visiteurs, grâce au navigateur de ces derniers et à leur fournisseur WM préféré. - -Il s'agit d'une norme proposée qui permet à vos visiteurs de payer le montant de leur choix avec peu ou pas d'interaction avec l'utilisateur. Elle permet à un site web de signaler automatiquement aux navigateurs web qu'il peut accepter les paiements et aux navigateurs web de faciliter le paiement : - -- Obtenir l'autorisation d'initier le paiement. -- Recueillir des informations et donner des instructions pour lancer le processus de transfert de fonds. -- Création d'une session de paiement. -- Communiquer les événements de paiement au site pour qu'il puisse éventuellement y répondre. Par exemple, le site pourrait [supprimer les publicités](/fr/docs/guides/remove-ads) ou fournir [l'accès à un contenu exclusif](/fr/docs/guides/provide-exclusive-content) aux visiteurs payants. - -### Flux à haut niveau - -L'image suivante montre le flux de la Web Monetization à un niveau élevé. Certaines étapes ont été combinées ou exclues. Une explication plus détaillée est fournie dans la page [Flux de la Web Monetisation](/fr/docs/intro/web-monetization-flow). - - - -1. Bob visite une [page monétisé](/fr/docs/guides/monetize-page). L'élément `` de monétisation est la façon dont le site web signale au navigateur qu'il accepte les paiements. -2. Le navigateur de Bob, soit de manière native, soit via une extension du navigateur, analyse l'élément `` pour obtenir l'élément l'adresse du portefeuille pour Alice, propriétaire du site. -3. Le navigateur de Bob ou l'extension, envoie des demandes à l'adresse du portefeuille d'Alice pour obtenir l'autorisation et les instructions nécessaires à l'envoi d'un paiement. -4. Une fois l'autorisation accordée et les instructions de paiement reçues, le navigateur/extension envoie des demandes à l'adresse du portefeuille de Bob pour initier le paiement sortant. -5. Le flux de la Web Monetization se fini. Le traitement des paiements, l'échange de devises et le règlement ont lieu entre les deux comptes par l'intermédiaire d'un rail de paiement commun. - -### Spécification des montants et des devises de paiement - -La Web Monetization ne permet pas à un site web de spécifier un montant ou une devise de paiement. Elle permet seulement au site d'indiquer au navigateur qu'il peut accepter des paiements. - -Avec l'aide d'un fournisseur WM, votre visiteur décide s'il doit effectuer un paiement, combien et à quelle fréquence, et dans quelle devise. Votre récepteur WM peut alors échanger la devise des paiements entrants en fonction de ce que vous souhaitez recevoir. Cette flexibilité vous permet, ainsi qu'à vos visiteurs, de choisir les méthodes de monétisation qui répondent le mieux à vos besoins. - -### Traitement et règlement des paiements - -Le rôle de la Web Monetization est d'aider à coordonner les paiements. Elle ne traite ni ne règle les paiements. - -À chaque extrémité de la Web Monetization se trouve un compte qui prend en charge les Paiements ouverts. Le fournisseur WM fournit à votre visiteur un compte d'envoi financé. Dans certains cas, le visiteur peut même agir comme son propre fournisseur WM. Le destinataire WM vous fournit un compte de réception. - -La Web Monetization communique avec les comptes émetteur et récepteur afin d'obtenir les autorisations et instructions nécessaires à l'envoi et à la réception d'un paiement. Le traitement et le règlement du paiement s'effectuent ensuite entre les comptes émetteur et récepteur, en dehors du flux de la Web Monetisation. - -## Version antérieure de la spécification - -Une nouvelle version de la spécification relative à la Web Monetization a été publiée en juin 2023. Les utilisateurs de la version précédente doivent tenir compte des éléments suivants : - -- La version précédente n'utilisait que le Simple Payment Setup Protocol (SPSP) d'Interledger. La nouvelle version utilise Open Payments. -- L'élément `` est obsolète en faveur de l'élément [``](/fr/docs/references/html-link-rel-monetization/). -- L'élément `` ne supporte pas la forme abrégée d'un pointeur de paiement (par exemple, `$wallet.example/alice`). Vous devez utiliser l'URL du point de terminaison auquel le pointeur de paiement se réfère (par exemple, `https://wallet.example/alice`). Si vous avez besoin d'aide pour convertir un pointeur de paiement en son URL équivalent, entrez votre pointeur de paiement dans le champ de saisie sur paymentpointers.org. Dans la plupart des cas, vous pouvez simplement remplacer le `$` par `https://`. diff --git a/src/content/docs/resources/get-involved.mdx b/src/content/docs/resources/get-involved.mdx new file mode 100644 index 00000000..0e84adad --- /dev/null +++ b/src/content/docs/resources/get-involved.mdx @@ -0,0 +1,45 @@ +--- +title: Get involved +--- + +import { LinkOut } from "@interledger/docs-design-system"; + +## Participation + +* Join our Web Monetization Community calls. +* Begin a new discussion or contribute to existing discussions in the WICG Web Monetization GitHub repo. +* Contribute something you’ve built, open a new issue, or contribute to existing issues in the WICG Web Monetization GitHub repo. +* Suggest changes to the specification by submitting a pull request. For more details about spec contributions and development, visit contributing.md. + +## Coding + +* Update the existing Web Monetization v1 [tools/libraries](/experiment/libraries/) to the latest spec. +* Create new Web Monetization tools/plugins for frameworks and libraries. +* Build applications with new and varied use cases around Web Monetization. For example, you could: + * Add Web Monetization to your favorite open source project. + * Create tools to allow websites to interact with web monetized visitors. Visual indicators, like celebration confetti, thank you notes, or payment counters are just a few ways to promote interaction. +* Contribute to the ILF’s Web Monetization extension by coding or testing. + +## Community events and hackathons + +* Join us at the Interledger Summit and participate in our annual hackathon. +* Organize your own hackathons, coding sprints, and installa-thons, both online and offline. Run campaigns and encourage participants to develop, collaborate on, and test projects. + +## Localization + +* Translate and localize the [Intro to Web Monetization page](/docs/) into one of the following languages: + * Arabic + * Chinese + * French + * German + * Japanese + * Portuguese + * Spanish +* Review translated and localized content. + +## Documentation + +* Contribute to the docs by suggesting additions and improvements. +* Create tutorials and guides to help others in the community work with Web Monetization. + +Review our contribution guide for details. \ No newline at end of file diff --git a/src/content/docs/resources/glossary.mdx b/src/content/docs/resources/glossary.mdx new file mode 100644 index 00000000..994a57cb --- /dev/null +++ b/src/content/docs/resources/glossary.mdx @@ -0,0 +1,92 @@ +--- +title: Glossary +--- + +import { LinkOut } from "@interledger/docs-design-system"; + +## I + +
+ +### Interledger Foundation (ILF) + +The Interledger Foundation (ILF) is a global nonprofit foundation and steward of the Interledger Protocol, the Open Payments standard, and Web Monetization. + +The ILF offers an open source [Web Monetization browser extension](/support/use-extension) that showcases a pay-as-you-browse model, allowing you to define how often and how much to pay to web monetized websites. + +## O + +
+ +### Open Payments + +Open Payments is an open standard for implementation by wallet providers. When implemented, third-party applications, like the Web Monetization extension, can set up payments to and from payment accounts. + +Wallet providers who support Open Payments will issue each of their customers' accounts with a unique ID that's either called a wallet address or a payment pointer. + +## P + +
+ +### Payment pointer + +A payment pointer is a secure, unique identifier that's assigned to payment accounts that use Interledger's Simple Payment Setup Protocol (SPSP) to exchange payment information. The shorthand for a payment pointer starts with `$`. For example, `$wallet.example.com/alice`. + +As a supporter of web monetized content, you'll enter your payment pointer into your Web Monetization extension to link the extension to your account. + +To web monetize your own content, you must convert your payment pointer to its URL equivalent because the monetization `` element does not support the `$` in the `href` value. Enter your payment pointer into the field provided on paymentpointers.org to get your URL. + +## T + +
+ +### Test network + +

The ILF provides...

+ +### Test wallet + +

The ILF provides...

+ +## W + +
+ +### Wallet address + +A wallet address is a secure, unique identifier that's assigned to payment accounts that use Open Payments to exchange payment information. All wallet addresses are URLs (e.g., `https://wallet.example.com/alice`); however, not all URLs are wallet addresses. + +As a supporter of web monetized content, you'll enter your wallet address into your Web Monetization extension to link the extension to your account. + +To web monetize your own content, you'll add your wallet address as the `href` value within the monetization `` element. + +### Wallet provider + +A digital wallet provider, such as Fynbos or GateHub, that can assign your payment account a payment pointer or a wallet address to enable you to send and/or receive payments using Web Monetization. + +Wallet providers are regulated entities within the countries they operate. + +### Web Monetization agent + +A non-user facing component of a Web Monetization extension or web browser. The purpose of the Web Monetization agent is to: + +* Recognize when an HTML page contains one or more monetization `` elements +* Parse the payment pointer or wallet address in a monetization `` +* Extend the HTML DOM API so that `monetization` is a valid link type +* Instrument payments by calling the Open Payments APIs +* Fire `monetization` events after an outgoing payment request is created +* Process `monetization` events sent to the browser window via the `onmonetization` event handler +* Enable CSP `monetization-src` and Permissions Policy `monetization` directives + +### Web Monetization service provider + +An entity that has: +* Full control over the financial account from which payments will be made +* Ownership of the financial account's associated payment pointer or wallet address +* The ability to grant authorization for payments to be sent from the account + +If you, as an individual, meet the criteria above, then you are acting as your own Web Monetization service provider. + +In some jurisdictions, it may be impossible to obtain your own Web Monetization payment account. If you're unable to obtain your own account for this or any other reason, you may be able to sign up with a third-party Web Monetization service provider. + +A third-party Web Monetization service provider is an entity that meets the above criteria and with whom you enter into a service agreement. In return, the service provider authorizes you to send payments from their account. The service provider retains full control over the account and can grant/revoke your authorization to send from the account at any time. \ No newline at end of file diff --git a/src/content/docs/resources/wallets.mdx b/src/content/docs/resources/wallets.mdx new file mode 100644 index 00000000..3ba4e9ab --- /dev/null +++ b/src/content/docs/resources/wallets.mdx @@ -0,0 +1,23 @@ +--- +title: Compatible digital wallets +tableOfContents: false +--- + +import { LinkOut } from "@interledger/docs-design-system"; + +The following providers offer Web Monetization-compatible digital wallets. You must have a wallet address or payment pointer from a compatible wallet to send and receive payments. + +Be sure to select a wallet that's available in your region and supports your preferred currency. + +## Wallet providers + +| Provider | Payment Address Label | +| --------------- | --------------- | +| Fynbos | Wallet address | +| GateHub | Payment pointer | + +## Interledger test wallet + +The Interledger test wallet provides a great way to test Web Monetization without using real money. The test wallet is an open-source application developed and maintained by the [Interledger Foundation](https://interledger.org). + +The [Test Web Monetization](/experiment/guides/test-web-monetization) page gives step-by-step directions for creating an account on the Interledger test network and setting up your test wallet. \ No newline at end of file diff --git a/src/content/docs/support/how-payments-work.mdx b/src/content/docs/support/how-payments-work.mdx new file mode 100644 index 00000000..fe9fa1cb --- /dev/null +++ b/src/content/docs/support/how-payments-work.mdx @@ -0,0 +1,52 @@ +--- +title: How payments work +--- + +import { CodeBlock,Tooltip,LinkOut } from "@interledger/docs-design-system"; + +## Digital wallets + +To send (and receive) payments, you must have an account with a compatible digital wallet, discussed more in the next section. Not all digital wallets support sending payments with Web Monetization. + +A digital wallet is the entity that supplies you with the financial account you'll use to make payments. Funding your account typically requires you to link a card or bank account to your wallet or make a deposit into your wallet account. + +Since wallet providers are a type of financial entity, they are regulated within the countries they operate. One type of regulation, known as KYC (Know Your Customer), requires such entities to collect personal information and verify your identity before allowing you to open an account. + +## Web Monetization-compatible digital wallets + +You must have an account with a [compatible digital wallet](/resources/wallets) to send payments. For a wallet to be compatible with Web Monetization, the provider must implement the Open Payments standard. + +Be sure to select a wallet that's available in your region and supports your preferred currency. + +Your wallet provider will assign your account a unique identifier called either a *payment pointer* or a *wallet address*. This identifier is kind of like an email address. It is publicly shareable and you will need it when linking your Web Monetization extension to your wallet. + +The format of the identifier depends on whether your wallet provider assigned you a payment pointer or a wallet address. + +| Identifier name | Example format | +| ------- | -------------- | +| Payment pointer | `$wallet.example.com/alice` | +| Wallet address | `https://wallet.example.com/alice` | + +## Web Monetization extension + +The [Web Monetization extension](/support/use-extension) allows you to send payments. It links to your digital wallet account so that it can initiate payments from your wallet on your behalf. + +When you set up the extension, you set your budget. Your budget is the max amount that the extension has access to. You can also set the amount that the extension will send per hour. The default is $0.60. + +As you browse, the extension checks each page for Web Monetization. When found, the extension grabs the information it needs from the page's code to set up a payment based on your settings. + +You can also choose to send a web monetized page a one-time payment. The amount will be deducted from your budget. + +## Payments + +Your Web Monetization extension acts like a messaging service. It requests information from the recipient's wallet provider, then passes the information, along with your payment instructions, to your wallet provider. It's now up to your wallet provider to deduct the payment from your account and send it to the recipient. + +### Micropayments + +If you're already somewhat familiar with Web Monetization, you may have heard about how it supports micropayments. + +In general, a micropayment is a very small payment. Each wallet provider is responsible for a few things: +* Deciding whether to support sending and/or receiving micropayments +* Defining what a micropayment is in the context of their business + +Let's say your wallet provider allows you to send micropayments and defines a micropayment as any payment under $0.05 USD. This means that you could send a single payment of, for example, one US cent. Web Monetization is designed to facilitate payments of even a fraction of a cent; however, you can only send that amount if your wallet provider allows it. \ No newline at end of file diff --git a/src/content/docs/support/overview.mdx b/src/content/docs/support/overview.mdx new file mode 100644 index 00000000..f648055b --- /dev/null +++ b/src/content/docs/support/overview.mdx @@ -0,0 +1,55 @@ +--- +title: Overview +tableOfContents: + maxHeadingLevel: 2 +--- + +import { LinkOut } from '@interledger/docs-design-system' + +

Need overview specific to users

+ +* support web monetized content owners and publishers +* support/contribute/give/say thank you/token or sign of appreciation/express your gratitude +* privacy preserving, non-intrusive; no sharing with the platform/owners/publishers +* no site by site subscriptions + +"Why not just use Venmo?" + +## Benefits + +### Control who, when, and how much to pay. + +All payments to web monetized sites must be explicitly authorized or pre-authorized by you. Sites cannot pull payments from your payment account under any circumstance. + +### Your payments are private. + +Web Monetization does not provide the recipient with personally identifiable information such as your name, wallet address/payment pointer, IP address, or anything else the recipient could use to correlate a payment with you. + +### You choose your wallet provider. + +Some solutions require you to sign up for a particular application, platform, or service provider to support your favorite content. As long as your chosen wallet provider is compatible with Web Monetization, you can send payments to any web monetized sites. + +### Your payment details are stored with your wallet. + +Part of setting up the Web Monetization extension involves linking the extension to your wallet. This link allows the extension to communicate with your wallet without storing sensitive payment details in the extension or in the browser itself. + +### Web Monetization is not tied to a specific currency. + +Part of choosing a compatible digital wallet is selecting one that allows you to pay in your preferred currency. When you send a payment, the recipient will receive it in the currency they selected when signing up with their compatible wallet provider. + +### There's no separate Web Monetization account(s). + +The only account you need is the one you create with your wallet provider. You don't have to create separate accounts for each website you want to pay. + +## Constraints + +### Web Monetization is not an ad blocker. + +Sending a payment to a web monetized site does not guarantee an ad-free experience. Web Monetization provides publishers an alternative +revenue model to ads, but the decision to not load ads in response to a payment is entirely theirs. + +### The network of Web Monetization-enabled wallet providers is nascent, but growing. + +Sending and receiving payments via Web Monetization requires the sender and the recipient to have an account with a Web Monetization-enabled wallet provider. + +In general, wallet providers are regulated entities within the countries they operate. Obtaining the proper licensing and registration to become a wallet provider can be an expensive, complex, and time consuming process. In addition, there are technical integrations required to support Web Monetization. All of this means a compatible wallet provider may not yet be available in your area. \ No newline at end of file diff --git a/src/content/docs/support/quick-start.mdx b/src/content/docs/support/quick-start.mdx new file mode 100644 index 00000000..4b21a497 --- /dev/null +++ b/src/content/docs/support/quick-start.mdx @@ -0,0 +1,20 @@ +--- +title: Quick start guide +tableOfContents: false +--- + +import { Steps } from '@astrojs/starlight/components'; +import { LinkOut } from "@interledger/docs-design-system"; + + +1. Download and install the Web Monetization extension. + * Google Chrome and Chromium-based browsers + * Firefox + * Microsoft Edge +2. Sign up for a [Web Monetization-compatible wallet](/resources/wallets) that's available in your region and supports your preferred currency. +3. Get your wallet address or payment pointer from your wallet provider. + * Example wallet address - `https://wallet.example.com/alice` + * Example payment pointer - `$wallet.example.com/alice` +4. [Configure](/support/use-extension) the extension. +5. Visit a web monetized site. + \ No newline at end of file diff --git a/src/content/docs/support/use-extension.mdx b/src/content/docs/support/use-extension.mdx new file mode 100644 index 00000000..ec700890 --- /dev/null +++ b/src/content/docs/support/use-extension.mdx @@ -0,0 +1,214 @@ +--- +title: Use the extension +--- + +import { Steps } from '@astrojs/starlight/components'; +import { LinkOut, StylishHeader } from "@interledger/docs-design-system"; + +The Interledger Foundation's Web Monetization [browser extension](#1-download-and-install-the-extension) allows you to support your favorite web monetized sites directly from your web browser in a quick, non-intrusive, and privacy-preserving way. + +Web monetized sites + +To use the extension to make Web Monetization payments, the site you visit must be web monetized. Since Web Monetization is fairly new, we encourage content owners and publishers tell their audience they're web monetized via a banner or some other method. + +If you're interested in web monetizing your own content, the [quick start guide](/experiment/quick-start) is a good place to start. + +Web Monetization payments + +To make Web Monetization payments, you only need a digital wallet from a Web Monetization-compatible [wallet provider](/resources/wallets). There's no site-by-site account or subscription required for each individual site you want to support. + +A web monetized site cannot initiate payments from your digital wallet. When you link the browser extension to your digital wallet, you're giving the extension permission to send payments on your behalf. These payments are automatically and continuously sent to each web monetized site you visit. You can also globally [disable continuous payments](#change-your-continuous-payment-settings). + +The sites you pay are not provided with any of your personally identifiable information, such as your name, email address, or IP address. + +:::note +Sending a payment to a web monetized site does not guarantee an ad-free experience. The decision to show or hide ads in response to a Web Monetization payment is entirely up to each content owner or publisher. +::: + +## Set up the extension + +### 1. Download and install the extension + +The extension is currently supported in the following browsers. We plan to support more browsers in the future. + +* Google Chrome and Chromium-based browsers +* Mozilla Firefox +* Microsoft Edge + +:::note[Permissions] +The extension will ask for permission to access your browser tabs and your data for all websites. The extension requires these permissions to check each page you visit for the Web Monetization [``](/experiment/link-element) element. +::: + +### 2. Sign up with a compatible digital wallet + +Sign up with a Web Monetization-compatible [wallet provider](/resources/wallets). + +After you've created your digital wallet, you'll be provided with a type of URL called a *wallet address*. You need this address in the next step. + +```html title="Example wallet address" +https://wallet.example.com/alice +``` + +### 3. Configure the extension + + +1. Open the extension and enter your wallet address in the given field. + Extension setup screen with wallet address and amount fields, renew monthly toggle, and connect button +2. Enter the amount to make available to spend. +3. Optionally select the **Renew monthly** toggle. If you choose to not renew monthly, you'll need to manually [add more funds](#adjust-your-budget) when your remaining balance is zero. +4. Click **Connect**. +5. Click **Agree** to allow the extension to connect to your wallet and add a key to your account.
Consent screen to allow the extension to connect to your wallet provider with agree and decline buttons
If your wallet provider's website opens in your browser, proceed to the next step. If you receive a connection error, review the instructions for [resolving the error](#resolve-a-key-addition-failure). +6. Sign in to your wallet account if you haven't already, then confirm the connection and budget amount. Below is an example confirmation screen.
Example budget confirmation screen with accept and decline buttonsA success screen appears when the connection is successful.
Web page displaying a connection successful screen +
+ +## Change your continuous payment settings + +A continuous payment is a payment that recurs at your set rate for as long as you are active on a web monetized page. When you leave the page, the payments stop. + +Continuous payments are enabled by default and sent at a rate of $0.60 USD per hour. Use the instructions below to change the rate or disable continuous payments. + + +1. Click the **Settings** icon in the upper-right of the extension. +
Extension showing a cog icon in the upper-right +2. Select the *Rate* tab. +
Rate tab with rate of pay per hour field and continuous payment toggle +3. Enter the amount the extension will send, per hour, to web monetized sites. +4. Select the **Continuous payment** toggle to enable/disable continuous payments. This is a global setting that applies to all web monetized pages you visit. +
+ +## Make a one-time payment + +You can make a one-time payment to a page instead of -- or in addition to -- continuous payments. The amount of the one-time payment is deducted from your budget. + + +1. Ensure the URL shown above the amount field is the page you intend to pay. +
Extension showing an available balance of five dollars, with one dollar in the amount field and send now button active +2. Enter an amount. Be sure your balance can cover the amount, otherwise the payment will fail. Click **Send now**. +
Extension showing an available balance of four dollars, with a success message indicating one dollar was sent +
+ +## Adjust your budget + + +1. Click the **Settings** icon in the upper-right of the extension. +
Extension showing a cog icon in the upper-right +2. Select the *Budget* tab. +
Budget tab showing your remaining balance and options to change budget amount and renewal +3. Enter the new amount in the **Budget amount** field. +4. Select the **Monthly** toggle to enable/disable monthly renewals of your budget. +5. Click **Submit changes**. A new tab opens to your wallet provider. +6. Sign in to your wallet account if you haven't already, then confirm the new budget. +
+ +## Disconnect the extension from your wallet + +When you disconnect the extension from your wallet, the extension can no longer make payments. You can always reconnect your wallet later. + +:::tip[Remaining balance] +You won't lose your remaining balance if you disconnect the extension from your wallet. Your remaining balance will remain in your wallet account. +::: + +The extension only supports one wallet connection at a time. If, for example, you have two wallet accounts from which you want to make payments, you must disconnect from the first wallet before you can connect the extension to your second wallet. + + +1. Click the **Settings** icon in the upper-right of the extension. +
Extension showing a cog icon in the upper-right +2. Click **Disconnect**. +
Extension's wallet tab showing the disconnect button + The extension's setup screen appears with your previously used wallet address and budget settings prefilled. + Extension's setup screen with previously used wallet address, budget amount, and recurrence setting saved +
+ +## Resolve a key addition failure + +When you try to connect the extension to your digital wallet, the extension attempts to automatically connect with your wallet provider to add a key to your wallet account. + +You'll receive an error if the extension is unable to add the key. + +Extension showing an automatic connection error, the key you must copy, and a copy button for the key + +When this happens, you must copy the key that appears in the extension and manually add it to your wallet account. The steps for adding the key to your account will vary between wallet providers. + +Interledger Wallet + +Follow these steps if your wallet provider is Interledger wallet. + + +1. Sign in to your Interledger Wallet. +2. Select **Settings** from the left menu. +3. Select **Keys**. +4. Click **Add a public key**. +5. Enter a nickname for the key, then paste the key into the public key field. +6. Click **Save**. +7. Go back to your extension and try connecting again. + + +Contact Interledger Wallet at support@interledger.app if you need additional help. + +## Extension states + +When the **Continuous payment** toggle is on, the extension icon appears in color. When the toggle is off, the icon appears in gray. Whether a page is web monetized does not affect the color of the icon. + +#### Continuous payment toggled on + +| Icon | State | +| :----: | ----- | +|
![Continuous payments turned on in extension, extension is paying](/img/docs/extension/enabled-monetized.png "Active icon state with green circle and checkmark")
| Page is web monetized and the extension is continuously paying | +|
![Continuous payments turned on in extension, extension is not paying and needs user attention](/img/docs/extension/enabled-attention.png "Active icon state with orange circle and exclamation mark")
| Page is web monetized, but the extension needs user attention and is **not** continuously paying | +|
![Continuous payments turned on in extension, page is not web monetized](/img/docs/extension/enabled-unmonetized.png "Active icon state with red circle and x")
| Page is **not** web monetized, the extension is **not** continuously paying | + +#### Continuous payment toggled off + +| Icon | State | +| :----: | ----- | +|
![Continuous payments turned off in extension](/img/docs/extension/disabled-monetized.png "Inactive icon state with green circle and checkmark")
| Page is web monetized, but the extension is **not** continuously paying | +|
![Continuous payments turned off in extension, needs user attention](/img/docs/extension/disabled-attention.png "Inactive icon state with orange circle and exclamation mark")
| Page is web monetized, but the extension needs user attention and is **not** continuously paying | +|
![Continuous payments turned off in extension, page is not web monetized](/img/docs/extension/disabled-unmonetized.png "Inactive icon state with red circle and x")
| Page is **not** web monetized, so the extension is **not** continuously paying | + +## FAQ + +
+I get an error from my wallet provider when linking the extension to my wallet. Why? +It's hard to say without a specific error message. Two likely scenarios are: +* You waited too long to accept the connection. Your wallet provider might only give you a short window to accept the connection to keep your account safe. +* You accepted the connection too quickly--within seconds. Your wallet provider may do this as a security measure against bots or to ensure you've read the contents of the screen. Interledger Wallet, for example, enforces a minimum five second wait. + +Click **Connect** and try linking your extension again. +
+ +
+I know the page I'm visiting is web monetized, but the extension says its not. Why? +The most likely reason is that your wallet provider and the content owner or publisher's wallet provider are not yet able to transact with one another. Your extension will display an exclamation mark within an orange circle. Open the extension to read the messaging. + +Visit the [Web Monetization-enabled wallets](/resources/wallets) page for a list of compatible wallet providers. +
diff --git a/src/pages/link-tag.astro b/src/pages/link-tag.astro index 0d2ec6bc..1cba5baf 100644 --- a/src/pages/link-tag.astro +++ b/src/pages/link-tag.astro @@ -13,7 +13,7 @@ const description = t("site.description");

Link Element Generator

- Use the Link Element Generator to generate a monetization <link> element for your HTML documents. Just enter your payment pointer into the field and click Generate. + Use the Link Element Generator to generate a monetization <link> element for your HTML pages. Just enter your payment pointer or wallet address into the field and click Generate.

diff --git a/src/pages/prob-revshare.astro b/src/pages/prob-revshare.astro index 4a626ed6..8bd4327e 100644 --- a/src/pages/prob-revshare.astro +++ b/src/pages/prob-revshare.astro @@ -12,12 +12,12 @@ const description = t("site.description");

Probabilistic Revshare Generator

-

Probabilistic revenue sharing (revshare) is one way to share a portion of a web monetized page’s earnings between multiple payment pointers.

-

Use this tool to define a list of payment pointers and their weights. Then, add the generated monetization link element to your site. The link will contain a unique URL hosted on https://webmonetization.org/api/revshare/pay/. If you'd prefer to not use a hosted URL, you can set up revshare by adding a script to your site.

+

Probabilistic revenue sharing (revshare) is one way to share a portion of a web monetized page’s earnings between multiple wallet addresses and payment pointers.

+

Use this tool to define a list of wallet addresses, payment pointers, and their weights. Then, add the generated monetization link element to your site. The link will contain a unique URL hosted on https://webmonetization.org/api/revshare/pay/. If you'd prefer to not use a hosted URL, you can set up revshare by adding a script to your site.

Define a new revshare

-

Enter each payment pointer that will receive a split of the revenue into the table below. Names are optional. Click Add Share to add more rows.

-

You can adjust by percent after two payment pointers are added to the table. Updating one field will update the remaining fields automatically.

-

As you adjust weights and percentages, the link element generated below will change. Don’t copy the link until you’re finished. Then, add the link to your site.

+

Enter each wallet address and/or payment pointer that will receive a split of the revenue into the table below. Names are optional. Click Add Share to add more rows.

+

You can adjust by percent after two wallet addresses/payment pointers are added to the table. Updating one field will update the remaining fields automatically.

+

As you adjust weights and percentages, the link element generated below will change. Don’t copy the link until you’re finished. Then, add the link to your site.

diff --git a/src/pages/specification/index.html b/src/pages/specification/index.html index 0e4a4519..3d6a6c6e 100644 --- a/src/pages/specification/index.html +++ b/src/pages/specification/index.html @@ -1012,7 +1012,7 @@

This section is non-normative.

    -
  • Suitable for static HTML documents, without requiring backend +
  • Suitable for static HTML pages, without requiring backend infrastructure.
  • Doesn't require user interaction, but user retains control over diff --git a/src/partials/glitch.mdx b/src/partials/glitch.mdx new file mode 100644 index 00000000..0aa3fbf1 --- /dev/null +++ b/src/partials/glitch.mdx @@ -0,0 +1,3 @@ +The example doesn’t require you to have Web Monetization enabled in your browser and no real payments are occurring. + +Click **View as web monetized/non-web monetized visitor** to toggle your monetization state. If source files appear instead of the example, click **View App** in the bottom-right corner. \ No newline at end of file diff --git a/src/partials/glitchNoPay.mdx b/src/partials/glitchNoPay.mdx deleted file mode 100644 index 21510712..00000000 --- a/src/partials/glitchNoPay.mdx +++ /dev/null @@ -1 +0,0 @@ -The example doesn’t require you to have Web Monetization enabled in your browser and no real payments are occurring. diff --git a/src/partials/glitchViewAs.mdx b/src/partials/glitchViewAs.mdx deleted file mode 100644 index 3ddf7a74..00000000 --- a/src/partials/glitchViewAs.mdx +++ /dev/null @@ -1 +0,0 @@ -Click **View as Web Monetized/non-Web Monetized visitor** to toggle your monetization state. If source files appear instead of the example, click **View App** in the bottom-right corner. diff --git a/src/partials/wallet-prereq.mdx b/src/partials/wallet-prereq.mdx new file mode 100644 index 00000000..98e26788 --- /dev/null +++ b/src/partials/wallet-prereq.mdx @@ -0,0 +1,2 @@ +- You must have a wallet address or payment pointer assigned to you by your [wallet provider](/resources/wallets). +- Each page you want to monetize must be served over HTTPS. \ No newline at end of file