I am developing a website that uses Authorize.net but I am currently using a test account. To test a refund, it requires a unique transaction ID, but since I am only using a test account, it does not return a unique transaction ID when you make a test transaction (always 2147483647). Is there another way for this to work? I need to see if my code will work with the API.
-
It's been too long for me to be sure, but I think you need to be in live mode (not Test Mode) for a refund to work. Authorize.NET says to use a 1 cent transaction, their Merchant Integration Guide may have more details. – ryanday Aug 11 '09 at 10:42
3 Answers
Whatever code you're using to parse the "Transaction Id" that Authorize.net gives back to you after a successful transaction is converting that transaction id into an integer. It should be treated as a string, not an integer. In 2008, Authorize declared that they were switching from an integer to a string-based transaction ID because they ran out of 32-bit integers.
2147483647 is the largest base-10 integer you can make with 32 binary bits (1111 1111 1111 1111 1111 1111 1111 1111). It means that Authorize is returning a transaction id > 2147483647 (3000000000 for example) and your programming language is truncating the bits to the maximum value allowed, 2147483647.
Examine your PHP code and make sure the transaction id is being cast the value as a string. To be sure, you might want to go through your code and cast it yourself. For example:
(string)$transaction_id
Also make sure your code is not doing things that automatically cast strings as integers. For example:
$transaction_id + 1
Lastly, if the transaction ID is being read from a database, make sure the database is storing the transaction ID as a string datatype. For instance, with mysql, use CHAR, or VARCHAR and make it bigger than 10. Try 16 or 24 to be safe.
References:

- 4,055
- 8
- 43
- 54
If you are posting your Requests to https://test.authorize.net/gateway/transact.dll then you will always receive 0 as the transaction_id.
So In short you will need a live account to test your refunds. You may set x_test_request=TRUE and post to https://secure.authorize.net/gateway/transact.dll and check if you get a valid transaction id back. But again you will need a valid Live account with Authorize.Net to be able to post transactions to Live URL

- 11
- 1
To get transaction id, while sending transaction request in test mode, you need to set in you request parameters list:
x_test_request=FALSE
then you will get correct id

- 57,710
- 92
- 283
- 453

- 31
- 4
-
In Magento 1.7.0.2, this value is set in /app/code/core/Mage/Paygate/Model/Authorizenet.php - in the `_getRequest()` method, see `setXTestRequest()` – pspahn Dec 03 '12 at 18:16