[100 MRG] Stripe PaymentIntent funding rail for project escrow (Fixes #232) - #296
Draft
s6pa1rta3n-lab wants to merge 2 commits into
Draft
[100 MRG] Stripe PaymentIntent funding rail for project escrow (Fixes #232)#296s6pa1rta3n-lab wants to merge 2 commits into
s6pa1rta3n-lab wants to merge 2 commits into
Conversation
…ification and ledger settlement (Fixes mergeos-bounties#232)
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Stripe (card) PaymentIntent funding rail for project escrow (#232).
Changes
1. Webhook Handler & Signature Verification (
backend/internal/core/stripe_webhook.go)POST /api/payments/stripe/webhookendpoint with HMAC-SHA256 signature verification (Stripe-Signatureheadert=...,v1=...).hmac.Equal) to prevent timing side-channels with zero secret logging.STRIPE_WEBHOOK_SECRETis unset.payment_intent.succeeded-> maps settled amount, currency, status, and card details.payment_intent.payment_failed/payment_intent.canceled-> updates project payment status.charge.refunded/refund.created/payment_intent.refunded-> handles full and proportional partial refund reversals.{ status: "ignored" }.2. Idempotent Settlement & Reversal (
backend/internal/core/stripe_webhook.go,store.go)payment_verified) and webhook records (stripe_payment_verified), preventing double mints.stripe_payment_verified,token_mint).token_burn) and releases held project reserve (project_reserve_release) with delta-based idempotency.payment_settlements).3. Server Route Registration (
backend/internal/core/server.go)POST /api/payments/stripe/webhookroute.4. Comprehensive Test Suite (
backend/internal/core/stripe_webhook_test.go)charge.refunded,refund.created), and unsupported events.5. Dependency & CI Security Baseline
golang.org/x/texttov0.39.0andgolang.org/x/synctov0.21.0to resolve GO-2026-5970.Acceptance Criteria Checklist
Evidence
Govulncheck:
Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC