Alex Posted October 3, 2013 Report Posted October 3, 2013 I have a coupon I made for a friend which was for 50% off. I set him up as a client and created the service, applying the discount code. The service normally costs $29.99, and Blesta calculated 50% to $15. However, when the friend went to pay, the following errors came about: https://api.stripe.com/v1/charges a:1:{s:5:"error";a:3:{s:4:"type";s:21:"invalid_request_error";s:7:"message";s:23:"Invalid integer: 1499.5";s:5:"param";s:6:"amount";}}I'm sort of glad it failed and didn't hit his bank for nearly $1500! Oddly, when he tried again, it worked! (It charged him $15 correctly, but not going to post the successful log since it contains personal information) Here is the mail Blesta sent him regarding the failed transaction: We tried to charge your Visa, ending in 4321, in the amount of $15.00, but the request resulted in an error. Error Response: Invalid integer: 1499.5 Please verify that the account details we have on file are correct. We will attempt to charge your card again once a day until it is successful, up to three times. Ken 1
Cody Posted October 3, 2013 Report Posted October 3, 2013 What currency was this for (USD)? What is the format of the currency (####.##)? What was different about the first attempt (that failed) and the subsequent attempt? Was the first through an order form while the other was in the client interface, or...?
Alex Posted October 3, 2013 Author Report Posted October 3, 2013 What currency was this for (USD)? What is the format of the currency (####.##)? What was different about the first attempt (that failed) and the subsequent attempt? Was the first through an order form while the other was in the client interface, or...? USD. (That's all we use) It was a $29.99 package with 50% off coupon, so it came to $15.00. The format we use is ##.##. This was not a manual payment amount, but actually paying an invoice so the amount was generated by Blesta. I believe he did the exact same thing the second time around when it worked, so that is the odd part. As I said, I added him as a client and added his service manually, so I believe he just clicked in the invoice email to go to the client portal and pay the invoice there, so it was not through the order form. Since this fella is a friend I consider very smart and technically adept, and a Systems Analyst for a Fortune 1000 company, I find it quite doubtful that it was human error. He wouldn't have tested it differently the second time around. The only difference may have been that he did a manual payment for $15 after the failure, rather than letting the system generate the amount. But after that, I asked him to try the original method (invoice payment) again and get a screenshot of the error for us, and when he did, he just paid us an extra $15 and it worked in the same method which had not worked at first.
Tyson Posted October 3, 2013 Report Posted October 3, 2013 I can't imagine identical behavior concluding in different results in this instance, but to me, this looks like a rounding issue in Stripe (or lack thereof) since only integers should be sent. By the way, Stripe expects the amount in cents, so 1499.5 = $14.995 Michael 1
Alex Posted October 4, 2013 Author Report Posted October 4, 2013 Here is what the Blesta log shows as input: https://api.stripe.com/v1/chargesa:3:{s:6:"amount";d:1499.5;s:8:"currency";s:3:"usd";s:8:"customer";s:18:"cus_XXXXXXXXXXX";} So, it appears that Blesta passed the 1499.5 value directly to Stripe, so these leaves me to conclude that it is not an error on the Stripe end.
Cody Posted October 7, 2013 Report Posted October 7, 2013 Try the attached (place in /components/gateways/merchant/stripe_gateway/). It should resolve the issue. stripe_gateway.php Michael 1
Cody Posted October 9, 2013 Report Posted October 9, 2013 Any issues with the above file before I mark this as closed?
Alex Posted October 9, 2013 Author Report Posted October 9, 2013 Won't have a chance to test for a couple months unless something changes, since this client paid for 2 months during testing and has a 1 month credit in his account.
JoieDeMort Posted October 10, 2013 Report Posted October 10, 2013 Is this included in 3.0.4 or do we need to copy this file if we're using Stripe?
Cody Posted October 10, 2013 Report Posted October 10, 2013 Copy the file, this fix will be available in 3.0.5.
Paul Posted October 10, 2013 Report Posted October 10, 2013 Is this included in 3.0.4 or do we need to copy this file if we're using Stripe? Please advise if this corrects the issue for you.. It's always good to have some confirmation before releasing an official fix.
JoieDeMort Posted October 10, 2013 Report Posted October 10, 2013 I did a test charge for 50% off 9.99 with Stripe, and it worked perfectly with the new file. Obviously, I'm a low sample size. Michael 1
JoieDeMort Posted October 10, 2013 Report Posted October 10, 2013 Interesting. When I "edit invoice" for this transaction, I see: (package) unit cost: 9.99 (coupon) unit cost: -4.995 Sub Total:$5.00 $5.00 -$5.00 $-0.01 So is Blesta keeping track of the $0.005 and going to keep a rolling credit?
Recommended Posts