Skip to content

fix: stripe payments can fail due to payment amount rounding mismatch#1348

Open
MrWeez wants to merge 1 commit into
Ctrlpanel-gg:developmentfrom
MrWeez:fix/stripe-confirmation
Open

fix: stripe payments can fail due to payment amount rounding mismatch#1348
MrWeez wants to merge 1 commit into
Ctrlpanel-gg:developmentfrom
MrWeez:fix/stripe-confirmation

Conversation

@MrWeez

@MrWeez MrWeez commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Description

Fix for issue where Stripe payments was marked as cancelled even if they was processed due to payment amount rounding mismatch during validation


Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor / code quality
  • Documentation
  • Other:

Testing

Stripe was tested with exact same settings as user that reported this issue has and no error appeared


AI Assistance

  • I used AI tools to assist with this contribution

Checklist

  • My PR targets the development branch
  • Commit messages follow Conventional Commits
  • Code follows PSR-12
  • I have reviewed my own code
  • I have tested all affected functionality
  • No new warnings or errors introduced

Legal

By submitting this pull request, I confirm that my contribution is made
under the terms of the project's
Contributor License Agreement
and that I have read and agree to the
Code of Conduct.

@MrWeez MrWeez added the High Priority Critical. Act quickly for resolution label May 8, 2026
@simbabimba-dev simbabimba-dev requested a review from Copilot May 12, 2026 05:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Stripe webhook payment validation to avoid false cancellations when the stored payment total (in database units) rounds to a different minor-unit amount than the Stripe PaymentIntent reports.

Changes:

  • Adjust Stripe webhook payload validation to compare amounts in Stripe minor units (e.g., cents) rather than converting Stripe amounts back into database units.
  • Reuse the existing convertAmount(...) logic for computing the expected Stripe amount from the stored Payment::total_price.
  • Remove the now-unused convertGatewayAmountToDatabaseUnits(...) helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/Extensions/PaymentGateways/Stripe/StripeExtension.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority Critical. Act quickly for resolution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants