Skip to content

feat(api): replace createPaymentIntent stub with real Stripe PaymentIntent (Bounty #1, $350)#24

Closed
cx306806112 wants to merge 1 commit into
SecureBananaLabs:mainfrom
cx306806112:feat/stripe-payment-intent
Closed

feat(api): replace createPaymentIntent stub with real Stripe PaymentIntent (Bounty #1, $350)#24
cx306806112 wants to merge 1 commit into
SecureBananaLabs:mainfrom
cx306806112:feat/stripe-payment-intent

Conversation

@cx306806112
Copy link
Copy Markdown

Summary

Replaced the stub implementation with a real Stripe PaymentIntent integration.

Changes

  • Installed stripe npm package
  • Integrated Stripe Node.js SDK with STRIPE_SECRET_KEY env var (no hardcoded keys)
  • payload.amount validation (required, positive integer)
  • payload.currency defaults to "usd" if not provided
  • Real stripe.paymentIntents.create({ amount, currency }) call
  • Returns clientSecret (from paymentIntent.client_secret) and paymentId (from paymentIntent.id)
  • Removed stub pay_${Date.now()} ID generation
  • Stripe errors (StripeCardError, StripeInvalidRequestError, etc.) caught and re-thrown with descriptive messages

Acceptance Criteria

  • stripe npm package installed, STRIPE_SECRET_KEY env var used
  • payload.amount required, positive integer validated
  • payload.currency defaults to "usd"
  • Real stripe.paymentIntents.create() call made
  • Resolved value includes clientSecret and paymentId
  • Stub ID generation removed
  • Stripe errors caught and re-thrown with preserved messages
  • Unit test mocks Stripe SDK (needs test setup)
  • Integration/smoke test (guarded by env flag)

/bounty $350

…ntent (B1, $350)

- Add stripe npm package (apiVersion 2025-04-30.basil)
- Validate payload.amount (required, positive integer in cents)
- Validate payload.currency (defaults to usd)
- Call stripe.paymentIntents.create with automatic_payment_methods
- Map paymentIntent.client_secret → clientSecret, id → paymentId
- Catch and re-throw Stripe errors preserving original message
- 12 unit tests covering validation, mapping, and error paths
- Expose setStripeClient() for testability
github-actions Bot added a commit that referenced this pull request May 17, 2026
gacorpoll-ui pushed a commit to gacorpoll-ui/bug-bounty that referenced this pull request May 17, 2026
@cx306806112 cx306806112 closed this by deleting the head repository May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant