Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store credits leaving insufficient balance for Stripe payments #311

Open
rainerdema opened this issue Jul 5, 2023 · 2 comments
Open

Store credits leaving insufficient balance for Stripe payments #311

rainerdema opened this issue Jul 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@rainerdema
Copy link
Contributor

Originally posted by @loicginoux in #307 (comment)

To Reproduce

  1. Create an order with a total of $50
  2. Apply store credits of $49.70 to the order
  3. Attempt to complete the order using Stripe as the payment method

Current behavior
Currently, when store credits are applied and they cover almost all of the order, it can leave a balance that's insufficient for Stripe to process.
For instance, if we have an order total of $50, and store credits of $49.70 are applied, the remaining amount to pay is $0.30. However, Stripe requires a minimum of $0.50 to process a payment, resulting in a Stripe::InvalidRequestError - Amount must be at least €0.50 $.

Expected behavior
The system should handle scenarios where store credits leave a balance that falls below the minimum payment threshold of the payment gateway (Stripe, in this case).
The customer should not be left with a balance that they cannot pay.

Screenshots
In this specific example, the order total is < 0.50$
Screenshot 2023-07-05 at 17 51 06

Additional context
The current logic covers scenarios where an order is fully covered by store credits,, but fails to handle cases where store credits almost fully cover the order, leaving a balance that's below the minimum payment threshold for certain payment methods.
We need to figure out how to manage this situation, particularly as different currencies, other than USD, have varying minimum amounts.

@loicginoux
Copy link
Contributor

here are the Ideas we had to solve this (in the configuration where you only have Stripe as a payment method), but none of them seems perfect:
1 - you don't let payment when total is < 0.50$ but might be hard to accept for customers, it's not really a good commercial gesture.

2 - you offer these few cents in different ways:

2.a Via a store credit added to user during checkout. The problem is if he does not complete the order, you need to remove these store credits

2.b Via a new sort of promotion "if order total is < 0.50$ then add a promo adjustment equal to this amount to make the order total == 0". The issue we see is that with this kind of promotion, we would need to be sure to check elligibility after all other potential promotions ( I still need to investigate but I don't think this is possible to ensure priorities)

2.c Via an adjustment of the amount remaining added when completing the order. seems hacky...

We are still investigating...

@tmtrademarked
Copy link

FWIW, we encountered this issue in our application, and chose to solve it by issuing new store credit with a special type. In practice, we observed that this amount is generally extremely small, and not worth worrying over. By having a custom type of store credit, we can run reports and determine if we need any special handling.

Applying this credit seems like it might be beyond the scope of the Stripe gem, however. We implemented it by replacing the add_store_credit method of Spree::Order with a custom implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants