cancel
Showing results for 
Search instead for 
Did you mean: 

Gateway error: This transaction has already been voided.

SOLVED

Gateway error: This transaction has already been voided.

We had a strange issue this morning where we were trying to cancel an authorize.net credit card order made last night.  When canceling the order, authorize.net approved the void (in the payment debug log), but still shows the error :

 

Gateway error: This transaction has already been voided.

 

Subsequent attempts to cancel or void are met with that same error (and this time a matching statement in the payment debug log).

 

So at this point, the order itself is voided, but its stuck in the 'processing' state.  Is there a way to move it to cancelled with it already having been voided?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Gateway error: This transaction has already been voided.

@joseph_digiovannaException in the log is not related to order or payment refund. That seems to be related to promotion rule. It would require to know the history of what you have done on your Magento and look into the setup to identify the issue.

 

To cancel the order you can follow the URL below which can help you in cancelling the order.

 

https://stackoverflow.com/questions/26011990/cancel-order-with-expired-authorization-transaction

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

View solution in original post

9 REPLIES 9

Re: Gateway error: This transaction has already been voided.

As a quick follow-up I've found in my exception log that at the exact time I got the response from authorize.net, there was a SQL foreign key constraint error shown here:

 

[2018-09-13 13:14:49] report.CRITICAL: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`salesrule_customer`, CONSTRAINT `SALESRULE_CUSTOMER_RULE_ID_SEQUENCE_SALESRULE_SEQUENCE_VALUE` FOREIGN KEY (`rule_id`) REFERENCES `sequence_salesrule` (`sequence_value`) ON DELETE C), query was: INSERT INTO `salesrule_customer` () VALUES () {"exception":"[object] (Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`salesrule_customer`, CONSTRAINT `SALESRULE_CUSTOMER_RULE_ID_SEQUENCE_SALESRULE_SEQUENCE_VALUE` FOREIGN KEY (`rule_id`) REFERENCES `sequence_salesrule` (`sequence_value`) ON DELETE C), query was: INSERT INTO `salesrule_customer` () VALUES () at /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`salesrule_customer`, CONSTRAINT `SALESRULE_CUSTOMER_RULE_ID_SEQUENCE_SALESRULE_SEQUENCE_VALUE` FOREIGN KEY (`rule_id`) REFERENCES `sequence_salesrule` (`sequence_value`) ON DELETE C) at /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []
[2018-09-13 13:14:49] report.CRITICAL: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`salesrule_customer`, CONSTRAINT `SALESRULE_CUSTOMER_RULE_ID_SEQUENCE_SALESRULE_SEQUENCE_VALUE` FOREIGN KEY (`rule_id`) REFERENCES `sequence_salesrule` (`sequence_value`) ON DELETE C), query was: INSERT INTO `salesrule_customer` () VALUES () {"exception":"[object] (Zend_Db_Statement_Exception(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`salesrule_customer`, CONSTRAINT `SALESRULE_CUSTOMER_RULE_ID_SEQUENCE_SALESRULE_SEQUENCE_VALUE` FOREIGN KEY (`rule_id`) REFERENCES `sequence_salesrule` (`sequence_value`) ON DELETE C), query was: INSERT INTO `salesrule_customer` () VALUES () at /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`magento`.`salesrule_customer`, CONSTRAINT `SALESRULE_CUSTOMER_RULE_ID_SEQUENCE_SALESRULE_SEQUENCE_VALUE` FOREIGN KEY (`rule_id`) REFERENCES `sequence_salesrule` (`sequence_value`) ON DELETE C) at /var/www/html/magento2/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []

Re: Gateway error: This transaction has already been voided.

@joseph_digiovannaThere can be multiple issues for the exception you are seeing. IF order is refunded in Authorize.net then you can simply create the Credit Memo against the invoice of the order you want to cancel. In credit memo you can select "Offline Refund" an in notes you can put comment with the transaction details for future reference purposes.

 

If you see the same issue again then you need to start looking into the issue you have with your Magento/Database.

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Gateway error: This transaction has already been voided.

Part of the issue is that there hasn't been an invoice created (this was authorized only, not captured).  They just wanted to cancel this order without moving forward.  

 

Is there any way to get more information about what the database issue was here?

Re: Gateway error: This transaction has already been voided.

@joseph_digiovannaException in the log is not related to order or payment refund. That seems to be related to promotion rule. It would require to know the history of what you have done on your Magento and look into the setup to identify the issue.

 

To cancel the order you can follow the URL below which can help you in cancelling the order.

 

https://stackoverflow.com/questions/26011990/cancel-order-with-expired-authorization-transaction

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Gateway error: This transaction has already been voided.

After you mentioned the promotion rule, I took a look at that value in the order, and it looks like they set the same promotion twice, so in the sales_order record it looks like 

 

code,code

 

Could this have caused the issue?  The promo code itself appears to have worked fine during the ordering process despite it being in there twice.

Re: Gateway error: This transaction has already been voided.

@joseph_digiovannaPossibly that may be the issue. Now you can cancel the order from database to close the order.

 

 Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Gateway error: This transaction has already been voided.

Thanks, I will look at closing the order manually.

 

Is it possible to only allow 1 promo code to be applied to an order?  I'd like to avoid this issue in the future and that seems to be the easiest way.

Re: Gateway error: This transaction has already been voided.

@joseph_digiovannaYou can do the same by setting "Discard subsequent rules" to "Yes" under "Action" in your promotion rule.

 

Problem solved? Please give 'Kudos' and accept 'Answer as Solution'.

- Tarandeep
Problem solved?Please give 'Kudos' and accept 'Answer as Solution'.

Re: Gateway error: This transaction has already been voided.

Okay, I'll attempt this and do some testing to let you know.  Thanks for your help so far.