If you're wondering why I'm echoing an output during callback is because I keep getting error response from Authorize.net gateway, which sounded like this:
**Please DO NOT REPLY to this message. E-mail
support@authorize.net if you have any questions.
Authorize.Net Merchant,
Your script timed out while we were trying to post transaction results to it.
Transaction ID: 0
Transaction Result: This transaction has been approved.
The following message was displayed to the customer:
------------------------------An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.
This transaction has been approved.
It is advisable for you to contact the merchant to verify that you will receive the product or service.
This is the response from Authorize.net gateway staff, which I got from ZenCart forum related to the above error message:
Greetings from Authorize.Net!
When Authorize.Net is responding back to a script on your server our system waits 10 seconds for a response. If we do not get a response in 10 seconds, our server will time out and display an error page. In this case the customer will see the transaction results on an error page that Authorize.net generates.
If this happens we will either send an email to you indicating: "An error occurred while trying to report this transaction to the merchant. An email has been sent to the merchant informing them of the error. The following is a result of the attempt to charge your credit card"
or
The transaction will be declined within your Merchant Interface. The transaction detail will display (Unable to send notification to Customer).
If the customer closes the browser window before we receive data from your script to print to the screen we will change the transaction response reason code to 52.
To prevent these errors the first thing that you will need to look for is the order that your script executes. It is very important that something is printed to the screen before any other process is started. If your script prints to the screen first, we will recognize that you have received the transaction results.
To resolve this issue:
- Before doing anything else start writing to your receipt page. For example: print your page headers and the first part of the page body.
- Check that your script permissions are correct and that it can accept an HTTPS POST.
- Check that the script is not completing other functions before writing to the screen, such as writing to a database or sending emails.
- Please check to see if there are different processes that are used in your script for approvals, declines, or errors. Check each process to be sure that they will write to the screen before any other functions.
- Verify that your script is not using redirects upon receipt of the response from our servers. Redirects strongly are discouraged because they can potentially interfere with the process.
After echoing output on the callback, Authorize.net is no longer returning the error message to the screen, as well as to my email.
Things to note though, even before the above fix, the transaction is still being processed successfully, except that Authorize.net keep showing an error message that was shown above at the end of the payment process. I don't know how to get around it, so I come up with meta-refresh, which I'm using this code below to redirect the user after the callback to checkout_success controller. By using this method, it shows another problem, which I described on the first post.
Please, I need OpenCart expert to help me on this, because I don't know the way how the underlying payment system work in OpenCart.
Your help on this will be greatly appreciated.