feat: integrate Stripe SDK for payment intent creation#300
Closed
niufox wants to merge 1 commit into
Closed
Conversation
Closes #1 - Replace stub createPaymentIntent with real Stripe SDK integration - Initialize Stripe client using STRIPE_SECRET_KEY from env config - Validate payload.amount as positive integer (smallest currency unit) - Default payload.currency to 'usd' when not provided - Call stripe.paymentIntents.create() with amount and currency - Return clientSecret and paymentId from PaymentIntent response - Remove stub pay_${Date.now()} id generation - Add error handling for Stripe-specific and unexpected errors - Update paymentController to catch and forward service errors - Add test coverage for input validation and currency defaults - Add stripe dependency to package.json
9 tasks
|
Monitoring this PR. For any approved payout: EVM 0x1ecab01075f3bdf1b56b7d849c8e28ef88943624; PayPal ckelvinkhanh32@gmail.com. |
Author
|
Friendly follow-up on this PR! This implementation:
Would love a review when you have a moment. Thanks! |
Author
|
💰 Payment info for bounty payout:
Please use this PayPal account for any approved bounty reward. Thank you! |
Author
|
Closing: identified as fake bounty project, no actual payouts |
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 secure payment gateway by replacing the stub
createPaymentIntentwith real Stripe SDK integration. Closes #1Changes Made
apps/api/src/services/paymentService.jsSTRIPE_SECRET_KEYfrom the existingenvconfigpayload.amountas a positive integer (smallest currency unit, e.g. cents) — throws descriptive error if missing or invalidpayload.currencyto"usd"when not provided, consistent with existing behaviorstripe.paymentIntents.create()with{ amount, currency }clientSecret(mapped frompaymentIntent.client_secret) andpaymentId(mapped frompaymentIntent.id)pay_${Date.now()}id generationStripeCardError,StripeInvalidRequestError, etc.) with original error detailsapps/api/src/controllers/paymentController.jscreatePaymentIntentcall in try/catchapps/api/src/tests/payment.test.jsapps/api/package.jsonstripedependencyAcceptance Criteria Checklist
stripenpm package is installed andSTRIPE_SECRET_KEYenvironment variable is used to initialise the client — no hardcoded keyspayload.amountis required and must be a positive integer; function throws with a descriptive error if missing or invalidpayload.currencydefaults to"usd"if not providedstripe.paymentIntents.create()call is made with at minimum{ amount, currency }clientSecretandpaymentIdpay_${Date.now()}id generation is removed