Checkout
Send a payer to a Daffodil-hosted page to pay into a Fund or give to a Campaign, then follow the Contribution to its Ledger entry.
Daffodil Checkout takes a payment into a Fund for you. You create a Checkout Session, send the payer to its url, and Daffodil shows the page in your Account's Donor Hub branding, takes the payment, and sends the payer back to you. The money is held by your sponsor, which issues the tax receipt. You never handle card or bank details.
A Checkout Session is for one of these payers:
- A Donor who pays into a Fund they advise.
- A Public contributor who gives to a Campaign, or to a Shared fund. A Public contributor has no Donor record. Daffodil asks them for their details on the page.
The payer pays by card, or by ACH bank debit where your Account offers it. Apple Pay, Google Pay, and Link are card payments, so they are available when the payer's device supports them. A Donor can also send a wire, a check, stock, or a grant from another donor-advised fund (see Wire, check, stock, and DAF transfer).
How a payment moves
- Create a Checkout Session for a Fund and the Donor who pays, or for a Campaign. It is
open. - Redirect the payer to its
url. They choose the amount (unless you set one) and the method, then pay. - When the payment completes, the session is
completeand a Contribution is recorded aspending. You receivecheckout_session.completedandcontribution.created. - The payer returns to your
success_url. - When the money reaches the Fund, its Ledger entry posts and the Contribution is
succeeded. You receivecontribution.succeededandledger_entry.posted. For card payments this is usually a few business days; ACH takes longer.
A session that is not paid within 24 hours is expired, and you receive checkout_session.expired. A session is paid at most once: an expired or complete session cannot be paid again, so create a new one.
Create a session for a Donor
The donor_id must advise the Fund: an Advisor of the Personal Fund, or a member of the Shared Fund with the advise permission. Otherwise the request is refused with 409 donor_not_advisor.
curl https://sandbox.api.getdaffodil.com/v1/checkout_sessions \
-H "Authorization: Bearer $DAFFODIL_API_KEY" \
-H "Idempotency-Key: 0b8c2a8e-3f7d-4d6e-9a51-2a0d5c1f4e77" \
-H "Content-Type: application/json" \
-d '{
"fund_id": "fund_2JqSDJkaCfO4pnMMD5na5G",
"donor_id": "donor_6YdL0cXzWbE6x7vH1k8Q2p",
"amount": 25000,
"currency": "USD",
"success_url": "https://app.example.com/give/thanks",
"cancel_url": "https://app.example.com/give",
"client_reference_id": "ac_ref_7731",
"metadata": { "member_tier": "gold" }
}'| Field | Description |
|---|---|
amount | Optional. In cents. When set, the payer cannot change it. When omitted, the payer chooses. |
success_url | Where the payer goes after paying. Must be https. Plain http works only for localhost and 127.0.0.1, and never in the Sandbox. |
cancel_url | Optional. Where the payer goes if they leave the page. Same rules as success_url. |
client_reference_id, metadata | Your own references. They are copied onto the Contribution and come back on its Events. |
fee_coverage | Optional. Overrides your Account's setting for this session. See Fees and the impact tip. |
impact_tip | Optional. Overrides your Account's setting for this session. |
prefill | Optional name, email, and address for the payer. For a Public contributor, they fill in the page's fields, the address as the billing address, and the payer can change them. For a Donor, the name and email show instead of the Donor's own, and the address becomes the Donor's mailing address when they pay if Daffodil has none on file; an address on file is never replaced. |
Create a session for a Campaign
Give campaign_id in place of fund_id, and do not give donor_id. The money goes into the Campaign's Fund, and the payer is a Public contributor. The other fields are the same as for a Donor.
curl https://sandbox.api.getdaffodil.com/v1/checkout_sessions \
-H "Authorization: Bearer $DAFFODIL_API_KEY" \
-H "Idempotency-Key: 6f1d3b2a-8c4e-4b7a-9d20-5e3c1a7b9f04" \
-H "Content-Type: application/json" \
-d '{
"campaign_id": "camp_3KrTEKlbDgP5qoNNE6ob6H",
"success_url": "https://app.example.com/campaigns/winter/thanks",
"cancel_url": "https://app.example.com/campaigns/winter"
}'The Campaign must be live and must not have ended. Otherwise the request is refused with 400 invalid_request and param campaign_id.
On the page, the Public contributor gives their legal name, email, and billing address. Your sponsor uses these for the tax receipt. They can also choose to give anonymously, and they can leave a message.
To take a Public contributor's Contribution into a Fund that has no Campaign, give fund_id and no donor_id. A Personal fund takes a Public contributor's Contribution only when your Account has Personal fund campaigns turned on. Otherwise the request is refused with 403 personal_fund_campaigns_not_enabled.
The response is the Checkout Session. Redirect the payer to its url exactly as given, or embed it, and store its id with your order.
Fees and the impact tip
Set the defaults in Mission Control, under Settings › Checkout. An Admin of your Account can change them. A session's fee_coverage and impact_tip override them for that session, and the session shows the values it used.
fee_coverage | What the payer sees | What reaches the Fund |
|---|---|---|
none | The amount, with no fee choice. | The amount less the processing fee. |
optional | A choice to add the processing fee on top. | The full amount if they add it. Otherwise the amount less the fee. |
required | The amount plus the processing fee. | The full amount. |
With impact_tip on, the payer may add a tip to Daffodil on top of the payment. The tip is charged with the payment but never reaches the Fund, and it is not part of the Contribution's amount.
| Setting | Platform partner Accounts | Other Accounts |
|---|---|---|
| Fee coverage | none | optional |
| Impact tip | Off | On |
Embed Checkout
You can show the Checkout page in an iframe on your own site instead of redirecting to it.
- In Mission Control, under Settings › Checkout › Embedding, add each origin that frames the page, such as
https://app.example.com. An origin is a scheme, a host, and an optional port, with no path. You can add up to 10. In production, origins must usehttps. Locally and in the Sandbox,http://localhostandhttp://127.0.0.1are also allowed. - Create a session as usual, and put its
urlin the frame exactly as given:
<iframe
src="https://mission.mydaffodil.app/checkout/cs_4jV68U95QzmwbX04gqFKu5?frame=..."
allow="payment"
style="width: 100%; min-height: 720px; border: 0"
></iframe>The page sends Content-Security-Policy: frame-ancestors with the origins your Account had registered when you created the session. The frame parameter in url carries them, signed, so a changed or missing value means the page refuses every frame. Browsers refuse to show the page on any other origin. A session keeps the origins it was created with, so after you remove an origin, sessions created before then can still be framed there until they expire.
When the payer pays, leaves, or follows a link out of a closed session, the whole window goes to your success_url or cancel_url, not just the frame. If the browser blocks that, the page shows a Continue link that does the same.
After the payer returns
Do not treat the return to success_url as proof of payment: it happens before the money arrives, and a payer can open the URL by hand. Use the Events, or read the session:
curl https://sandbox.api.getdaffodil.com/v1/checkout_sessions/cs_4jV68U95QzmwbX04gqFKu5 \
-H "Authorization: Bearer $DAFFODIL_API_KEY"When status is complete, contribution_id names the Contribution. Get it, or list a Fund's or a Donor's Contributions with fund_id, donor_id, or status.
The Contribution
status | Meaning |
|---|---|
pending | The payment completed, and the money is on its way to the Fund. The Fund's balance has not moved. |
succeeded | Its Ledger entry posted, so the money is in the Fund. succeeded_at says when. |
failed | The money never reached the Fund: a bank payment failed, or the payment was refunded or disputed before it arrived. Nothing posted. |
reversed | The money reached the Fund, then a refund, a dispute, or a bank return took it back. A contribution_reversal Ledger entry posted. |
A Contribution carries the session's client_reference_id and metadata, the contributor, and its source (card, ach, wire, check, stock, or daf_transfer). Its amount is what reaches the Fund: when the payer did not cover the fee, that is the payment less the processing fee. An impact tip is never part of it.
A Public contributor's Contribution has contributor.type public and campaign_id when they gave to a Campaign. It carries their name, email, and billing address, is_anonymous, and their message. You can read all of them.
When is_anonymous is true, the contributor's name is not shown on the Campaign's donor wall, and the Fund's statements show "Anonymous". Use the same rule anywhere you show the Contribution to people other than your staff.
Once it succeeds, receipt_url opens your sponsor's tax receipt for it, in your Account's branding. The link needs no API key, so you can give it to the payer. Daffodil also emails the payer a link to the same receipt: a Donor when the money arrives in their Fund, and a Public contributor at the email they gave on the page.
Wire, check, stock, and DAF transfer
When your sponsor holds the Fund, the page also offers an Advisor ways to give that move money outside Daffodil: a wire, a mailed check, a stock transfer, or a grant from another donor-advised fund. The page shows how to send it and a reference code, such as D6F1C2B3A4D5E, to put in the memo. The page shows stock only when your sponsor has set up stock instructions.
- The Advisor chooses one and says the money is on its way. The session is
complete, and one Contribution is recorded aspending, with itssourceset towire,check,stock, ordaf_transfer. You receivecheckout_session.completedandcontribution.created. The page then links the Advisor to yoursuccess_url. - When the money arrives, that same Contribution becomes
succeededand its Ledger entry posts. You receivecontribution.succeededandledger_entry.posted. Daffodil never records a second Contribution for it. Theamountis what arrived, which can differ from what the Advisor declared. - If the money never arrives, staff cancel the Contribution in Mission Control and the Contribution ends
failed. You receivecontribution.failed.
Daffodil matches arriving money to the Contribution by the reference code in the memo. If the memo has no reference code, Daffodil matches the money only when it is the one pending Contribution of exactly that amount from the Fund's owner. Otherwise staff match it in Mission Control. Days or weeks can pass between pending and succeeded.
A Public contributor session never offers these methods.
Failures and reversals
A Contribution ends failed or reversed at most once, with at most one contribution_reversal Ledger entry, however many times the payment processor reports it.
- A bank payment can fail days after the session completed. The Contribution goes from
pendingtofailed, and nothing posts. - A refund, a dispute, or a bank return after the money arrived moves it from
succeededtoreversed. The reversal entry takes the fullamountback out of the Fund, and a Campaign'sraised_amountdrops by it. - There is no refund endpoint. Daffodil refunds errors and fraud by hand.
- If the Fund already granted the money out, the reversal leaves its
balancebelow zero. While it is negative, the Fund cannot recommend Grants or give to Campaigns, which are refused withfund_negative. New Contributions bring it back.
Events
Add a webhook for these Events. Each carries the object as GET returns it.
| Event | When |
|---|---|
checkout_session.completed | The payer paid, or said a wire, check, stock, or DAF transfer is on its way. |
checkout_session.expired | 24 hours passed with no payment. |
contribution.created | The Contribution was recorded, pending. |
contribution.succeeded | Its Ledger entry posted. |
contribution.failed | The money never reached the Fund. |
contribution.reversed | A refund, dispute, or bank return took it back out. |
campaign.updated | A Contribution to a Campaign succeeded or was reversed, so its raised_amount and contribution_count changed. |
Events can arrive more than once and out of order, for example contribution.created after checkout_session.completed or the other way round. Key your work on the object id, as the webhooks guide describes.