Overview
Bounty uses Stripe for:- Checkout Sessions: Accepting bounty funding payments
- Payment Intents: Holding funds until bounty completion
- Stripe Connect: Enabling solvers to receive payouts
- Transfers: Sending money to solver Connect accounts
- Webhooks: Real-time payment status updates
Prerequisites
- Stripe account with Connect enabled
- Access to Stripe Dashboard
- HTTPS-enabled domain (required for webhooks in production)
Stripe Setup
Create Stripe Account
Sign up at stripe.com if you don’t have an account.Activate your account by providing business information.
Enable Stripe Connect
Navigate to Stripe Dashboard → Settings → Connect.Click Get Started to enable Connect for your account.
Get API Keys
Go to Developers → API Keys.Copy your:
- Publishable key (starts with
pk_test_orpk_live_) - Secret key (starts with
sk_test_orsk_live_)
Configure Webhooks
Navigate to Developers → Webhooks.Click Add endpoint and configure:
- Endpoint URL:
https://your-domain.com/api/webhooks/stripe - Events to send: Select the following:
checkout.session.completedpayment_intent.succeededpayment_intent.payment_failedpayment_intent.canceledcharge.refundedcharge.refund.updatedtransfer.createdtransfer.updatedaccount.updated
whsec_).Use test mode keys (
sk_test_, pk_test_) during development. Switch to live keys (sk_live_, pk_live_) for production.Payment Flow
Bounty’s payment flow ensures funds are held securely until work is completed.1. Bounty Creation
When a bounty creator creates a bounty:2. Checkout Session
To fund the bounty, a Stripe Checkout session is created:3. Payment Processing
When the user completes checkout:- Stripe processes the payment
checkout.session.completedwebhook fires- Bounty status updates to
openwith payment statusheld - Funds are held in your Stripe account (not yet transferred)
4. Payout to Solver
When a bounty is completed and awarded:Stripe Connect for Solvers
Solvers must connect a Stripe account to receive payouts.Onboarding Flow
Complete Onboarding
The user completes Stripe’s onboarding form:
- Personal information
- Bank account details
- Tax information (if required)
API Endpoints
connect.getConnectStatus
Check the user’s Connect account status:
connect.createConnectAccountLink
Generate an onboarding or re-onboarding link:
connect.getConnectDashboardLink
Generate a login link to Stripe Express Dashboard:
Webhook Handling
Bounty listens for Stripe webhook events to update bounty and payment status.Webhook Security
All webhooks are verified using the signing secret:Key Webhook Events
checkout.session.completed
Fired when a checkout session is completed:
payment_intent.succeeded
Fired when a payment is captured:
charge.refunded
Fired when a payment is refunded:
transfer.created
Fired when a transfer to a Connect account is created:
Testing
Test Mode
Use Stripe test mode for development:- Use test API keys (
sk_test_,pk_test_) - Use test card numbers:
- Success:
4242 4242 4242 4242 - Decline:
4000 0000 0000 0002 - Requires authentication:
4000 0025 0000 3155
- Success:
Webhook Testing
Use Stripe CLI to forward webhooks to localhost:Troubleshooting
”STRIPE_SECRET_KEY is required”
Cause: Environment variable not set. Solution: Ensure.env file contains:
“Stripe Connect is not enabled”
Cause: Connect not activated in Stripe Dashboard. Solution:- Go to Stripe Dashboard → Connect
- Click Get Started and complete setup
Webhook Signature Verification Failed
Cause:STRIPE_CONNECT_WEBHOOK_SECRET doesn’t match webhook endpoint.
Solution:
- Go to Webhooks
- Click on your endpoint
- Copy the Signing secret (
whsec_...) - Update
STRIPE_CONNECT_WEBHOOK_SECRETin.env
Bounty Not Updating After Payment
Checklist:- Verify webhook endpoint is accessible (HTTPS in production)
- Check webhook delivery logs in Stripe Dashboard
- Ensure
bountyIdis in payment metadata - Review server logs for webhook processing errors
Transfer Failed: “No such destination”
Cause: Solver’s Connect account ID is invalid or deleted. Solution:- Check
user.stripeConnectAccountIdexists - Verify account exists:
stripe.accounts.retrieve(accountId) - Ensure solver completed onboarding
API Reference
connect.getConnectStatus
Returns the user’s Stripe Connect account status.
Returns: { hasConnectAccount, onboardingComplete, accountDetails }
connect.createConnectAccountLink
Creates an onboarding link for Stripe Connect.
Returns: { url: string }
connect.getConnectDashboardLink
Generates a login link to the Stripe Express Dashboard.
Returns: { url: string, isOnboarding: boolean }
connect.getPayoutHistory
Input: { page: number, limit: number }
Returns payout history for the user.
Returns: { data: Payout[], pagination: {...} }
connect.getAccountBalance
Returns the user’s Stripe Connect account balance.
Returns: { available: number, pending: number, total: number }
connect.getActivity
Input: { page: number, limit: number }
Returns combined activity (bounties created and payouts received).
Returns: { data: Activity[], pagination: {...} }
Security Best Practices
Production Checklist
- Switch from test keys to live keys
- Update webhook endpoint to production URL (HTTPS)
- Verify Connect is enabled and activated
- Test payment flow end-to-end
- Test refund process
- Test payout to solver Connect account
- Set up Stripe Radar rules for fraud prevention
- Configure email receipts in Stripe Dashboard
- Review and accept Stripe’s terms of service