Create a Donation Session
POST/v1/donation-sessions
To create a Donation Session you must supply the organisationId
of the nonprofit you want to let your user donate to.
After creating the Donation Session, direct your user to the URL for the hosted Donation gateway returned in the response. Your user will receive an email receipt after a successful Donation.
The status field of the Donation Session object after creation will be open
. After a successful Donation is made the status will transition to completed
otherwise if no Donation is completed before the expiresAt
time the status will be expired
.
Request​
- application/json
Body
required
Organisation that can be donated to during Donation session.
organisation_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Optional URL the donor will be directed to after making a Donation.
https://example.com/donation-completed
Id of the User who this donation belongs to, if one exists.
user_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Key-value data that you can attach to a DonationSession. When a Donation is created from a DonationSession, the DonationSession copies its metadata to the Donation.
{"key1":"value1","key2":"value2"}
Donation session's default language
Possible values: [en-US
, en-GB
, en-IE
, en-NZ
, de-DE
, de-CH
, de-AT
, fr-FR
, fr-BE
, it-IT
, nl-NL
, sv-SE
, da-DK
, pl-PL
, en-AU
, fr-CA
, en-CA
, es-ES
, ja-JP
, es-MX
, ko-KR
, pt-BR
, en-SG
, ms-MY
, th-TH
, id-ID
, vi-VN
, hu-HU
, cs-CZ
, ro-RO
, fil-PH
, tr-TR
]
3-letter currency code
GBP
Responses​
- 200
- 400
- 401
- 403
Successfully created a Donation Session
- application/json
- Schema
- Example (from schema)
Schema
data
object
donationsession_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
organisation_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Optional URL the donor will be directed to after making a donation.
https://example.com/donation-completed
Id of the User who this donation belongs to, if one exists.
user_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Id of the Account who this donation belongs to, if one exists.
account_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
https://donate.poweredbypercent.com/donation-session
Possible values: [open
, completed
, expired
]
2021-10-13T17:46:54.000Z
2021-10-13T17:46:54.000Z
en-GB
en-GB
Key-value data that you can attach to an object. When a Donation is created from a DonationSession, the DonationSession copies its metadata to the Donation.
{"key1":"value1","key2":"value2"}
GBP
donation_session
{
"data": {
"id": "donationsession_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"organisationId": "organisation_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"successUrl": "https://example.com/donation-completed",
"userId": "user_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"accountId": "account_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"url": "https://donate.poweredbypercent.com/donation-session",
"status": "open",
"createdAt": "2021-10-13T17:46:54.000Z",
"expiresAt": "2021-10-13T17:46:54.000Z",
"language": "en-GB",
"metadata": {
"key1": "value1",
"key2": "value2"
},
"currency": "GBP"
},
"object": "donation_session"
}
Bad request
- application/json
- Schema
- Example (from schema)
- BadRequest
- IncorrectParams
- OrganisationNotFound
- InvalidMetadata
Schema
error
object
{
"error": {
"code": "string",
"title": "string",
"message": "string",
"reasons": [
"string"
]
}
}
400 Bad Request
{
"error": {
"code": "bad_request",
"title": "Bad request",
"message": "Something is wrong with your request, please check any parameters and try again"
}
}
400 Incorrect Parameters
{
"error": {
"code": "bad_request",
"title": "Bad request",
"message": "One or more of the inputs were invalid",
"reasons": [
"pageSize must be greater than or equal to 0"
]
}
}
400 Bad request
{
"error": {
"title": "Bad request",
"message": "Organisation not found",
"code": "donation_session/organisation_not_found"
}
}
400 Bad request
{
"error": {
"title": "Bad request",
"message": "Metadata can only contain from 1 up to 20 keys, with key names up to 50 characters long and values up to 500 characters long",
"code": "donation_session/invalid_metadata"
}
}
Unauthorized
Forbidden (scope)
- application/json
- Schema
- Example (from schema)
Schema
error
object
forbidden
Forbidden
Access is denied due to missing scope permissions
{
"error": {
"code": "forbidden",
"title": "Forbidden",
"message": "Access is denied due to missing scope permissions"
}
}