DogeJS / All tools / Pay button

A Pay with DOGE button for any website

Two lines of code give your site a button and a clear payment window. Your customer pays from their own wallet, straight to yours.

cornercoffee.example
A coffee roaster’s web page selling House Espresso, 1 kg, for 12.50 DOGE, with the Pay with DOGE window open on top: 12.5 DOGE, a yellow Pay with DogeJS Wallet button, a QR code, Or scan with your phone, and Waiting for payment.

Take Dogecoin on your website today

For shops, creators and clubs: no shop software to change, no payment company in the middle.

Twelve button styles: Pay with DOGE in ink, yellow and outline, large and small; Donate DOGE; Tip in DOGE; a pill with the amount, Pay 20 DOGE; a round coin; Dogecoin accepted here plaques in light and dark; and a wide Checkout with DOGE.

Button styles

Pick from a dozen button styles

Ink, yellow or outlined; Pay, Donate or Tip; a pill with the amount, a round coin, or a Dogecoin accepted here plaque. Pick one in the builder and it fits your page.

  • Large, medium and small sizes
  • Your own words on the button
  • Colours you can match to your site
The payment window on a phone: 12.5 DOGE for House Espresso, 1 kg, a yellow Open wallet app button, a QR code and Waiting for payment.
The same window after paying: a green check, Payment received, 12.5 DOGE, and a Done button.

What your customer sees

A payment window that just works

The button opens a small window with the amount, one big button and a QR code. On a phone it opens their wallet app; on a computer they scan the code with their phone or use a browser wallet.

  • The exact amount and your label, such as the order number
  • Copy address and amount under More options
  • Fits phones, tablets and computers
cornercoffee.example
The payment window on a computer after the payment: a green check, Payment received, 12.5 DOGE, and Done.

Paid

The green check, and how you know you were paid

Connect the button to a payment server and the window turns green by itself when the money arrives. Your page gets an event at the same moment, so it can say thank you or move on to the receipt.

  • Payments in parts add up; the window asks for the rest
  • Your own server can check the payment before you ship
  • Without a server the window still works: you check your wallet
A small shop page on a phone: Corner Coffee Roasters, House Espresso, 1 kg, 12.50 DOGE, and a Pay with DOGE button.

Any website

Works with any site builder

If you can paste HTML, you can add the button: a plain web page, WordPress with a Custom HTML block, or a code block in Shopify or Squarespace. Developers can use it in React, Vue or any framework.

  • One small file, no other code needed
  • Host the file yourself if you prefer
  • Or use plain image buttons where scripts are not allowed
A Dogecoin wallet: the balance, and a payment of 12.50 DOGE received.

Your money

No fees, no account, straight to your wallet

The customer’s wallet pays your own Dogecoin address directly. DogeJS never touches the payment, takes no cut, and there is nothing to sign up for.

  • Only your public address is on the page, never a key
  • Use any Dogecoin wallet to receive
  • Free and open source

How it works

  1. Pick a button

    Open the builder, paste your Dogecoin address and choose a style.

  2. Paste two lines

    Copy the code and paste it into your page where the button should go.

  3. Get paid

    Customers press the button and pay from their wallet, straight to your address.

Add it to your site

These two lines are the whole thing. The builder fills in your address, amount and button style for you.

HTML
<script src="https://dogejs.com/pay.js" defer></script>
<doge-pay mode="button" address="YOUR_DOGE_ADDRESS" amount="20"></doge-pay>

Buttons to download

Every style is also a plain SVG image, for places that cannot run scripts: an email, a README, a forum post. Link it to your payment page. Images do not detect payments.

HTML
<a href="https://example.com/donate">
  <img src="/buttons/accepted-light.svg?v=202611291136" alt="Dogecoin accepted here" width="300" height="104">
</a>

Questions

Does it cost anything?

No. There is no fee and no account. Your customer pays the normal Dogecoin network fee from their wallet, and the full amount reaches your address.

Do I need a server?

Not to show the button and the payment window. To see the green check by itself, the button needs a payment server (an Esplora-style server you run or trust). Before you ship anything valuable, check the payment in your wallet or on your own server.

Which wallets can my customers use?

Any Dogecoin wallet: the QR code and the Open wallet app button carry a standard Dogecoin payment link with the address and amount. On a computer the window also offers the DogeJS Wallet and, when it is installed, MyDoge.

Can a customer pay in two parts?

Yes. Payments to the address add up, and the window asks for what is missing.

Is it safe to put on my checkout page?

Only your public address is on the page; your keys stay in your wallet. The button is one script file. If you would rather not load it from dogejs.com at checkout, copy it to your own host.

How big is it?

pay.js is 102,819 bytes (37,500 gzipped) and includes the QR code maker and the payment detection.

Get your button code

Two lines for your website. No account, no fees.

For developers

Documentation

