stripe / stripe-ruby

Ruby library for the Stripe API.

Home Page:https://stripe.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Success refund to expired PaymentMethod

WoLkErSs opened this issue · comments

Describe the bug

Hi everyone!
I got an odd behavior refunds of payment methods.
I waned test refunds of expired payment methods.
After payment method was updated(expired_year from 2023 to 2022) I tried make a refund to payment intent. And it has passed with success response. There are no errors on stripe dashbord. Howewer next payment was declined due to expitarion date.
Payment Method refers to the same payment method but still refunds to nowhere.

To Reproduce

  1. Create payment method
  2. Create payment intentand charge it(Stripe::PaymentIntent.create)
  3. Update payment method(Stripe::PaymentMethod.update('pm_awdawd', {card: {exp_year: 2020}},))
  4. Make refund - succeeded
  5. Try change payment method with a new payment intent - failed

Expected behavior

  1. Create payment method
  2. Create payment intentand charge it(Stripe::PaymentIntent.create)
  3. Update payment method(Stripe::PaymentMethod.update('pm_awdawd', {card: {exp_year: 2020}},))
  4. Make refund - failed

Code snippets

No response

OS

ubuntu

Language version

Ruby 2.7.2

Library version

gem 'stripe', '~> 5.42.0'

API version

2020-08-27

Additional context

No response

@WoLkErSs Github issues should be limited to bugs with the stripe-ruby library and this is not a support channel. I'd recommend reaching out to our support team for help instead: https://support.stripe.com/contact

To guide you a bit though: the expiry date on a card doesn't really matter for a Refund. The bank know the card that was debited and in most cases they will figure out how to get the funds back to the customer, even if that customer renewed their card or closed it in most cases. We do have docs here that cover how to handle/catch failed refunds though which can happen.

Similarly, even if the card stored in Stripe is now expired, we will still attempt to debit that card with the bank. Many banks let payments through on expired cards if you have already charged them before. We also have a feature called "automatic card updater" (doc) where we work with banks to automatically update the data of cards saved in your account after they are renewed. This doesn't happen in Test mode but would minimize the cases where a card is expired in your account (though it can still happen).

If you have any follow up questions though please work directly with our support team: https://support.stripe.com/contact