LaCollision Posted February 14, 2022 Posted February 14, 2022 Hi Invision, In IPS.Commerce 4.6.10, there is an issue with account credits and invoice payments with Stripe. Stripe indeed refuses card payments under $0.50:https://stripe.com/docs/currencies#minimum-and-maximum-charge-amounts However, it turns out that members can end up with an invoice to pay less than this amount of $0.50, when they have an account credit. There are 2 issues in IPS.Commerce concerning this limitation: 1st situation: with generateRenewalInvoices Let's take an example of a member who has an account credit of $9.60, and a $10 / month subscription. During the generateRenewalInvoices task: IPS.Commerce will first make a successful transaction of $9.60 with the account credit. IPS.Commerce will then try to make a Stripe transaction of $0.40. Stripe will refuse this transaction, as it's below $0.50. Then IPS.Commerce gets stuck: the invoice remains unpaid, and there is nothing we can do. The solution would be to use the account credit only up to this $0.50 limit, so that the transaction amount does not go below it. 2nd situation: with manual payment Another scenario is the following: A member has an account credit of € 7.00 An admin generates a renewal invoice in the ACP for € 7.20 When the member tries to manually pay this invoice, he can choose to pay with his account credit: The transaction with the account credit is then successful: By returning to the checkout page, there is a 4X196/3 error: This issue comes from /nexus/modules/front/checkout.php at line 1337: there is no available payment method, as the Stripe gateway checkValidity() method returned false. Again, we are stuck as this invoice cannot be paid. Thank you! OptimusBain, SeNioR- and Runar 2 1
Marc Posted February 14, 2022 Posted February 14, 2022 Thank you for bringing this issue to our attention! I can confirm this should be further reviewed and I have logged an internal bug report for our development team to investigate and address as necessary, in a future maintenance release.
Solution Marc Posted April 5, 2022 Solution Posted April 5, 2022 This issue has been resolved in 4.6.12, which has just been release. Please let us know if you still have any issues once you have upgraded to that release. LaCollision 1
LaCollision Posted May 18, 2022 Author Posted May 18, 2022 On 4/5/2022 at 3:16 PM, Marc Stridgen said: This issue has been resolved in 4.6.12, which has just been release. Please let us know if you still have any issues once you have upgraded to that release. Hi, Thank you for this fix. However, there is still an issue when the account credit has exactly the same value than the invoice total. I can indeed see in /nexus/taks/generateRenewalInvoices the following code, at line 131: $take = NULL; if ( $credit->compare( $invoice->total->amount ) === 1 ) { $take = $invoice->total->amount; } else { /* Only use credit if amount remaining is greater than card gateway min amount */ if( $invoice->total->amount->subtract( $credit ) > new \IPS\Math\Number( '0.50' ) ) { $take = $credit; } } If the credit is equal to the invoice total, then the $take value stays null, and the invoice is not paid with the account credit, although the customer has enough credit. So the correct code should be the following: $take = NULL; if ( $credit->compare( $invoice->total->amount ) === 0 || $credit->compare( $invoice->total->amount ) === 1 ) { $take = $invoice->total->amount; } else { /* Only use credit if amount remaining is greater than card gateway min amount */ if( $invoice->total->amount->subtract( $credit ) > new \IPS\Math\Number( '0.50' ) ) { $take = $credit; } } ➡️ I've added the condition on the credit equal to the invoice total. Thank you for your help!
Stuart Silvester Posted May 18, 2022 Posted May 18, 2022 4 minutes ago, LaCollision said: However, there is still an issue when the account credit has exactly the same value than the invoice total. Thanks for letting us know, we also noticed this today ( 🤯 ) and have a fix ready for the next release 🙂 Jim M and LaCollision 1 1
LaCollision Posted May 18, 2022 Author Posted May 18, 2022 24 minutes ago, Stuart Silvester said: Thanks for letting us know, we also noticed this today ( 🤯 ) and have a fix ready for the next release 🙂 Fantastic, thank you! 🤩
Recommended Posts