* fix: preserve payment sessions during certain Stripe errors for webhook reconciliation fix: add retry mechanism for errors that might be fixed after retry fix: authorizePaymentSession method will update payment_session.status regardless regardless of wether or not the authorization is successful * Refactor: improve handling structure and syntax -Move HandledErrorType definition to the top of stripe-base - Use timers/promises for setTimeout - Removed data in HandledErrorType when retry is true * refactor: improve error handling flow and logic - Simplify return statement in initiatePayment to handle null cases - Remove redundant if-check in handleStripeError and rely on switch - Reorder conditional checks in executeWithRetry for clearer flow - Update executeWithRetry to check for retry=false condition first * clean up * fix: improve payment error handling and traceability - Return structured error state for StripeAPIError instead of null - Throw error when retries are exhausted and no payment intent exists - Update type definitions to support error state tracking * fix formatting and naming
Payment Module
A Payment is the result of a series of financial transactions performed as part of collecting a payment of a purchase. The Payment holds information about the payment provider as well as the state of it. You can associate a Payment with a Cart, an Order, an OrderEdit, or any other resource you’d like to have your customers pay for.