Embedding the Form
The Donately embeddable form is a JavaScript-powered donation form that supports credit cards, ACH bank transfers, PayPal, Apple Pay, Google Pay, recurring donations, custom fields, and more.
Method 1: Simple Script (Recommended)
The easiest way to embed your form. Add a single script tag with your account ID, Stripe key, and form ID. The form configuration is fetched automatically from the Donately API. Works on any page builder that allows script embeds (Webflow, Squarespace, Wix, Drupal, etc.).
<script
src="https://cdn.donately.com/6.0/donately.min.js"
data-donately-id="act_ba7d12ab27bb"
data-stripe-publishable-key="pk_live_xxxx"
data-donately-form-id="frm_xxxx"
data-donately-fetch-config="true"
async="async">
</script>
Method 2: Iframe
Perfect for tools that limit your ability to use JavaScript on your site (e.g., WordPress). The iframe is generated automatically from your form configuration.
<iframe
src="https://cdn.donately.com/6.0/donate-form.html?form_id=frm_xxxx&account_id=act_ba7d12ab27bb&stripe_key=pk_live_xxxx"
width="100%"
height="850px"
frameborder="0"
allowtransparency="true"
allow="payment *"
style="max-width:600px;">
</iframe>
Method 3: Advanced Script
Gives you full control of the embed code. Best for developers with programming experience who want to customize callbacks, handle events, or pass dynamic options.
<div id="dntly-donation-form"></div>
<script src="https://cdn.donately.com/6.0/donately.min.js" async="async"></script>
<script>
dntlyReady("Donately", function(t) {
Donately.init({
selector: '#dntly-donation-form',
options: {
"donately-id": "act_ba7d12ab27bb",
"stripe-publishable-key": "pk_live_xxxx",
"donately-form-id": "frm_xxxx"
},
afterFormLoad: function() {},
afterNavigateHook: function(stepNumber) {},
onSuccess: function(donation) {},
onError: function(error) {}
});
});
function dntlyReady(name, callback) {
window.setTimeout(function() {
if (window[name]) { callback(window[name]); }
else { dntlyReady(name, callback); }
}, 10);
}
</script>
Required Options
| Option | Description |
|---|---|
| donately-id | Your Donately account ID (e.g., act_ba7d12ab27bb) |
| stripe-publishable-key | Your Stripe publishable key (starts with pk_live_ or pk_test_) |
| donately-form-id | Your form ID (e.g., frm_xxxx). Required when using the simple embed method — the form configuration is fetched from the API using this ID. |
Donation Options
| Option | Type | Description |
|---|---|---|
| amount | number | object | Default donation amount, or an object for more control (see below) |
| presets | string | object | Preset donation amounts (see below) |
| campaign-id | string | Campaign to attribute donation to |
| fundraiser-id | string | Fundraiser to attribute donation to |
| currency | string | ISO currency code (default: usd) |
| dont-send-receipt-email | boolean | Suppress the automatic donation receipt email |
Amount Configuration
Pass a number for a simple default, or an object for more control:
// Simple default amount
"amount": 50
// Object with full options
"amount": {
"default": 50,
"placeholder": 100,
"disabled": false,
"required": false
}
| Property | Type | Description |
|---|---|---|
| default | number | Pre-filled donation amount in dollars |
| placeholder | number | Placeholder text shown when the amount field is empty |
| disabled | boolean | Lock the amount field so it cannot be changed by the donor |
| required | boolean | Set to false to make the amount field optional |
Presets Configuration
Pass a comma-separated string for simple presets, or an object for advanced control:
// Simple comma-separated
"presets": "25,50,100,250"
// Advanced object format
"presets": {
"presets": [
{ "label": "$25", "amount": 25 },
{ "label": "$50", "amount": 50 },
{ "label": "{{currency_symbol}}100", "amount": 100 },
{ "label": "Other Amount", "amount": "", "type": "input" }
],
"fullWidthPresets": true,
"presetsAsSelect": false
}
| Property | Type | Description |
|---|---|---|
| presets | array | Array of preset objects (see below) |
| fullWidthPresets | boolean | Render preset buttons at full width |
| presetsAsSelect | boolean | Render presets as a dropdown select instead of buttons |
Preset Object Properties
| Property | Type | Description |
|---|---|---|
| label | string | Display text for the preset. Supports {{currency_symbol}} placeholder. |
| amount | number | Donation amount in dollars |
| amount_in_cents | number | Alternative: specify amount in cents instead of dollars |
| type | string | Set to "input" to render as an editable text field instead of a button |
Donor Fields
Control which donor information fields are shown on the form. Most fields accept either true to enable with defaults, or a configuration object for more control.
| Option | Type | Description |
|---|---|---|
| string | Pre-fill the donor's email address | |
| name | object | boolean | Show first/last name fields. See name configuration. |
| address | object | boolean | Show full address fields (street, city, state, zip, country). See address configuration. |
| phone | object | boolean | Show phone number field. See phone configuration. |
| comment | boolean | Show comment/message field |
| onbehalfof | boolean | Show "on behalf of" / tribute field |
| anonymous | boolean | Show "make my donation anonymous" checkbox |
Field Configuration
Fields that accept objects can be passed as true to enable with defaults, or as an object for granular control.
name
// Enable with defaults
"name": true
// With options
"name": { "required": true }
| Property | Type | Description |
|---|---|---|
| required | boolean | Make first and last name fields required |
phone
// Enable with defaults (required)
"phone": true
// Enable but optional
"phone": { "required": false }
| Property | Type | Description |
|---|---|---|
| required | boolean | Make the phone field required (default: true). Set to false to make it optional. |
address
// Enable with defaults (required)
"address": true
// With full options
"address": {
"required": true,
"preselect_country": "US",
"disabled": false
}
| Property | Type | Description |
|---|---|---|
| required | boolean | Make all address fields required (street, city, state, zip, country). Set to false to make optional. |
| preselect_country | boolean | string | Set to true to auto-detect the donor's country, or pass a country code (e.g., "US", "CA", "GB") to pre-select a specific country. |
| disabled | boolean | Lock the country dropdown so it cannot be changed. Only applies when preselect_country is set. |
Donor Pays Fees
The donor-pays-fees option lets donors opt in to covering transaction fees so the nonprofit receives the full donation amount. This option supports multiple configuration formats depending on how much control you need.
Simple Boolean
Enable with default fee calculations for all payment methods:
"donor-pays-fees": true
Simple Percentage
Apply a single percentage across all payment methods:
"donor-pays-fees": "0.042"
Per-Payment-Method Configuration
For full control, pass an object with fee settings for each payment method:
"donor-pays-fees": {
"preselected": true,
"cc": {
"processor_percent": 0.029,
"processor_fixed": 0.30,
"dntly_percent": 0.04,
"complex_calc": true
},
"ach": {
"processor_percent": 0.008,
"processor_fixed": 0,
"processor_cap": 5.00,
"dntly_percent": 0.04,
"complex_calc": true
},
"paypal": {
"processor_percent": 0.029,
"processor_fixed": 0.30,
"dntly_percent": 0.04
}
}
Top-Level Properties
| Property | Type | Description |
|---|---|---|
| preselected | boolean | Pre-check the "cover fees" checkbox when the form loads (default: false) |
Payment Method Properties
Each payment method key (cc, ach, paypal, wallet, cash) accepts these properties:
| Property | Type | Default (CC) | Default (ACH) | Description |
|---|---|---|---|---|
| processor_percent | number | 0.029 | 0.008 | Processor percentage fee as a decimal (e.g., 0.029 = 2.9%). Must be between 0 and 1. |
| processor_fixed | number | 0.30 | 0 | Fixed per-transaction fee in dollars (e.g., 0.30 = 30 cents) |
| processor_cap | number | null | null | null | Maximum cap on processor fees in dollars (e.g., 5.00 for ACH). Set to null for no cap. |
| dntly_percent | number | 0.04 | 0.04 | Donately platform percentage fee as a decimal (e.g., 0.04 = 4%). Must be between 0 and 1. |
| complex_calc | boolean | true | true | Use the precise fee calculation algorithm. When false, uses a simpler calculation. |
Common Examples
// Flat 3% fee on credit card donations
"donor-pays-fees": {
"cc": {
"processor_percent": 0.03,
"processor_fixed": 0,
"dntly_percent": 0,
"complex_calc": false
}
}
// Flat $2.50 fee on all donations
"donor-pays-fees": {
"cc": {
"processor_percent": 0,
"processor_fixed": 2.50,
"dntly_percent": 0,
"complex_calc": false
}
}
// ACH with $5 cap
"donor-pays-fees": {
"ach": {
"processor_percent": 0.008,
"processor_fixed": 0,
"processor_cap": 5.00,
"dntly_percent": 0.04
}
}
Recurring Donation Options
Configure how recurring donations are presented to donors.
Using recurring-options (Recommended)
"recurring-options": {
"frequencies": ["false", "1.month", "3.month", "12.month"],
"type": "toggle"
}
| Property | Description |
|---|---|
| frequencies | Array of frequency options to display. "false" = one-time option. |
| type | Display style: "toggle" or default radio buttons |
Available Frequencies
| Value | Description |
|---|---|
| false | One-time donation |
| 1.day | Daily |
| 7.day | Weekly |
| 14.day | Bi-weekly |
| 1.month | Monthly |
| 2.month | Bi-monthly |
| 3.month | Quarterly |
| 6.month | Semi-annually |
| 12.month | Annually |
Legacy Options
| Option | Description |
|---|---|
| recurring-frequency | Legacy: comma-separated frequencies or JSON array |
| recurring-start | Start date for the recurring schedule |
| recurring-stop | End date for the recurring schedule |
Payment Methods
Control which payment methods are available on the form.
"payment-options": "cc,wallet,ach,paypal"
| Value | Description |
|---|---|
| cc | Credit / debit card via Stripe |
| wallet | Apple Pay / Google Pay via Stripe |
| ach | ACH bank transfer via Stripe |
| paypal | PayPal (requires PayPal merchant ID) |
| Option | Description |
|---|---|
| payment-options | Comma-separated list of enabled payment methods |
| payment-options-layout | Layout style: horizontal or vertical |
| paypal-merchant-id | PayPal merchant ID (required for PayPal) |
Custom Fields
Add custom form fields that are stored as metadata on the donation. Pass as a JSON array.
"custom-fields": [
{
"type": "text",
"label": "Company Name",
"name": "company_name",
"required": true
},
{
"type": "select",
"label": "How did you hear about us?",
"name": "referral_source",
"options": ["Google", "Social Media", "Friend", "Event", "Other"]
},
{
"type": "checkbox",
"label": "Add me to the mailing list",
"name": "mailing_list"
},
{
"type": "section",
"label": "Additional Information"
},
{
"type": "hidden",
"name": "source",
"value": "website-homepage"
}
]
Field Types
| Type | Description |
|---|---|
| text | Single-line text input |
| Email input with validation | |
| textarea | Multi-line text area |
| select | Dropdown select. Provide options array. |
| radio | Radio button group. Provide options array. |
| checkbox | Single checkbox |
| select_state | US state dropdown (pre-populated) |
| select_country | Country dropdown (pre-populated) |
| select_campaign | Dropdown of account campaigns |
| select_fundraiser | Dropdown of campaign fundraisers |
| hidden | Hidden field with preset value |
| section | Visual section divider / heading |
| cart_items | Merchandise / cart item selector |
Styling & Themes
Pre-built Themes
"theme": "clean"
Available themes: clean, minimal, and more.
Custom Theme (CSS Variables)
Override specific CSS variables to match your brand:
"custom-theme": {
"-PrimaryColor": "#4A90D9",
"-PrimaryFontFamily": "Helvetica, Arial, sans-serif",
"-PrimaryFontSize": "16px",
"-FormBackgroundColor": "#ffffff",
"-FormOuterPadding": "20px",
"-FieldBorderColor": "#cccccc",
"-FieldBorderWidth": "1px",
"-FieldBackgroundColor": "#fafafa",
"-FieldFontColor": "#333333",
"-LabelFontColor": "#555555",
"-ErrorTextColor": "#dc3545"
}
Available CSS Variables
| Variable | Description |
|---|---|
| -PrimaryColor | Main brand / button color |
| -PrimaryFontFamily | Font family for all form text |
| -PrimaryFontSize | Base font size |
| -FormBackgroundColor | Form container background |
| -FormOuterPadding | Padding around the form |
| -FieldBackgroundColor | Input field background |
| -FieldFontColor | Input field text color |
| -FieldBorderColor | Input field border color |
| -FieldBorderWidth | Input field border width |
| -LabelFontColor | Label text color |
| -ErrorTextColor | Error/validation message color |
Custom CSS
For full control, inject custom CSS:
"custom-css": ".dntly-form .dntly-submit-btn { border-radius: 50px; }"
Internationalization
The form supports multiple languages out of the box.
| Option | Description |
|---|---|
| i18n-locale | Language/locale code |
| show-language-select | Show a language selector dropdown on the form |
| custom-translations-url | URL to a custom translation JSON file |
Supported Locales
en_US— English (US) — defaultes_ES— Spanishfr_CA— French (Canadian)de_DE— Germanit_IT— Italiansv_SE— Swedishzh_HK— Chinese (Hong Kong)
Confirmation Screen
Customize what donors see after a successful donation. You can change the thank-you message, enable social sharing, or redirect to an external page.
"confirmation-config": {
"thank_you_message_header": "Thank you for your {{formatted_amount}} donation!",
"thank_you_message_subheader": "A receipt has been sent to {{email}}.",
"display_social_icons": true,
"social_share_message": "I just donated to {{social_share_account_title}}!",
"social_share_account_title": "Our Nonprofit",
"social_share_url": "https://example.org/donate",
"twitter_hashtags": "donate,giveback"
}
Message Options
| Property | Type | Description |
|---|---|---|
| thank_you_message_header | string | Main heading shown after donation. Supports {{formatted_amount}} placeholder. |
| thank_you_message_subheader | string | Secondary message (e.g., receipt info). Supports {{email}} placeholder. |
Social Sharing Options
| Property | Type | Description |
|---|---|---|
| display_social_icons | boolean | Show social share buttons (Facebook, Twitter, Email) on the confirmation screen |
| social_share_message | string | Message used when sharing. Supports {{social_share_account_title}} placeholder. |
| social_share_account_title | string | Organization name displayed in share messages |
| social_share_url | string | URL shared on social media (e.g., your donation page) |
| twitter_hashtags | string | Comma-separated hashtags for Twitter shares (e.g., "donate,giveback") |
Redirect Options
| Property | Type | Description |
|---|---|---|
| redirect_url | string | URL to redirect the donor to after a successful donation. When set, the confirmation screen is skipped. |
| redirect_with_payload | boolean | Include the full donation data as a query parameter in the redirect URL |
| disable_confirmation | boolean | Skip the confirmation screen entirely without redirecting |
Redirect with Payload Example
When redirect_with_payload is true, the donor is redirected with the complete donation object appended as a query parameter. This includes the donation ID, amount, donor email, subscription details, and metadata.
"confirmation-config": {
"redirect_url": "https://example.org/thank-you",
"redirect_with_payload": true
}
URL Parameter Prefill
You can pre-populate form values by appending query parameters to the donation page URL. This works on hosted Donately pages (pages.donately.com) and on any page where the form is embedded directly (HTTPS required).
There are two types of URL parameters:
- Form Option — Sets a form configuration option (e.g., default amount, campaign, recurring frequency). Uses short parameter names like
amount,campaign-id. - Field Prefill — Directly sets the value of a form input field after the form loads. Uses
donately-prefixed parameter names that match the field element IDs (e.g.,donately-first-name,donately-email).
Example
https://pages.donately.com/yourorg/form/frm_xxxx?campaign-id=cmp_7ce279325f9e&recurring-frequency=1.month&amount=55
Form Option Parameters
These parameters set form configuration options. Values are validated and only whitelisted parameters are accepted.
| Parameter | Type | Description | Example |
|---|---|---|---|
| amount | Form Option | Pre-set the donation amount (in dollars) | amount=55 |
| campaign-id | Form Option | Attribute the donation to a specific campaign | campaign-id=cmp_7ce279325f9e |
| fundraiser-id | Form Option | Attribute the donation to a specific fundraiser | fundraiser-id=fun_xxxx |
| currency | Form Option | Set the currency (3-letter ISO code) | currency=usd |
| recurring-frequency | Form Option | Pre-select a recurring frequency | recurring-frequency=1.month |
| presets | Form Option | Set preset donation amounts (comma-separated) | presets=25,50,100,250 |
| comment | Form Option | Show or hide the comment field | comment=true |
| onbehalfof | Form Option | Show or hide the "on behalf of" field | onbehalfof=true |
| anonymous | Form Option | Show or hide the anonymous checkbox | anonymous=true |
| address | Form Option | Show or hide the address fields | address=true |
| phone | Form Option | Show or hide the phone field | phone=true |
Field Prefill Parameters
These parameters directly set the value of form input fields after the form loads. Use the field's element ID as the parameter name.
| Parameter | Type | Description |
|---|---|---|
| donately-amount | Field Prefill | Donation amount input |
| donately-email | Field Prefill | Email address |
| donately-first-name | Field Prefill | First name |
| donately-last-name | Field Prefill | Last name |
| donately-phone-number | Field Prefill | Phone number |
| donately-comment | Field Prefill | Comment / message |
| donately-anonymous | Field Prefill | Anonymous checkbox (true / false) |
| donately-onbehalf | Field Prefill | On behalf of / tribute name |
| donately-street-address | Field Prefill | Street address line 1 |
| donately-street-address-2 | Field Prefill | Street address line 2 |
| donately-city | Field Prefill | City |
| donately-state | Field Prefill | State / Province |
| donately-zip-code | Field Prefill | ZIP / Postal code |
| donately-country | Field Prefill | Country |
| donately-donor-pays-fees | Field Prefill | Donor pays fees checkbox (true / false) |
Example: Multiple Parameters
https://pages.donately.com/yourorg/form/frm_xxxx?amount=100&recurring-frequency=1.month&campaign-id=cmp_xxxx&donately-email=jane@example.com&donately-first-name=Jane&donately-last-name=Doe
%20. Checkbox fields accept true or false as values.
?utm_source=email&utm_campaign=spring2025).
Callbacks & Events
Callbacks are passed in the Donately.init() configuration:
| Callback | Description |
|---|---|
| afterFormLoad | Fires when the form has fully rendered and is ready |
| onSuccess | Fires after a successful donation. Receives the donation object. |
| onError | Fires on a donation error. Receives the error object. |
| afterNavigateHook | Fires after step navigation. Receives the current step number. |
Example
Donately.init({
selector: '#my-form',
options: { ... },
onSuccess: function(donation) {
// Redirect to a thank-you page
window.location.href = '/thank-you?amount=' + donation.amount_in_cents;
},
onError: function(error) {
console.error('Donation failed:', error.message);
}
});
3rd Party & Analytics
The form supports built-in tracking for Google Analytics and Facebook Pixel, as well as integrations with third-party services.
| Option | Description |
|---|---|
| google-analytics-id | Google Analytics property ID (e.g., UA-XXXXX-X or G-XXXXX) |
| facebook-pixel | Facebook Pixel ID for conversion tracking |
| double-the-donation-public-key | Double the Donation public key for employer matching |
Donate Button (Overlay Mode)
Display the form as a modal overlay triggered by a button:
"donate-button": {
"location": "bottom-right",
"text": "Donate Now"
}
The donate button floats on the page and opens the form in a modal when clicked. Available positions: bottom-right, bottom-left.
Iframe Mode
When the form is embedded cross-domain or needs additional security isolation, it runs inside an iframe automatically. You can control iframe dimensions:
| Option | Description |
|---|---|
| iframe-height | Custom iframe height in pixels (default: auto-resize) |
| iframe-width | Custom iframe width (default: 100%) |
The form automatically communicates resize events to the parent page so the iframe height adjusts to fit the content.
Additional Options
| Option | Type | Description |
|---|---|---|
| ecard | JSON | E-card configuration for tribute/memorial donations |
| tracking-codes | JSON | Custom tracking codes stored with the donation |