Embeddable Donation Form

Version 6.x — Drop-in donation form for any website.

Quick Start

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.

This documentation covers version 6.x (current production). Version 7.x is a major rebuild and is coming soon.

Simplest Embed

Add a single script tag and a target div to your page:

<script
  src="https://cdn.donately.com/6.0/donately.min.js"
  data-donately-id="act_ba7d12ab27bb"
  data-stripe-publishable-key="pk_live_xxxx"
  defer async>
</script>
<div id="donation-form"></div>

That's it. The form will render automatically with default settings.

Embedding Methods

Method 1: Script Tag Attributes

Pass options directly as data- attributes on the script tag. Best for simple embeds.

<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-amount="50"
  data-presets="25,50,100,250"
  data-currency="usd"
  data-comment="true"
  defer async>
</script>
<div id="donation-form"></div>

Method 2: JavaScript Initialization

Use Donately.init() for full control over options and callbacks.

<script src="https://cdn.donately.com/6.0/donately.min.js" defer async></script>
<div id="my-form"></div>

<script>
  Donately.init({
    selector: '#my-form',
    options: {
      "donately-id": "act_ba7d12ab27bb",
      "stripe-publishable-key": "pk_live_xxxx",
      "donately-form-id": "frm_xxxx",
      "amount": 50,
      "presets": "25,50,100,250",
      "currency": "usd",
      "comment": true,
      "address": true,
      "recurring-options": {
        "frequencies": ["false", "1.month", "12.month"],
        "type": "toggle"
      }
    },
    afterFormLoad: function() {
      console.log('Form loaded');
    },
    onSuccess: function(donation) {
      console.log('Donation complete:', donation);
    },
    onError: function(error) {
      console.error('Error:', error);
    }
  });
</script>

Required Options

OptionDescription
donately-idYour Donately account ID (e.g., act_ba7d12ab27bb)
stripe-publishable-keyYour Stripe publishable key (starts with pk_live_ or pk_test_)

Donation Options

OptionTypeDescription
donately-form-idstringForm ID to fetch pre-configured options from the API (e.g., frm_xxxx)
amountnumberDefault donation amount in dollars
presetsstringComma-separated preset amounts (e.g., "25,50,100,250")
campaign-idstringCampaign to attribute donation to
fundraiser-idstringFundraiser to attribute donation to
currencystringISO currency code (default: usd)
donor-pays-feesbooleanShow option for donor to cover transaction fees
dont-send-receipt-emailbooleanSuppress the automatic donation receipt email

Donor Fields

Control which donor information fields are shown on the form.

OptionTypeDescription
emailstringPre-fill the donor's email address
namestringPre-fill the donor's name
addressbooleanShow full address fields (street, city, state, zip, country)
billing-zipbooleanShow billing zip code field only (lighter than full address)
phonebooleanShow phone number field
commentbooleanShow comment/message field
onbehalfofbooleanShow "on behalf of" / tribute field
anonymousbooleanShow "make my donation anonymous" checkbox

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"
}
PropertyDescription
frequenciesArray of frequency options to display. "false" = one-time option.
typeDisplay style: "toggle" or default radio buttons

Available Frequencies

ValueDescription
falseOne-time donation
1.dayDaily
7.dayWeekly
14.dayBi-weekly
1.monthMonthly
2.monthBi-monthly
3.monthQuarterly
6.monthSemi-annually
12.monthAnnually

Legacy Options

OptionDescription
recurring-frequencyLegacy: comma-separated frequencies or JSON array
recurring-startStart date for the recurring schedule
recurring-stopEnd date for the recurring schedule

Payment Methods

Control which payment methods are available on the form.

"payment-options": "card,wallet,ach,paypal"
ValueDescription
ccCredit card (legacy Stripe token flow)
cardCredit/debit card via Stripe Elements
walletApple Pay / Google Pay via Stripe
achACH bank transfer via Stripe + Plaid
paypalPayPal (requires PayPal merchant ID)
OptionDescription
payment-optionsComma-separated list of enabled payment methods
payment-options-layoutLayout style: horizontal or vertical
paypal-merchant-idPayPal 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

TypeDescription
textSingle-line text input
emailEmail input with validation
textareaMulti-line text area
selectDropdown select. Provide options array.
radioRadio button group. Provide options array.
checkboxSingle checkbox
select_stateUS state dropdown (pre-populated)
select_countryCountry dropdown (pre-populated)
select_campaignDropdown of account campaigns
select_fundraiserDropdown of campaign fundraisers
hiddenHidden field with preset value
sectionVisual section divider / heading
cart_itemsMerchandise / 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

VariableDescription
-PrimaryColorMain brand / button color
-PrimaryFontFamilyFont family for all form text
-PrimaryFontSizeBase font size
-FormBackgroundColorForm container background
-FormOuterPaddingPadding around the form
-FieldBackgroundColorInput field background
-FieldFontColorInput field text color
-FieldBorderColorInput field border color
-FieldBorderWidthInput field border width
-LabelFontColorLabel text color
-ErrorTextColorError/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.

OptionDescription
i18n-localeLanguage/locale code
show-language-selectShow a language selector dropdown on the form
custom-translations-urlURL to a custom translation JSON file

Supported Locales

  • en_US — English (US) — default
  • es_ES — Spanish
  • fr_CA — French (Canadian)
  • de_DE — German
  • it_IT — Italian
  • sv_SE — Swedish
  • zh_HK — Chinese (Hong Kong)

Form Navigation

Configure multi-step form navigation to break the form into logical steps. Pass a JSON object with step definitions:

"form-navigation": {
  "steps": [
    {
      "label": "Amount",
      "sections": ["presets", "amount", "donorpaysfees", "recurringgroup"]
    },
    {
      "label": "Payment",
      "sections": ["paymentmethods"]
    },
    {
      "label": "Your Info",
      "sections": ["namegroup", "email", "phone", "addressgroup", "comment"]
    },
    {
      "label": "Review",
      "sections": ["summary", "submit"]
    }
  ]
}

Available Sections

SectionDescription
presetsPreset amount buttons
amountCustom amount input
donorpaysfeesDonor covers fees checkbox
recurringgroupRecurring frequency selector
paymentmethodsPayment method selection (card, ACH, PayPal, etc.)
authnameCard holder name
namegroupFirst and last name fields
emailEmail field
phonePhone number field
addressgroupStreet address fields
citygroupCity, state, zip fields
countrygroupCountry selector
billingzipBilling zip code only
commentComment / message field
onbehalfOn behalf of / tribute field
anonymousAnonymous donation checkbox
ecardE-card configuration
dtdDouble the Donation employer match
summaryDonation summary/review
submitSubmit / donate button

Callbacks & Events

Callbacks are passed in the Donately.init() configuration:

CallbackDescription
afterFormLoadFires when the form has fully rendered and is ready
onSuccessFires after a successful donation. Receives the donation object.
onErrorFires on a donation error. Receives the error object.
afterNavigateHookFires 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);
  }
});

Iframe Events

When the form runs inside an iframe, it communicates with the parent page via postMessage events:

  • donately.loaded — Form has loaded
  • donately.success — Donation succeeded
  • donately.error — Donation failed
  • donately.resized — Form height changed (for auto-resizing iframes)

Analytics Integration

The form supports built-in tracking for Google Analytics, Google Tag Manager, and Facebook Pixel.

OptionDescription
google-analytics-idGoogle Analytics property ID (e.g., UA-XXXXX-X or G-XXXXX)
google-tag-manager-idGoogle Tag Manager container ID (e.g., GTM-XXXXX)
facebook-pixelFacebook Pixel ID for conversion tracking
double-the-donation-public-keyDouble the Donation public key for employer matching

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:

OptionDescription
iframe-heightCustom iframe height in pixels (default: auto-resize)
iframe-widthCustom 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

OptionTypeDescription
ecardJSONE-card configuration for tribute/memorial donations
tracking-codesJSONCustom tracking codes stored with the donation
privacy-policystringURL to your privacy policy (displayed as a link on the form)
google-recaptcha-site-keystringGoogle reCAPTCHA site key for bot protection
fetch-configbooleanFetch form configuration from the API using the form ID (default: true when form-id is set)