Create payment intent
Create a Stripe PaymentIntent for a donation. This is the first half of
the donation flow; confirm it with POST /payments/confirm once Stripe
reports the payment succeeded.
Every field is snake_case, and every amount is in integer cents.
amount_cents is the donation itself; tip_amount_cents is the
optional tip to FundlyHub. A tip is taken only while the checkout's
switch is on: tips.fundly_gift from GET /payments/checkout-config
for a personal Fundly, tips.nonprofit_gift for a church or
non-profit's campaign. While it is off, a non-zero tip answers 409
tip_not_offered and nothing is charged; it is never dropped
silently. The charge Stripe sees is
amount_cents + tip_amount_cents, and it must clear Stripe's $0.50
(50 cent) minimum.
amount_cents was called amount. The value was always cents — only
the name has changed, so that it says so.
fundraiser_id decides where the money goes. Omit it and the
PaymentIntent is created against the platform account with no campaign
attribution — the donation is not credited to any campaign and no
transfer to a creator is scheduled. It is optional in the sense that
the request succeeds without it, not in the sense that it is safe to
leave out.
The campaign must be active and not deleted; anything else is
rejected (404 if the id is unknown, 409 if the campaign exists but
cannot accept money).
Authentication is optional — a signed-in donor gets the donation linked
to their account, an anonymous one does not. reCAPTCHA is enforced
(see below), except that a signed-in session whose email is verified
may omit the token. While donations are switched off platform-wide the
request is refused with 403 and no PaymentIntent is created.
A personal campaign reserves its pending donation under the fundraiser row
lock before the provider request, preventing concurrent owner/beneficiary
reassignment. The same row is enriched with the PaymentIntent before its
client secret is returned. Unconfirmed intents whose reservation cannot
be saved are canceled and the request fails; no usable secret is returned.
Failed preparation remains a failed payment attempt without increasing
raised totals. Nonprofit checkout keeps its existing immutable reservation.
Two modes. A request without confirmation_token_id or
payment_method_id is the previous checkout, unchanged: the gift is
priced with the card fee rule, the PaymentIntent offers Stripe's
payment methods except US bank accounts, and the browser confirms it
with Stripe.js using client_secret.
Sheet mode is the one-sheet checkout, used while sheetEnabled
from GET /payments/checkout-config is true. The request carries
exactly one way to pay: confirmation_token_id for a new card, US
bank account, Apple Pay, Google Pay or Link payment (from Stripe.js
createConfirmationToken), or payment_method_id for one of the
signed-in donor's saved methods. The server reads the method, prices
the gift with that method's fee rule (fee_kind), creates a
PaymentIntent for that method only, records the pending gift, and
confirms the payment itself. The 200 answer carries the
PaymentIntent's status:
succeeded: the payment went through.processing: a US bank debit was accepted. It takes about four
business days to clear. The gift is recorded and counted now, like a
card gift, and is reversed if the bank returns the debit.requires_action: the card issuer wants the donor to authenticate
(3-D Secure). Finish it in the browser with
stripe.handleNextAction({ clientSecret }).
Then call POST /payments/confirm with payment_intent_id. A decline
answers 402 and charges nothing: the PaymentIntent is canceled, and
the next try is a new request. Sheet mode is refused with 409
sheet_disabled while features.donate_sheet_v2 is off for the
caller. reCAPTCHA, App Attest, Play Integrity and features.donations
apply to both modes.
Authorizations
In the browser, authentication rides on the httpOnly session cookies set by /cognito/signin or the Google / Apple sign-in at /cognito/oauth/{provider}. For scripts and for Swagger UI testing, paste an API key (fh_live_…, created with POST /api-keys); a Cognito JWT is accepted too. Sign-in does not return a token in its body.
Parameters
Header Parameters
reCAPTCHA v3 token, action payment. Required unless supplied as recaptcha_token in the body, or the caller is a signed-in session with a verified email. Missing (guest or unverified) → 400; failing the score threshold → 403, whoever sent it.
iOS only. The App Attest key id (standard base64, as DCAppAttestService.generateKey returns it) of a key registered with POST /app-attest/attest. Send with x-app-attest-assertion.
iOS only. base64 of the assertion from generateAssertion(keyId, clientDataHash: SHA256(raw request body)). The body must carry a fresh app_attest_challenge. A valid assertion replaces the reCAPTCHA token; the headers alone never do. An invalid one answers 403 with code APP_ATTEST_INVALID, APP_ATTEST_KEY_UNKNOWN (attest a new key) or APP_ATTEST_CHALLENGE_INVALID (fetch a new challenge), unless the request passes reCAPTCHA some other way.
Android only. A Google Play Integrity standard token, requested with requestHash = lowercase hex SHA-256 of the raw request body. The body must carry a fresh play_integrity_challenge from POST /play-integrity/challenge. A valid token replaces the reCAPTCHA token; the header alone never does. An invalid one answers 403 with code PLAY_INTEGRITY_INVALID, PLAY_INTEGRITY_CHALLENGE_INVALID (fetch a new challenge) or PLAY_INTEGRITY_UNAVAILABLE (Google could not be reached), unless the request passes reCAPTCHA some other way.
Request Body
Responses
PaymentIntent created. In sheet mode it has also been confirmed, and status says how that went.