Aayush
Well-known member
- Affected version
- 2.1.10 Patch 2
PHP version - 7.2.24-0ubuntu0.18.04.6
Class - XF\Payment\Stripe
Function - prepareCost($cost, $currency)
Bug:-
Should be:-
Due to how floating points are represented in PHP, this causes the number to be rounded lower which causes Stripe return value(1 cent lower) and the value stored in database for user upgrade to not match and the user is not upgraded.
DragonByte User Upgrade Coupons was also being used on the site that modified the price which could've caused it but from debugging this particular issue, we found the
$4.98 was being converted to $4.97 for more reference. Let me know if you need more info to help you resolve this.
Class - XF\Payment\Stripe
Function - prepareCost($cost, $currency)
Bug:-
Code:
return intval($cost);
Should be:-
Code:
return intval(strval($cost));
Due to how floating points are represented in PHP, this causes the number to be rounded lower which causes Stripe return value(1 cent lower) and the value stored in database for user upgrade to not match and the user is not upgraded.
DragonByte User Upgrade Coupons was also being used on the site that modified the price which could've caused it but from debugging this particular issue, we found the
$purchase->cost
to be 4.98 that was being sent and we fixed it by making the code change mentioned above.$4.98 was being converted to $4.97 for more reference. Let me know if you need more info to help you resolve this.