-
Notifications
You must be signed in to change notification settings - Fork 18
Payment API version 1.3
Here just a short description of the new API. The API for v1.1 has not changed and supports only Stripe card tokens and no recurrent donations.
The documentation can be found here: https://devel.trilliontreecampaign.org/api/doc/donation
Donations are created via 3 API calls:
- create the donation
- pay for the donation
- fetch and merge the finalized donation
To create a donations there are 4 different APIs due to the fact that donations can either be public
or authenticated
and they can be either regular donations
or gifts
.
Donation payment APIs are common for both donation types but there are 2 APIs, one for public
and one for authenticated
.
PaymentIntents are created based on PaymentMethods.
PaymentMethods must only be attached to the customer if the user has select save for later
(see Zeplin). The attachment must occur just before the payment API call is submitted.
The documentation for the payment API is incomplete and is therefor documented here:
{
"paymentProviderRequest": {
"account": "stripe_DE",
"gateway": "stripe",
"source": {
"id": "pm_1FCUSBGhHD5xN1UqlUVCTHdM",
"object": "payment_method"
}
}
}
{
"donationId": 241596,
"status": "success",
"message": null,
"response": null
}
status
can be one of the following:
success
-
action_required
the data to handle perform the action can be found under the keyresponse
-
failed
the keymessage
will contain the reason for the failureresponse
After the donation was successful, the locally stored donationId must be destroyed so it cannot be reused.
The last step of the donation process consists of fetching the finalized donation and merging it into Redux.
The donation fetch APIs are common for both donation types but there are 2 APIs, one for public
and one for authenticated
.
For devs without access to Zeplin, here the UI: @sagararyal please provide link to Zeplin