Page 1 of 1

weird insert payment error

Posted: Mon Sep 25, 2017 1:22 pm
by RickSilver
Exception: could not insert: [CommerceBuilder.Payments.Payment][SQL: INSERT INTO ac_Payments (OrderId, SubscriptionId, PaymentMethodId, PaymentMethodName, ReferenceNumber, Amount, CurrencyCode, PaymentDate, PaymentStatusId, PaymentStatusReason, CompletedDate, EncryptedAccountData, ReCrypt, IsSubscriptionFollowup, GatewayPaymentProfileId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?); select SCOPE_IDENTITY()]

This error just started occurring on a new store I'm working on. I can't find any custom code that's involved. Wondering if anyone else has gotten this. We have one payment method for Purchase orders. I was able to place test orders last night and now I get this error.

Re: weird insert payment error

Posted: Mon Sep 25, 2017 10:54 pm
by AbleMods
Could be several possibilities. What payment gateway are you using?

Should be more to that error than just the Exception: could not insert. It should identify what the specific error was. Maybe check the /app_data/logs/app.log file for more detail. Would help a lot with narrowing down the cause.

I have seen some unusual payment record or transaction record errors when certain details of the entry are too large. For instance, if the ReferenceNumber value returned by the gateway is longer than 50 chars, the value doesn't get truncated before it's stored to the table. So SQL will fail to write the record and throw an exception. Happens more with ac_Transactions than it does with payments, but I've seen it in both.

Finally, could be a permissions error in SQL. Have you ever been able to save a payment? What happens if you record a payment manually via the admin?

Re: weird insert payment error

Posted: Tue Sep 26, 2017 2:18 pm
by RickSilver
Thanks! It was the 50 character limit of the Reference number.

Re: weird insert payment error

Posted: Tue Sep 26, 2017 10:51 pm
by AbleMods
Glad you got it figured out. Not always easy determining which field is the problem.