THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

How to Build a Bitcoin Payment Widget for Ghost

permalink THAMER
#bitcoin#ghost#payments#wordpress

Host a receive-only donation interface separately and embed it using an iframe in a Ghost HTML card if the hosting policy permits framing. Use a fixed HTTPS source, a descriptive title and a restrictive sandbox, granting only capabilities required by the widget. The JavaScript helper validates the configured destination; it is not the widget itself. Set frame-ancestors on the widget server to permit only your blog and avoid sharing secrets or trusting arbitrary postMessage events.

Source code

JavaScript · 10 lines
1function stage25Widget(url) {
2  const u = new URL(url);
3  if (u.origin !== 'https://example.org' || u.pathname !== '/donate' || u.search || u.hash || u.username || u.password) throw Error('Unapproved destination');
4  return u.href;
5}
6if (typeof module !== 'undefined') {
7  const assert = require('node:assert/strict');
8  assert.equal(stage25Widget('https://example.org/donate'), 'https://example.org/donate');
9  assert.throws(() => stage25Widget('https://example.org.evil.test/donate'));
10}

Validation and deployment

Use a staging site and testnet first. Verify the destination, test duplicate payment notifications and keep fulfillment separate from browser requests. This example was checked locally, not inside a live CMS.

Related documentation

https://thamer.org/api

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects