cancel
Showing results for 
Search instead for 
Did you mean: 

Transaction ID is 0

Hello!

 

I use sandbox and C# examples from Authorize API for charge credit card. I get information with resultCode Ok for transaction request but I have transaction ID zero 0 in transactionResponse.

I think it is not normal. How to get real transaction ID and where I can see history for charge credit card? 

2 REPLIES 2

The XML response of an API call needs to be parsed in your code behind or on the page with JavaScript

        var xml = '<% = responseStr %> ';
        var result = $(xml).find("transid").text();
        $('#transid').val(result);

  

If using Accept Hosted, the transaction response needs to be parsed on your parent page from your Icommunicator.html with JavaScript similar to the following:

<script>
    window.CommunicationHandler = {};
    function parseQueryString(str) {
        var vars = [];
        var arr = str.split('&');
        var pair;
        for (var i = 0; i < arr.length; i++) {
            pair = arr[i].split('=');
            vars[pair[0]] = unescape(pair[1]);
        }
        return vars;
    }
    window.CommunicationHandler.onReceiveCommunication = function (argument) {
        params = parseQueryString(argument.qstr)
        parentFrame = argument.parent.split('/')[4];
          switch (params['action']) {
            case "transactResponse":
                var transResponse = JSON.parse(params['response']);
                $('#demo').html(transResponse.transId); // Transaction Id is here
               
        }

    }

</script>

<div id="demo"></div>

 See it in action at : https://nexwebsites.com/authorizenet/

Powered by NexWebSites.com -
Certified Authorize.net developers
NexusSoftware
Trusted Contributor

A transaction id of 0 indicates your sandbox account may bein test mode.  You should set your sandbox to live mode before it will process test transactions.

 

Richard