For shops, creators and clubs: no shop software to change, no payment company in the middle.
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
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
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
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
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
Pick a button
Open the builder, paste your Dogecoin address and choose a style.
Paste two lines
Copy the code and paste it into your page where the button should go.
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.
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.
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.
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.
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
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'.
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.
Optional: add api
Point it at an Esplora-style server you run or trust and the window shows the green check by itself.
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
Knowing when you are paid
Set api to the base URL of an Esplora-style server (electrs-doge or similar). The element then reads the address history, adds up payments, and fires events on the element. They bubble and are composed, so one listener on document is enough. Every amount is also given as a decimal string of koinu (1 DOGE = 100,000,000 koinu); the bigint fields are kept for compatibility, and JSON.stringify throws on a bigint, so convert with String().
Events and their details
Event
Fires when
detail
doge-pay:detected
A new payment transaction is seen (also unconfirmed). A second part-payment fires it again.
Console output (the test paid 12 then 9 DOGE for a 20 DOGE order with 2 confirmations, then a second page waited past expires)
open {}
detected {"txid":"7ef0703e…","amountKoinu":"1200000000","confirmations":0,"txids":["7ef0703e…"],"receivedKoinu":"1200000000","requiredKoinu":"2000000000","shortfallKoinu":"800000000","overpaidKoinu":"0","satisfied":false}
detected {"txid":"59e84e69…","amountKoinu":"900000000","confirmations":0,"txids":["59e84e69…"],"receivedKoinu":"2100000000","requiredKoinu":"2000000000","shortfallKoinu":"0","overpaidKoinu":"100000000","satisfied":true}
confirmed {"txid":"7ef0703e…","amountKoinu":"2100000000","confirmations":2,"txids":["7ef0703e…","59e84e69…"],"receivedKoinu":"2100000000","requiredKoinu":"2000000000","shortfallKoinu":"0","overpaidKoinu":"100000000","satisfied":true}
expired {"expiresAt":1795913166}
Payments add up
All payments to the address after since are summed across transactions. confirmed fires once, when payments with at least confirmations confirmations total at least amount. A customer can pay in two parts; an overpayment still confirms and the excess is in overpaidKoinu. Without amount, any positive payment counts. The element never refunds or decides about excess or shortfall. Two unrelated payers to the same address are added together, so use a fresh address per order.
Only payments first seen after the element started watching count. If the buyer may have paid before the element appeared, pass since (Unix seconds, for example the order creation time from your server's clock). Confirmed transactions in blocks older than since are ignored; unconfirmed ones are always considered.
Confirm on your own server
Client-side detection runs in the buyer's browser, trusts whatever the server says and can be bypassed. Show the green check with it, but release goods only after your own server has checked the payment.
A server check that asks your indexer about the order address, after the order was created, and requires three confirmations. It is run here against the same stand-in indexer:
JavaScript
// Node 20+. Server-side confirmation: never fulfil an order because the browser said "paid".
// Ask your own indexer (or node) about the address, after the order was created, using the txid(s) the page sends.
const INDEXER = process.env.INDEXER_URL; // an Esplora-style API you run or trust
export async function isPaid({ address, requiredKoinu, since }) {
const txs = await (await fetch(`${INDEXER}/address/${address}/txs`)).json();
const tip = Number(await (await fetch(`${INDEXER}/blocks/tip/height`)).text());
let received = 0n;
for (const tx of txs) {
if (!tx.status.confirmed || tip - tx.status.block_height + 1 < 3) continue; // 3 confirmations
if (tx.status.block_time < since) continue; // not older than the order
for (const out of tx.vout) if (out.scriptpubkey_address === address) received += BigInt(out.value);
}
return received >= BigInt(requiredKoinu);
}
Output of the check against a stand-in indexer (nothing paid; paid, in no block; 2 confirmations; 3 confirmations; order made after the payment)
nothing paid yet : false
paid, not in a block : false
2 confirmations : false
3 confirmations : true
order made after pay : false
An Esplora address history lists the newest 25 confirmed transactions per page. For a busy address, follow /address/:a/txs/chain/:last_seen_txid, or use a fresh address per order.
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).
Attribute
Default
Meaning
address
required
Dogecoin address, validated with Base58Check. A bad address shows an inline error and no QR code.
amount
none
Positive 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, message
none
Put in the payment link (percent-encoded) and shown in the window.
network
mainnet
mainnet (P2PKH D…, P2SH 9…/A…) or testnet. An address of the other network is rejected. MyDoge is offered on mainnet only.
mode
card
button draws only a button; a click opens the window in a modal dialog (focus trapped, Escape and backdrop close, scrolling locked, focus returns).
button-style
solid
Button mode: solid, yellow, outline, plaque, plaque-dark, pill or coin.
button-size
md
Button mode: sm, md or lg.
button-label
by style
Button mode: replaces the text ("Pay with DOGE"; the pill shows "Pay 20 DOGE" when amount is set; on plaques it replaces "Accepted here").
button-block
off
Button mode: the button fills its container.
options
simple
full shows everything expanded: every wallet button, copy buttons, details, the three-step indicator and confirmation counts (the 0.7 layout and wording).
wallet-url
https://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.
api
none
Base 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.
confirmations
1
Confirmations needed for doge-pay:confirmed (0 = as soon as seen: unsafe for anything of value).
poll
10
Seconds between checks. Checks pause while the tab is hidden; failures back off with jitter up to 5 minutes.
since
when watching started
Unix seconds. Confirmed transactions in earlier blocks are ignored.
expires
none
Unix seconds. Shows "Valid until"; if it passes with no payment seen the window shows the expired state, stops watching and fires doge-pay:expired.
size
regular
compact for tight spaces.
theme
auto
dark or light. Without it the window follows the page's color-scheme.
qr-mark
off
The coin mark in the middle of the QR code (error correction H; about 4% of the area).
Properties, methods and slots
Name
What it does
element.open(), element.close()
Button mode: show or hide the window.
element.backendFactory = (api) => backend
Use 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.
Property
Default (light / dark)
Used for
--doge-pay-bg
#fff / #1D1709
Window background
--doge-pay-ink
#2F220C / #F6EEDB
Text, and buttons unless --doge-pay-button is set
--doge-pay-accent
#FDC606
Primary wallet button, steps, progress bar
--doge-pay-on-accent
#2F220C
Text on the accent colour
--doge-pay-radius
16px
Corner radius
--doge-pay-border
#ECE5D0 / #3A2E15
Window and QR tile borders
--doge-pay-button
the ink colour
Button background
--doge-pay-muted
#6b5c3e / #B9A97F
Secondary text
--doge-pay-ok
#146C43 / #62D493
Paid state
--doge-pay-bad
#A12B12 / #FF9B85
Errors
--doge-pay-warn
#8A5A00 / #F2B84B
Offline
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:
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:
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.
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 } }.
// 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.
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.