Developers

For developers

The technical details for whoever looks after a charity’s website. For step-by-step help on WordPress, Wix, Squarespace and others, see adding it to your website.

The embed script

Two lines put a form on any page. Each charity’s dashboard shows its own form ID.

Inline form
<div data-edonating-form="YOUR-FORM-ID"></div>
<script src="https://edonating.com/embed.js" async></script>

The script finds every element with data-edonating-form and puts the form in an iframe served from edonating.com. The iframe sets its own height as the donor moves through the form (up to 2,000px), so the page around it never needs a scroll bar, and it scrolls the form back into view when the donor moves to the next step. It allows Apple Pay and Google Pay through the iframe’s payment permission. Loading the script twice is safe.

Where scripts aren’t allowed, use the plain iframe; give it enough height, as it can’t resize itself:

Iframe
<iframe src="https://edonating.com/f/YOUR-FORM-ID?embed=1" title="Donation form" allow="payment *" loading="lazy"
  style="width:100%;max-width:480px;height:1600px;border:0;display:block;margin:0 auto"></iframe>

How it fits together

Three separate layers sit on the donor’s screen, each from a different place. The browser keeps them apart: none can read what’s typed into another.

The charity’s page

From the charity’s own website, with the embed script

The donation form

A frame from edonating.com, over HTTPS

Card fields

The payment processor’s own frame

  1. 1The charity’s page loads. The donor’s browser gets the page from the charity’s own website, with the small embed script.
  2. 2The script adds the form. It puts a frame on the page that loads edonating.com/f/ID over HTTPS.
  3. 3The donor fills in the form. Amount, name, email and Gift Aid go from the frame to edonating, over HTTPS.
  4. 4Card details go to the payment processor only. They’re typed into its own fields, inside our frame, and sent straight to it.
  5. 5The processor takes the payment. On the charity’s own account with it, which pays out to the charity’s bank.
  6. 6The processor tells us. A signed message confirms the gift; we record it with any Gift Aid declaration and email the receipt.
  7. 7The page hears about it. The frame tells the charity’s page that a gift was made and its amount. Nothing else.

Who sees what

The charity’s website

Sees: That the page was visited, and the amount of each gift made through it.

Never sees: Names, emails, addresses, card details.

edonating

Sees: What the donor types into the form, and the payment’s outcome.

Never sees: Card numbers and security codes.

Our payment processor

Sees: Card details and the payment, plus the donor’s name and email for monthly gifts.

Never sees: Gift Aid declarations.

Options

  • data-mode="button": a button that opens the form in a window over the page, instead of the form itself.
  • data-label: the button’s words (default “Donate”).
  • data-color: the button’s colour, as a hex code.
Button
<div data-edonating-form="YOUR-FORM-ID" data-mode="button" data-label="Donate" data-color="#1d1707"></div>
<script src="https://edonating.com/embed.js" async></script>

For pages that add content after loading (single-page apps, tabs, pop-ups), call window.edonating.init(element) after adding the element. Forms already set up are left alone.

Knowing when someone gave

When a gift goes through, the iframe element fires an edonating:donated event that bubbles up the page, with the total paid in pence (including any fees the donor chose to cover). Use it for your own analytics or a thank-you message. No donor details are included.

document.addEventListener("edonating:donated", (e) => { console.log("Gift of £" + (e.detail.amount / 100).toFixed(2)); });

Tracking where gifts come from

Each appeal’s Stats tab shows views and gifts by source. It counts the share buttons' own tags (?s=wa, fb, em, cl), QR codes, embedded forms, your own utm_source and the referring site. It uses no cookies and stores nothing in the donor’s browser.

Progress widget

A small iframe with the appeal’s total, target and a donate button, for a sidebar or a blog post:

Progress widget
<iframe src="https://edonating.com/w/YOUR-FORM-ID" title="Appeal progress" loading="lazy"
  style="width:100%;max-width:400px;height:320px;border:0;display:block;margin:0 auto"></iframe>

Addresses that don’t change

  • /your-charity and /your-charity/appeal: hosted pages.
  • /q/code: the link inside a QR code or NFC sticker. It never changes, and the charity can point it at a different appeal after printing.
  • Pages that move keep a permanent redirect from their old address.

Security

  • Card details go into our payment processor’s own fields and never reach our servers. Gifts are paid into each charity’s own account with it; we never hold the money.
  • Only donation forms and the progress widget can be shown inside another site, and only on the charity’s own websites if it lists them. Every other page refuses to be framed.
  • A strict content security policy runs only scripts carrying each request’s own nonce.
  • Messages from the payment processor are signature-checked and handled once each.
  • Downloads (CSV files of gifts, donors and declarations) can’t run as spreadsheet formulas.
  • Staff access to the admin area needs two-step sign-in.
  • Our WordPress plugin is open source at github.com/edonating/edonating-wordpress, including the script that adds the form to the page. Get it only from there; copies from anywhere else aren’t ours.

What if…

Someone listens in on the connection?
The form, its scripts and everything sent from it travel only over HTTPS, and edonating.com tells browsers to refuse plain HTTP for a year (HSTS). Card details are encrypted between the donor’s browser and the payment processor. The one gap we can’t close is the charity’s own page: if it’s served over plain HTTP, someone on the same network could change that page, including the code that adds the form. Serve the page over HTTPS.
edonating can’t be reached?
The rest of the charity’s page loads as normal; the embed script loads without holding the page up. While the form loads, a short line says so. If it hasn’t loaded a few seconds after the frame does, the empty space is hidden and a link to the donation page is shown instead. The same happens when a browser extension or office firewall blocks the frame.
We go down in the middle of a payment?
The payment processor holds the payment on the charity’s account either way, and keeps sending its signed confirmation until we receive it. Each confirmation is recorded once, so a gift is never counted twice.
Another website copies a charity’s form?
By default a charity’s forms can be shown on any website, so it can use them anywhere without asking us. A copied form still shows the charity’s own name and pays only into the charity’s own account, and the site showing it can’t read what donors type; it only hears the amount of each gift made through it. A charity can also list its own websites under Settings: browsers then refuse to show its forms anywhere else, and visitors there get a link to the donation page instead.
A message pretends to come from the form?
The embed script only listens to messages from edonating.com, and only from frames it made itself. A form’s height is capped, a button’s colour must be a hex code, and its words are shown as plain text, never as code.

Status and machine-readable pages

  • /api/health: answers {"ok":true} when the site and its database are up. Point your uptime monitor at it.
  • /llms.txt: a plain summary of edonating for AI assistants and search tools.
  • /sitemap.xml: every public page.

Questions about anything technical: hello@fenquist.com.