Donation Integration
Donations let readers support your work without buying a subscription. A donation does not unlock pages, grant access keys, or change what content a visitor can see.
Ezoic Subscriptions handles the donation checkout and payment flow. You decide where to invite readers to contribute.
Mount Donations On The Page 🔗
Before opening a donation dialog from your own JavaScript, mount the donation launcher:
<script>
window.ezsubscriptions = window.ezsubscriptions || {};
ezsubscriptions.cmd = ezsubscriptions.cmd || [];
ezsubscriptions.cmd.push(async function () {
await ezsubscriptions.showDonations();
});
</script>
<script src="https://sm.ezoic.com/min.js" async defer></script>
showDonations() loads your active donation settings and registers ezsubscriptions.openDonation(...) and ezsubscriptions.closeDonation() on the widget API.
Open A Donation With A Preset Amount 🔗
Use openDonation({ amountCents }) when your own button, banner, article template, or app code should open the donation checkout.
<button type="button" id="support-button">Support our work</button>
<script>
window.ezsubscriptions = window.ezsubscriptions || {};
ezsubscriptions.cmd = ezsubscriptions.cmd || [];
ezsubscriptions.cmd.push(async function () {
await ezsubscriptions.showDonations();
document.getElementById("support-button").addEventListener("click", function () {
ezsubscriptions.openDonation({ amountCents: 2500 });
});
});
</script>
<script src="https://sm.ezoic.com/min.js" async defer></script>
amountCents is a preset amount in cents. For example:
500means$5.00.2500means$25.00.10000means$100.00.
Currency is not passed to openDonation. The current dashboard donation flow uses USD.
If amountCents is missing, invalid, or below the minimum configured in the dashboard, the widget falls back to the normal donation picker. The backend still enforces the minimum amount.
Declarative Button Option 🔗
You can also mark a button with attributes and let the widget handle the click:
<button data-ezoic-donate data-ezoic-amount-cents="2500">
Support our work
</button>
<script>
window.ezsubscriptions = window.ezsubscriptions || {};
ezsubscriptions.cmd = ezsubscriptions.cmd || [];
ezsubscriptions.cmd.push(async function () {
await ezsubscriptions.showDonations();
});
</script>
<script src="https://sm.ezoic.com/min.js" async defer></script>
The data-ezoic-amount-cents value follows the same cents format as openDonation({ amountCents }).
Built-In Support Button 🔗
If donations are enabled and you call showDonations() without adding a [data-ezoic-donate] trigger to the page, the widget can show its built-in support button.
If you want to fully control the placement and design of the support CTA, use your own button and call openDonation(...) from your click handler, or use a [data-ezoic-donate] trigger.
Dashboard Prerequisite 🔗
Before the onsite donation API can open checkout, donations must be enabled for the site:
- Open the Ezoic Subscriptions offers area in the Ezoic dashboard.
- Go to donation settings.
- Turn on Accept donations.
- Set the donation label, such as
Support our work. - Set the minimum donation amount in USD.
- Save settings.
Donations are pay-what-you-want above the minimum amount you set. A site has one active donation at a time. To change the label or minimum amount after enabling donations, turn donations off and enable them again.
Closing The Dialog 🔗
Donation checkout is dismissible. If your UI needs to close it programmatically, call:
ezsubscriptions.closeDonation();
This only affects the donation dialog. It does not close or bypass the paid-access paywall for subscriber content.
For full showDonations(), openDonation(), and callback details, see JavaScript API Reference.