π³ Card Donation Flow
This page describes how to perform card donation using The Giving Block public API when you are building your native donation form
Create donation pledge
Using GetOrganizationById endpoint you will receive organization information. If the flag areFiatDonationsEnabled is TRUE, the organization can accept fiat donations
Create a new donation pledge using CreateFiatDonationPledge endpoint.
Card tokenization
Due to security reasons, The Giving Block will not accept any card details or store them. Therefore, you will need to tokenize card with our partner Shift4
The recommended way is to use Shift4 custom form with 3D Secure. Example: https://dev.shift4.com/examples/custom-form-with-3d-secure. Use shift4PublicKey from GetOrganizationById response to initialize the Shift4 object
Once verifyThreeDSecure promise is resolved, you will get a token object and field id inside which is a card token
Charge donor
Pass pledgeId which was received from CreateFiatDonationPledge and cardToken which was received from the card tokenization step to the ChargeFiatDonationPledge endpoint.
If you will receive success response or message about why a charge was failed
Webhook notifications
You can subscribe to receive a webhook once card donation is completed. Please see Webhook notifications documentation part for more details.
Await Deposit completed event to send receipt email or perform any other actions. This can be disabled per organization or for your API user.
For more detailed information regarding interaction with the API please check API reference documentation
Updated about 2 months ago