Skip to content

feat: implement Stripe PaymentIntent integration#56

Open
MichisGitIsKing wants to merge 1 commit into
SecureBananaLabs:mainfrom
MichisGitIsKing:feat/payment-gateway
Open

feat: implement Stripe PaymentIntent integration#56
MichisGitIsKing wants to merge 1 commit into
SecureBananaLabs:mainfrom
MichisGitIsKing:feat/payment-gateway

Conversation

@MichisGitIsKing
Copy link
Copy Markdown

Summary

Replaces the stub paymentService with a real Stripe SDK integration.

Changes

  • paymentService.js: Real stripe.paymentIntents.create() call with input validation, error handling, and env-based client init
  • package.json: Added stripe ^17.0.0 dependency
  • paymentService.test.js: 3 unit tests with mocked Stripe SDK (correct args, error rethrow, invalid amount)
  • paymentService.smoke.test.js: Integration test guarded by STRIPE_SMOKE_TEST=1 env flag

Acceptance Criteria

  • stripe package installed, STRIPE_SECRET_KEY env var used
  • payload.amount validated as positive integer
  • payload.currency defaults to usd
  • Real stripe.paymentIntents.create() call
  • Returns clientSecret + paymentId from Stripe response
  • Stub pay_timestamp removed
  • Stripe errors caught and rethrown with original message
  • Unit test mocks Stripe SDK
  • Smoke test guarded by env flag

Fixes #1

Replace stub paymentService with real Stripe SDK integration:
- Use STRIPE_SECRET_KEY env var for client initialization
- Validate payload.amount as positive integer
- Default currency to 'usd'
- Call stripe.paymentIntents.create() and return clientSecret + paymentId
- Catch and rethrow Stripe errors with original messages
- Unit tests with mocked Stripe SDK
- Integration smoke test guarded by STRIPE_SMOKE_TEST env flag

Fixes SecureBananaLabs#1
github-actions Bot added a commit that referenced this pull request May 17, 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.

Implement Secure Payment Gateway and Payment Service

1 participant