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?
07-20-2017 12:55 AM
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/
07-20-2017 04:57 AM - edited 07-20-2017 05:00 AM
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
07-20-2017 05:01 AM