Fiat donations

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

If GetOrganizationById has shift4ApiVersion=1

Send a POST request to the endpoint https://i4go-payment.shift4test.com/?fuseaction=api.jsonPostCardEntry. Form data payload
i4go_accessBlock: [received from CreateFiatDonationPledge]
i4go_cardNumber: 4242424242424242
i4go_cvv2Code: 123
i4go_expirationMonth: 10
i4go_expirationYear: 2023
i4go_cardholderName: sergii
i4go_postalCode: 89000
In the response, you will find the field i4go_uniqueid, which is a card token

If GetOrganizationById has shift4ApiVersion=2 and shift4PublicKey exists

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