The Donation Campaign service enables you to create and manage fundraising campaigns on your site. Each campaign can be configured with specific goals, custom/predefined donation amounts, and progress tracking capabilities.
Using the Donation Campaign service, your app can:
It's important to note the following points before starting to code:
When creating donation campaigns, you must configure custom or predefined donation amounts (or both) for each campaign:
customAmountEnabled: Allows donors to specify their own amount.predefinedDonationAmounts: Suggested donation options.Enable both options for maximum flexibility.
At least one of the following donationFrequencies must be specified for each campaign:
ONE_TIME: Single donation.WEEK: Weekly recurring donations.MONTH: Monthly recurring donations.YEAR: Yearly recurring donations.COLLECTING: Campaign is actively accepting donations.EXPIRED: Campaign has passed its end date and acceptDonationsAfterEndDate is false.GOAL_REACHED: Campaign has reached its target amount and acceptDonationsAfterGoal is false.Understanding the donation campaign lifecycle is crucial for effective implementation:
COLLECTING.Campaigns can reach completion in two ways:
Goal achievement:
acceptDonationsAfterGoal is false, status becomes GOAL_REACHED and donations stop.acceptDonationsAfterGoal is true (default), donations continue beyond the goal.Time expiration:
endDate.acceptDonationsAfterEndDate is false (default), status becomes EXPIRED and donations stop.acceptDonationsAfterEndDate is true, donations continue past the end date.Campaign metrics provide insights into fundraising progress:
Be prepared to handle these common scenarios:
NO_PAYMENT_DEFINITION: At least one donation amount setting must be configured - customAmountEnabled and/or predefinedDonationAmounts.NON_POSITIVE_CAMPAIGN_GOAL_AMOUNT: Campaign goal target amount cannot be negative or zero.INVALID_CUSTOM_AMOUNT_RANGE: Maximum custom amount must be greater than minimum custom amount.DUPLICATE_PREDEFINED_AMOUNTS: Predefined donation amounts cannot contain duplicate values.NON_POSITIVE_PREDEFINED_AMOUNT: Predefined donation amounts cannot be negative or zero.EMPTY_CAMPAIGN_NAME: Campaign name cannot be empty.SITE_CURRENCY_UNAVAILABLE: Temporary issue reading store settings - retry the request.EMPTY_ASSIGN_AND_UNASSIGN_LISTS: Tag operations require at least one tag to assign or unassign.CAMPAIGN_GOAL_NOT_SET: Campaign goal must be configured before retrieving metrics.METRICS_TEMPORARILY_UNAVAILABLE: Campaign metrics are temporarily unavailable - retry the request.