solidusio / solidus_stripe

💳 Integrate Solidus with Stripe
https://stripe.com
BSD 3-Clause "New" or "Revised" License
36 stars 62 forks source link

A stripe customer cannot have more than 100 stripe payment methods #325

Open rabbitbike opened 7 months ago

rabbitbike commented 7 months ago

Solidus Version solidus 4.3 solidus_stripe 5.0.2

To Reproduce

Create a test where a user tries to process over 100 payments.

I am using MiniTest instead of RSpec and have a solidus_stripe_customer fixture with a set stripe_customer_id. So this test user is not recreated for each test and keeps using the same stripe_customer_id. We have been running tests using this user in CI for the last few days and the tests are now failing.

Current Behavior

It seems like stripe has a limit of 100 stripe payment methods per stripe customer. We have just migrated to v5 and currently we don't have such customers yet, so we are not facing an issue with actual customers at this moment.

But in our tests, we have one test customer with one stripe_customer_id that creates multiple payments. We have hit the limit of 100 payment methods for that test customer, and the tests are now failing with Customer cus_******* already has the maximum number of payment methods attached.

Desired Behavior

Some customers may choose not to save their payment methods in wallet_payment_sources, but still keep shopping multiple times. Though it's unlikely that such customers to hit the limit any time soon, we would like to allow them to keep shopping even after 100 orders or payment attempts.

Additional context

I would like to ask what should be the best way to ensure that customers can keep adding payment methods without hitting the limit. Should I remove old payment methods that are not saved in wallet_payment_sources, or should I create a new stripe customer_id when the limit is reached? I would love to learn the most effective strategy for handling this.

One other thing I would like to mention is that I have set "off_session" for future payment preference for all payments. I'm not sure if that affects how payments are counted for a user.

Please correct me if my assumptions are wrong or let me know if there is some options to set that I'm missing when creating stripe payment_methods or payment_intents.

Thank you🙏