How the button works, every option, and how to be sure you were paid.

How it works

<doge-pay> is one custom element in one static file. It builds a dogecoin: payment link from your address, amount and label, draws it as a QR code, and offers the buyer the wallets that can pay it. Nothing is sent to DogeJS: there is no account, no server and no fee.

1Your pageone tag withaddress and amount2The windowamount, one button,QR code3The walletthe buyer approvesand pays4The networkyour addressreceives the coins

Optional fifth step, only when you set api: the element asks the server you named whether the address has received the amount, and shows a green check and fires doge-pay:confirmed.

Who sees what

  • Keys never touch the page. The element only knows your public address. The buyer's wallet holds the buyer's keys and shows its own approval screen.
  • The window talks to one host: the api server you chose, and only when you set it. Without api it makes no requests at all.
  • Detection is a convenience, not proof. It runs in the buyer's browser and trusts the server's answer. See Knowing when you are paid.

Add it to your site

  1. Get the file

    Copy pay.js (102,819 bytes, about 37 KB gzipped) to your own host and load it once with defer. With a bundler: import '@dogejs/pay/element'.

  2. Add the tag

    Put your Dogecoin address in address. Add amount and label if you know them. Use a fresh address for each order when you can.

  3. Optional: add api

    Point it at an Esplora-style server you run or trust and the window shows the green check by itself.

HTML
<script src="pay.js?v=202611291136" defer></script>

<doge-pay
  mode="button"
  address="YOUR_DOGE_ADDRESS"
  amount="20"
  label="Order 1042"
  api="https://your-indexer.example">
</doge-pay>

<script>
  document.addEventListener('doge-pay:confirmed', (e) => {
    console.log('paid', e.detail.txid, String(e.detail.amountKoinu), 'koinu');
  });
</script>

Take out mode="button" to put the payment window straight on the page instead of behind a button. Your site can be plain HTML, a static generator or a framework: see frameworks. Loading pay.js from a host you do not control puts someone else's code on your checkout page: host it yourself (see self-hosting).

The same snippet, run in a test page against a stand-in Esplora server on the test network (only the address, network="testnet", a 1-second poll and the api URL were swapped in), opened the window and, after a payment and a block, logged:

Console output
paid fa82a0ad…df7152 2000000000 koinu

Reference

Attributes

Changing any attribute except size, theme, qr-mark and wallet-url re-renders the element and restarts detection (and resets the start time).

AttributeDefaultMeaning
addressrequiredDogecoin address, validated with Base58Check. A bad address shows an inline error and no QR code.
amountnonePositive decimal DOGE, at most 8 decimals; handled as BigInt koinu, never a float. Without it any payment counts and the one-click wallet buttons are hidden.
label, messagenonePut in the payment link (percent-encoded) and shown in the window.
networkmainnetmainnet (P2PKH D…, P2SH 9…/A…) or testnet. An address of the other network is rejected. MyDoge is offered on mainnet only.
modecardbutton draws only a button; a click opens the window in a modal dialog (focus trapped, Escape and backdrop close, scrolling locked, focus returns).
button-stylesolidButton mode: solid, yellow, outline, plaque, plaque-dark, pill or coin.
button-sizemdButton mode: sm, md or lg.
button-labelby styleButton mode: replaces the text ("Pay with DOGE"; the pill shows "Pay 20 DOGE" when amount is set; on plaques it replaces "Accepted here").
button-blockoffButton mode: the button fills its container.
optionssimplefull shows everything expanded: every wallet button, copy buttons, details, the three-step indicator and confirmation counts (the 0.7 layout and wording).
wallet-urlhttps://dogejs.com/wallet/app/Where Pay with DogeJS Wallet opens the wallet pop-up. Relative URLs resolve against the page. Read when the button is pressed.
apinoneBase URL of an Esplora-compatible REST API. Without it nothing is fetched and no status detection runs. A relative value resolves against document.baseURI; the result must be an http(s) URL without query or credentials.
confirmations1Confirmations needed for doge-pay:confirmed (0 = as soon as seen: unsafe for anything of value).
poll10Seconds between checks. Checks pause while the tab is hidden; failures back off with jitter up to 5 minutes.
sincewhen watching startedUnix seconds. Confirmed transactions in earlier blocks are ignored.
expiresnoneUnix seconds. Shows "Valid until"; if it passes with no payment seen the window shows the expired state, stops watching and fires doge-pay:expired.
sizeregularcompact for tight spaces.
themeautodark or light. Without it the window follows the page's color-scheme.
qr-markoffThe coin mark in the middle of the QR code (error correction H; about 4% of the area).

Properties, methods and slots

