Skip to content

Embedding Donation Forms

Embed Script & Partner Key

Make sure to read our guide on the embed script and partner key and include the script on your page before embedding the donation form.

You can embed a donation form from your fundraisers on your website. Fundraisers can be created in a variety of ways, and so have several different ways of being embedded. The two most common fundraiser types are listed below.

Fundraisers created via the fundraiser API can be embedded by using your partner key and the fundraiser ID. Replace [PARTNER KEY] with your partner key and [FUNDRAISER ID] with the ID of your fundraiser in the following embed code, and place it where you want the donation form to appear on your page.

<div class="plg-donate"
data-partner-key="[PARTNER KEY]"
data-item-id="[FUNDRAISER ID]"></div>

Fundraisers created via the Impact Hub typically have a widget ID that you can find on the share dialog for the fundraiser that you can access within the Impact Hub. Replace [WIDGET ID] with the widget ID in the following embed code and place it where you want the donation form to appear on your page.

<div class="plg-donate" data-widget-id="[WIDGET ID]"></div>

See the link to the full reference in the next section to learn about more ways to embed donation forms.

You can customize the donation form by adding additional attributes to the embed code. The following reference will also explain how to embed donation forms without creating fundraisers.

When a donation is made it triggers events (via postMessage) that your application can consume. The format for the postMessage payload is a stringified JSON object specifying the associated data. Our donation widgets come in two variations, “Tipping” and “Cover costs”. Each one has a slightly different postMessage payload. Alternatively, if you have a webhook endpoint configured, you will be notified of donations that way. See our webhook documentation for more information.

{
"message": "DonateCompleted",
"data": {
"amount": "20",
"tip": "3",
"total": "23"
}
}
{
"message": "DonateCompleted",
"data": {
"amount": "20",
"fees": "1.93",
"total": "21.93"
}
}