Skip to content

Update Stripe retry_failed_payment api access to payment intent#1225

Merged
excid3 merged 1 commit intopay-rails:mainfrom
mguidetti:fix-retry-failed-payment
May 6, 2026
Merged

Update Stripe retry_failed_payment api access to payment intent#1225
excid3 merged 1 commit intopay-rails:mainfrom
mguidetti:fix-retry-failed-payment

Conversation

@mguidetti
Copy link
Copy Markdown
Contributor

@mguidetti mguidetti commented Apr 9, 2026

Pull Request

Summary:
Fix retry_failed_payment for Stripe API versions > 2025-03-31

Related Issue:

Description:
Stripe API 2025-03-31 added support for multiple payments to invoices and removed the payment_intent field from the Invoice object in favor of the payments collection (https://docs.stripe.com/changelog/basil/2025-03-31/add-support-for-multiple-partial-payments-on-invoices)

retry_failed_payment was referencing invoice.payment_intent, which raises a NoMethodError on Stripe API versions >= 2025-03-31.

This PR changes retry_failed_payment to access the payment intent through the payments collection instead. It selects the first payment using .first, so this doesn't actually support multiple payments like the API does, but perhaps this is fine for this gem's current purposes?

Testing:

I didn't find any existing tests for this method and was unsure the best way to test it.

Screenshots (if applicable):

Checklist:

  • Code follows the project's coding standards
  • Tests have been added or updated to cover the changes
  • Documentation has been updated (if applicable)
  • All existing tests pass
  • Conforms to the contributing guidelines

Additional Notes:

@excid3
Copy link
Copy Markdown
Collaborator

excid3 commented May 6, 2026

That should be fine, as presumably the first payment failed and just needs to be retried. I don't know that many people are using these methods, so we may also want to just deprecate them and remove them at some point.

@excid3 excid3 merged commit 33f75f9 into pay-rails:main May 6, 2026
37 checks passed
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.

2 participants