NameWhat it does
element.open(), element.close()Button mode: show or hide the window.
element.backendFactory = (api) => backendUse your own data source. Set it before the api attribute. The backend is a ChainBackend from @dogejs/backends and needs getAddressTransactions (and getTipHeight); for example a FallbackBackend of several servers. You receive the raw attribute value.
<div slot="modal">Anything with slot="modal" is shown under the window inside the dialog (this site uses it for simulated-payment buttons).

CSS custom properties

Set them on doge-pay or any parent. Where two values are shown the second is the dark default. If you set --doge-pay-bg or --doge-pay-ink, set both.

PropertyDefault (light / dark)Used for
--doge-pay-bg#fff / #1D1709Window background
--doge-pay-ink#2F220C / #F6EEDBText, and buttons unless --doge-pay-button is set
--doge-pay-accent#FDC606Primary wallet button, steps, progress bar
--doge-pay-on-accent#2F220CText on the accent colour
--doge-pay-radius16pxCorner radius
--doge-pay-border#ECE5D0 / #3A2E15Window and QR tile borders
--doge-pay-buttonthe ink colourButton background
--doge-pay-muted#6b5c3e / #B9A97FSecondary text
--doge-pay-ok#146C43 / #62D493Paid state
--doge-pay-bad#A12B12 / #FF9B85Errors
--doge-pay-warn#8A5A00 / #F2B84BOffline

Detection settings in one place

api (where), confirmations (how deep), poll (how often), since (how far back), expires (until when), network (checked against the server's genesis block hash: a server on another network shows the wrong-network state and nothing is watched), and backendFactory (your own source). Only the newest 50 transactions of the address are read per poll; vanished ones are verified one by one.

Theming

Everything is shadow DOM, styled through the custom properties above. Dark mode uses light-dark(): put color-scheme: light dark on your page, or set theme="dark".

HTML
<style>
  doge-pay {
    --doge-pay-accent: #7C3AED;      /* the main wallet button, steps and progress bar */
    --doge-pay-on-accent: #fff;      /* text on that colour */
    --doge-pay-radius: 6px;          /* corners of the window */
    --doge-pay-button: #4C1D95;      /* background of the other buttons */
  }
</style>
<doge-pay mode="button" button-style="outline" button-label="Pay in DOGE" address="YOUR_DOGE_ADDRESS" amount="20"></doge-pay>

Tested: the page above loaded in Chrome and getComputedStyle(doge-pay).getPropertyValue('--doge-pay-accent') returned #7C3AED. Dark card for a dark site:

HTML
<doge-pay theme="dark" mode="button" button-style="yellow" address="YOUR_DOGE_ADDRESS" amount="20"></doge-pay>

The DogeJS Wallet pop-up and MyDoge

When the request has an amount, the window offers one primary button chosen by device. Phones and tablets get Open wallet app (a dogecoin: link). Computers get Pay with MyDoge when the extension is installed and the network is mainnet, otherwise Pay with DogeJS Wallet. The other buttons sit under More options.

DogeJS Wallet

A click opens the wallet at wallet-url in a 420 × 720 pop-up, with nothing added to the URL (it must run from the click, because browsers allow pop-ups only then). The window waits for { type: "dogejs-wallet:ready", v: 1 } from that window and that origin, and only then posts the request to that origin:

JavaScript
{ type: 'dogejs-pay:request', v: 1, id, payment: { address, amount: '700000000' /* koinu, string */, network: 'testnet', label: 'Order 1001' } }

The wallet shows its own approval sheet (site, amount, full address, fee, total, balance after; on mainnet the PIN or password again) and pays through its normal send path. It answers { ok: true, txid }; the window then says "Payment sent, waiting for it to arrive", fires doge-pay:sent, and reaches the green check only when its own detection (api) sees the payment. Anything else returns to the options with a plain message: cancelled, refused with a reason, busy, rejected by the network, unsure, window closed, no answer within 30 s, or pop-up blocked. A Cross-Origin-Opener-Policy: same-origin header on your page stops the pop-up from answering.

MyDoge

If window.doge.requestTransaction exists, the request has an amount and the network is mainnet, the window calls getConnectionStatus(), connect() if needed, then requestTransaction({ recipientAddress, dogeAmount }). On success it says "Payment sent, waiting for it to arrive", fires doge-pay:sent and carries on through normal detection. Failures are explained in words (cancelled, not enough DOGE, different network) with Try again. The extension's error shape is undocumented, so errors are recognised by message text.

Any other wallet

The QR code and the dogecoin: link work with every wallet that reads them. After a part payment the button, the link and the QR ask for the missing amount.

Frameworks

<doge-pay> is a standard custom element, so it works anywhere HTML does. Register it once (import '@dogejs/pay/element', or the script tag) and listen with addEventListener: it is the one pattern that works the same in every framework.

Plain HTML

The snippet in Add it to your site. Tested in Chrome: the button opened the window and the confirmed listener logged the payment.

React

JSX (pay-button.jsx)
import { useEffect, useRef } from 'react';
import '@dogejs/pay/element'; // registers <doge-pay> once

export function PayButton({ address, amount, orderId, onPaid }) {
  const ref = useRef(null);

  useEffect(() => {
    const el = ref.current;
    const handler = (e) => onPaid(e.detail.txid);
    el.addEventListener('doge-pay:confirmed', handler);
    return () => el.removeEventListener('doge-pay:confirmed', handler);
  }, [onPaid]);

  return (
    <doge-pay
      ref={ref}
      mode="button"
      address={address}
      amount={amount}
      label={`Order ${orderId}`}
      api="https://your-indexer.example"
    />
  );
}

Tested with React 18.3 in a browser test page (the component body compiled with Babel, pay.js loaded by script tag in place of the import line): the button rendered, the window opened, and onPaid received the txid after a payment and a block. In TypeScript, declare the tag once so JSX accepts it: declare namespace JSX { interface IntrinsicElements { 'doge-pay': any } }.

Vue 3

Vue (PayButton.vue)
<script setup>
import { onMounted, onBeforeUnmount, ref } from 'vue';
import '@dogejs/pay/element'; // registers <doge-pay> once

defineProps({ address: String, amount: String, orderId: String });
const emit = defineEmits(['paid']);

const el = ref(null);
const onConfirmed = (e) => emit('paid', e.detail.txid);
onMounted(() => el.value.addEventListener('doge-pay:confirmed', onConfirmed));
onBeforeUnmount(() => el.value?.removeEventListener('doge-pay:confirmed', onConfirmed));
</script>

<template>
  <doge-pay ref="el" mode="button" :address="address" :amount="amount"
            :label="`Order ${orderId}`" api="https://your-indexer.example" />
</template>
JavaScript (vite.config.js)
// vite.config.js: tell Vue that <doge-pay> is a custom element, not a component to resolve.
import vue from '@vitejs/plugin-vue';
export default {
  plugins: [vue({ template: { compilerOptions: { isCustomElement: (tag) => tag === 'doge-pay' } } })],
};

Tested with Vue 3.5 (global build): the same template and handlers, registered as a component with isCustomElement set, rendered the button, opened the window and emitted paid with the txid. The single-file-component wrapper itself was not compiled in this test.

Server-rendered pages and static generators

Put the two lines (script and tag) in the template. The tag is inert HTML until the script runs, so there is nothing to hydrate. Do not render the address from user input without validating it on your server.

Self-hosting

The source is github.com/DogeJS-Dev/pay-button (package @dogejs/pay 0.8.0). To run your own copy:

Shell
git clone https://github.com/DogeJS-Dev/pay-button
cd pay-button
npm install
npm run build      # dist/pay.js (script tag), dist/element.mjs, dist/index.mjs, types
npm test

Copy dist/pay.js to any static host and load it with a script tag. Open demo/index.html after building to try it. What to change: nothing in the code. Set wallet-url if you host your own wallet, and api to your own indexer. The package makes no request to any host you did not name. This site's pay.js is the same file as dist/pay.js.

Helpers that run in Node 20+ without a DOM (validateAddress, encodeAddress, parseAmount, formatKoinu, buildPaymentUri, EsploraLiteBackend) are in the main entry, @dogejs/pay. Only @dogejs/pay/element touches the DOM at import.

Code examples

Every example on this page was run. Browser examples ran in Chrome on a test page against a stand-in indexer on the test network; Node examples ran against the same stand-in.

Helper functions in Node (run against the built package):

Run: validate an address and build a link

JavaScript
import { validateAddress, buildPaymentUri, parseAmount, formatKoinu } from '@dogejs/pay';

for (const a of ['DU9umLs2Ze8eNRo69wbSj5HeufphJawFPh', 'nUCAGGgZEPN1QyknmQe1oAku817bQAFKFt', 'D-not-an-address']) {
  const r = validateAddress(a);
  console.log(a.slice(0, 10).padEnd(11), r.ok ? `valid, ${r.network}` : `invalid: ${r.reason ?? r.error ?? JSON.stringify(r)}`);
}
console.log(buildPaymentUri({ address: 'DU9umLs2Ze8eNRo69wbSj5HeufphJawFPh', amount: '12.5', label: 'Order 1042', message: 'Thanks!' }));
console.log(parseAmount('12.5'), formatKoinu(1250000000n));
try { parseAmount('1.123456789'); } catch (e) { console.log('9 decimals ->', e.message); }
Output
DU9umLs2Ze  valid, mainnet
nUCAGGgZEP  valid, testnet
D-not-an-a  invalid: Address contains invalid characters.
dogecoin:DU9umLs2Ze8eNRo69wbSj5HeufphJawFPh?amount=12.5&label=Order%201042&message=Thanks!
{ ok: true, koinu: 1250000000n } 12.5