Jump to content

IPS.Commerce 4.6.10: Bug with account credits and Stripe payments


Go to solution Solved by Marc,

Recommended Posts

Posted

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:

account-credit.png.760323a95c0769575fcd05def62907e8.png

 

  • The transaction with the account credit is then successful:

 

transaction-account.thumb.png.20dd282be65d4f9146e1ce5b2f1a4ac7.png

 

  • By returning to the checkout page, there is a 4X196/3 error:

 

error4X193.thumb.png.e1ff68ebdf5509dd6f0162bfd2a65e3f.png

 

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!

Posted

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.

 

  • 1 month later...
  • 1 month later...
Posted
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!

Posted
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! 🤩

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...