Consumers increasingly choose brands that give back. A 2024 Edelman survey found that 64% of shoppers will buy from or boycott a brand based on its social and environmental values. For developers building e-commerce apps, that’s a clear signal: impact features aren’t a nice-to-have anymore. They ship to production.
The problem is that most developers reach for the most obvious tool first: a payment processor’s donation add-on, a standalone fundraising widget, or a hand-rolled redirect to a charity’s own donation page. These options work but they create friction, introduce a third-party domain into the checkout flow, and don’t give you a clean transaction record tied to your order data.
There’s a better approach. GoodAPI’s charity donations API, a full-featured donation API for developers, lets you programmatically search vetted nonprofits, record a donation at the moment of a transaction, and pull a full giving history for your organization. Unlike standalone donation API widgets, it runs alongside GoodAPI’s tree planting and ocean plastic removal APIs under the same API key and the same monthly invoice. One integration, multiple impact types.
In short, this donation API gives you charity search across 1.3 million verified 501(c)(3) nonprofits plus a donate endpoint, and GoodAPI handles Commercial Co-Venture (CCV) compliance across US states so your team doesn’t have to.
This guide walks through the API in detail, with real code and patterns you can drop into your app today.
Why a Dedicated Charity API Beats Widget Approaches
Donation widgets from platforms like JustGiving or FrontStream work well for nonprofits collecting money directly. They’re the wrong fit for e-commerce backends.
Here’s the difference. When a merchant wants to donate $1 to a food bank for every order placed, they don’t need a donor checkout experience. They need a server-side call after the order webhook fires. No payment form, no redirect, no UX break. Just a POST request that records the giving and ties it to the order ID.
GoodAPI’s charity API is built for exactly this workflow. You pass an order ID in the metadata field, an EIN (Employer Identification Number) to identify the charity, and an amount in cents. The donation is recorded, attribution is tracked, and the result is returned in the response. It’s the same pattern you’d use to plant a tree per order, and you can do both in the same webhook handler.
Search vs Donate: Directory Intent vs Payment Intent
Queries like charity search API, 501c3 API, and EIN charity lookup API usually mean a directory product. CharityAPI.org, Candid, ProPublica, and Every.org search answer “is this EIN real?” and return organization metadata. That is useful, and it is not the same job as attaching a gift to a Shopify or custom checkout order.
GoodAPI covers both halves in one integration:
- Search with
GET /charities/searchwhen you need to resolve a name or EIN before you hardcode the nonprofit into your webhook. - Donate with
POST /charities/donatewhen the order fires and you need a recorded gift, attribution metadata, and idempotency against retries.
If you only need IRS nonprofit verification for compliance screening, a directory API can be enough. If you need search plus a payment-shaped donate step next to tree planting and plastic recovery, use GoodAPI’s charity endpoints under the same key and invoice. For the merchant product surface (round-ups and percentage of sales without writing webhook code), see the donations page.
How GoodAPI Compares to Pledge and Change APIs
Pledge, Change, and GoodAPI all let you search nonprofits and record donations from your own backend with an API key. The real differences are how fees are charged, whether there is a monthly platform cost, and whether other impact actions like tree planting and plastic removal run on the same key. Here is how the three line up for a developer choosing a donation API.
| Provider | Monthly platform fee | Per-donation fee | Nonprofit access | Extra notes |
|---|---|---|---|---|
| GoodAPI | Give $15/mo flat, Lead $49/mo for API access | No percentage cut taken by GoodAPI | Access to 1.3 million charities, up to 3 featured per campaign | Same key for trees and plastic, CCV compliance handled, self-serve keys |
| Pledge | No charge to use the API | 5% technology fee on Donate API gifts, plus payment method fees | Searchable nonprofit database via API | Donations batched and charged to a card or bank on file |
| Change | $999/mo (Plus) to $3,500/mo (Professional Fundraiser) | 1.9% to 2.49% per transaction, by plan | Nonprofit search and donations API | Higher tiers add nationwide CCV and fundraiser compliance |
Competitor prices are as of Oct 2026, taken from Pledge’s API page and Change’s company pricing. Check both before you commit, since pricing pages change.
Pledge
Pledge is a solid choice when donations are part of a rewards or points program, or when you want ready-made giving widgets alongside the API. There is no fee to call the API, and the Pledge fee breakdown explains that a 5% technology fee comes out of each Donate API gift, plus card processing of 2.9% plus 30 cents per aggregated charge to your card on file. On $100 of batched donations, that works out to $91.80 reaching nonprofits. Pledge also offers a staging environment for testing.
Change
Change targets companies running compliance-heavy cause marketing, sweepstakes, and professional fundraising programs. Its donations API uses public and secret keys with separate sandbox and live environments, and pledged donations are invoiced monthly. The Commercial Co-Venturer plan at 1.9% plus $2,500/mo includes nationwide legal compliance and state campaign reporting, which suits enterprise teams with dedicated legal and finance support.
When GoodAPI Fits
GoodAPI fits when you want a predictable flat fee instead of a percentage of every gift. Give is $15/mo with no percentage cut and CCV compliance handled, and the same API key also plants trees and removes ocean plastic, so one webhook handler can run your whole impact stack. Shopify merchants can use the no-code donations app, and developers on any platform can get a key at app.thegoodapi.com.
The Three Endpoints You Need
The charity donations API is publicly available, and any app can embed donations. Sign up at app.thegoodapi.com to get your API key. It lives at https://app.thegoodapi.com and uses the same Authorization header as the rest of GoodAPI’s APIs.
Search Charities
GET /charities/search
Use this to look up charities by name or EIN before donating. Results include the charity’s nonprofit_id, description, and website.
curl -H "Authorization: your-api-key" \ "https://app.thegoodapi.com/charities/search?name=american+red+cross"Response:
{ "total_items": 1, "total_pages": 1, "charities": [ { "nonprofit_id": "n_abc123", "name": "American Red Cross", "ein": "53-0196605", "description": "Prevents and alleviates human suffering", "website": "https://www.redcross.org", "icon_url": "https://example.com/redcross-icon.png" } ]}You’d typically call this endpoint once when setting up your integration, save the nonprofit_id and EIN for the charities you want to support, and hardcode those values in your donation logic.
Create a Donation
POST /charities/donate
This is the core endpoint. Call it whenever you want to record a charitable giving event.
curl -X POST -H "Authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "amount_cents": 100, "ein": "53-0196605", "idempotency_key": "order-98765-donate", "attribution": "checkout", "metadata": { "order_id": "98765", "customer_email": "shopper@example.com" } }' \ "https://app.thegoodapi.com/charities/donate"The required fields are amount_cents and either ein or nonprofit_id. Everything else is optional but highly recommended for production.
List Donations
GET /charities/donations
Retrieve paginated donation history with optional filters for date range, attribution tag, or metadata values. Useful for impact dashboards or monthly reports.
curl -H "Authorization: your-api-key" \ "https://app.thegoodapi.com/charities/donations?attribution=checkout&start_date=2026-05-01&end_date=2026-05-31"Idempotency: Don’t Double-Donate
E-commerce webhooks can fire more than once. Payment processors retry on failure. Order management systems sometimes call the same event twice. Without idempotency, you risk recording the same donation multiple times for a single order.
The idempotency_key field handles this. Pass a unique string per order-donation pair (e.g. order-{id}-donate). If GoodAPI receives a request with an existing idempotency key, it returns the original donation record and adds the header Idempotent-Replayed: true to the response instead of creating a new entry.
Attribution Tags: Track Where Impact Comes From
The attribution field is a free-text string you set per donation. Use it to understand which flows in your app are driving giving.
Some practical examples:
"attribution": "checkout"for donations triggered at order placement"attribution": "subscription-renewal"for recurring billing events"attribution": "referral-campaign-2026-q2"for a limited promotion"attribution": "loyalty-milestone"for loyalty program events
Later you can filter your donations list by attribution to build campaign-level reports without needing to build your own ledger.
Combining Charity Donations With Tree Planting
This is where GoodAPI’s multi-product design pays off. If you already use GoodAPI for tree planting, you can drop a charity donation call right next to your existing tree planting call in the same webhook handler. Same API key, same billing relationship.
// Shopify order webhook handlerapp.post('/webhooks/orders/create', async (req, res) => { const order = req.body; const orderId = order.id.toString();
await Promise.all([ // Plant a tree with Veritree via GoodAPI fetch('https://app.thegoodapi.com/plant-trees', { method: 'POST', headers: { 'Authorization': process.env.GOODAPI_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ count: 1, idempotency_key: `${orderId}-tree`, metadata: { order_id: orderId } }) }),
// Donate $1 to a local food bank via GoodAPI charity API fetch('https://app.thegoodapi.com/charities/donate', { method: 'POST', headers: { 'Authorization': process.env.GOODAPI_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ amount_cents: 100, ein: '13-1837418', idempotency_key: `${orderId}-donate`, attribution: 'checkout', metadata: { order_id: orderId } }) }) ]);
res.sendStatus(200);});The two calls run in parallel. Each tree is planted through GoodAPI’s partnership with Veritree, where trees are GPS-tracked and supported through their critical first years of growth. The charity donation is recorded against the nonprofit’s EIN. Both are consolidated on your monthly GoodAPI invoice.
Four E-Commerce Use Cases
Per-Order Donations at Checkout
The most common pattern: donate a fixed amount per order. Run the donation call in your order-created webhook. Use attribution: "checkout" and store the order_id in metadata. This gives you a clean record matching every charitable donation to a specific transaction.
Subscription Renewals
For subscription businesses, fire the donation on each renewal event rather than at signup. This way the giving is ongoing, which is a much stronger story for customers to share. Use attribution: "subscription-renewal" to separate these from one-time purchase donations.
Minimum Order Threshold Giving
If you want to give only on orders above a certain value (e.g., donate $2 to charity on orders over $50), run the threshold check on your server before calling the API. There’s no threshold logic built into the API itself, which keeps it simple and flexible.
Milestone and Loyalty Rewards
Trigger a donation when a customer hits a loyalty milestone, completes their 10th order, or refers a friend. Use attribution: "loyalty-milestone" to track these. Combined with Shopify Flow, you can build this as a no-code automation that fires the API via a webhook action.
Setting Up Your Integration
Get your API key
Sign up at app.thegoodapi.com and grab your API key. You’ll get both a production key and a test key. Use the test key during development, behaving identically to production but won’t create real charges or real donations.
Look up your charities
Call GET /charities/search to find the EINs for the nonprofits you want to support. Save those EINs in your config or environment variables and you won’t need to search again after the initial setup. Named causes merchants already feature include the Breast Cancer Research Foundation and Seek Her Foundation, which you can resolve by name or EIN the same way.
Add the donation call to your webhook handler
In your order-created webhook, call POST /charities/donate with amount_cents, the charity EIN, an idempotency_key derived from the order ID, and relevant metadata. Start with attribution: "checkout" to track which donations come from your main purchase flow.
Verify with the list endpoint
After your first test order, call GET /charities/donations to confirm the donation was recorded with the correct metadata and attribution. Switch to your production key when you’re ready to go live.
What Gets Validated
GoodAPI validates the charity against its search provider before recording the donation. If the EIN doesn’t match a known charity, the request returns a 400 error with a clear message. This prevents accidental donations to invalid or unverified organizations.
Building a Giving Dashboard
If you’re building a platform for multiple merchants, the metadata and attribution fields give you everything you need for per-merchant reporting. Store the merchant’s store ID in metadata, filter the donations list by that value, and aggregate totals by charity, date range, or attribution tag.
This is particularly useful if you’re building a Shopify app where merchants want to see charitable giving data alongside their tree planting and plastic removal impact in a single view.
Get Started
The charity donations API is publicly available. Any app can embed donations: sign up at app.thegoodapi.com and grab your API key to start calling the charity endpoints.
If you’re building a Shopify store rather than a custom app, the GoodAPI app handles tree planting and plastic removal with no code required. The charity donations feature is designed for developers building custom integrations on any platform.
For full documentation including request and response schemas, visit the GoodAPI charity donations docs.
Related Guides
If you are evaluating the product side rather than the API, see the GoodAPI donations product for how round-ups and percentage-of-sales giving work inside Shopify. For named cause examples you can search and feature, see GoodAPI’s live partner pages for the Breast Cancer Research Foundation and Seek Her Foundation. To run a campaign that pairs customer giving with a brand match, read how to run a donation-matching campaign on Shopify. Full endpoint reference lives in the charity donations API docs.