HTTP Request Method: POST
Tips & Tricks: Use the Postman app to run a request and try it out. (Here's how)
To obtain a Donation Link, make an HTTP POST request to the following URL: https://go.causeactive.com/api/v3/donation-link/:campaignId/:donorId/:tagId
The following table describes the options you can pass in that URL:
|
URL Param Name
|
Value Type
|
Description
|
|
:campaignId
|
int
|
Required
The id of the Campaign to get a Donation Link for.
|
|
:donorId
|
string
|
Required
Any value that uniquely identifies the donor user. The system calling this API is wholly responsible for ensuring the uniqueness of this value and ensuring it can be mapped to a valid user of that system for auditing purposes.
|
|
:tagId
|
int
|
Optional
The id of the Tag to get a Donation Link for.
You only need to send this if you want the possibility to track donations in more detail and/or allow multiple donations to a single campaign by the same donor (one donation per tag per donor id).
|
Authentication and Test Mode
To make the request, you will need to provide authentication credentials in the HTTP POST parameters for the request.
Note, the API Key and Secret are specific to each Collection and will only work for Campaigns that are within that collection.
|
POST Param Name
|
Value Type
|
Description
|
|
apiKey
|
string
|
The 16-character API Key you obtain from a Collection within your account.
|
|
apiSecret
|
string
|
The 32-character API Secret you obtain from a Collection within your account.
|
|
testMode
|
int
|
Send 1 to enable test mode for this request. If not sent, the default of 0 (disabled) is used.
Test mode requests will simulate the Donation Link creation without actually creating a Donation Link.
To simulate a specific error code, send the desired code via the errorCode parameter (shown below).
|
|
errorCode
|
int
|
Optional
Valid values are any of the numeric code values in the "Possible Error Codes" table below.
Only send this if you want to test getting back a specific error code from the server.
|
Success Response
{
"information": {
"detail": [
"Login Succeeded.",
"Donation link found."
]
},
"login": {
"error": false
},
"userId": "6",
"error": false,
"donation": {
"url": "https://go.causeactive.com/donate/2/j79p2d6Y7jQ2wBMppwSVpnCdKYjbcKdx",
"expiration": "2023-11-07T18:17:52+00:00"
},
"api": true
}
Error Responses
Invalid API Credentials
{
"errors": {
"detail": [
"Login Failed"
]
},
"login": {
"error": true,
"errorCode": 2
},
"api": true
}
Error with Request
{
"errors": {
"detail": [
"Target campaign does not have any available donations to allocate.",
"Request for donation link denied.",
]
},
"error": true,
"code": 10,
"api": true
}
Possible Error Codes, Descriptions, and Common Solutions
The following table shows all possible error codes from the API. If there is any error, the JSON response error property will be set to boolean true and one of these error codes will be returned as an int value in under the code property in the JSON response.
The codes below are grouped by category of error.
-
10-19: Donation Pool errors
-
20-29: Donation Link errors
-
30-39: Invalid data errors
-
40-49: Entity not found errors
-
9999: Invalid error code provided for test mode error check
|
Code
|
Name
|
Description
|
|
10
|
CODE_DONATION_POOL_EMPTY
|
The Campaign does not have any more donations to allocate at this time.
Solution Either increase the Donation Pool size on the Campaign (contact CauseActive to request an increase), manually Archive some of the unused Donation Links, or wait for some of the unused Donation Links to expire.
|
|
20
|
CODE_DONATION_LINK_EXPIRED
|
The requested combination of :campaignId + :donorId + :tagId matches a link that was generated previously and has already expired.
|
|
21
|
CODE_DONATION_LINK_ARCHIVED
|
The requested combination of :campaignId + :donorId + :tagId matches a link that was generated previously and has been manually archived by an admin.
The archival action intentionally disabled the link to prevent its use.
|
|
22
|
CODE_DONATION_LINK_COMPLETED
|
The requested combination of :campaignId + :donorId + :tagId matches a link that was generated previously and has already been used to direct a donation. Only one donation can be made for any given combination of these values.
|
|
30
|
CODE_INVALID_CAMPAIGN_ID
|
The :campaignId you provided is not a valid id.
Solution Ensure you have the correct :campaignId and that it is an int > 0.
|
|
31
|
CODE_INVALID_DONOR_ID
|
The :donorId you provided is not a valid id.
Solution Ensure you have provided a non-empty donor id and that the donor id does not contain any spaces.
Note: We do not trim the donor id provided so ensure there is no leading/trailing whitespace around the value being sent.
|
|
40
|
CODE_CAMPAIGN_NOT_FOUND
|
The :campaignId you provided could not be found or you do not have access to that Campaign.
Solution Ensure you have the correct :campaignId. Ensure you are using the correct API Credentials for that Campaign.
|
|
41
|
CODE_TAG_NOT_FOUND
|
The :tagId you provided could not be found, is for a different Campaign, or you do not have access to that Tag.
Solution Ensure you have the correct :campaignId. Ensure you have the correct :tagId for a tag within that Campaign. Ensure you are using the correct API Credentials for that Campaign.
|