Привет, я нашел один пример кода, в котором он просит передать ApiLoginID, ApiTransactionKey и TransactionsId.
Я могу получить ApiLoginID и ApiTransactionKey, но как мне получить тестовый транзакцию ID, так как в режиме тестирования authorize.net всегда дает транзакции как 0
Ниже приведен код, с помощью которого мне нужно получить номер кредитной карты. пожалуйста, предположите, что это правильный код или нет, чтобы получить данные кредитной карты?
public class GetTransactionDetails
{
public static ANetApiResponse Run(String ApiLoginID, String ApiTransactionKey, string transactionId)
{
ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
Console.WriteLine("Get transaction details sample");
ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
// define the merchant information (authentication / transaction id)
ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
{
name = ApiLoginID,
ItemElementName = ItemChoiceType.transactionKey,
Item = ApiTransactionKey,
};
var request = new getTransactionDetailsRequest();
request.transId = transactionId;
// instantiate the controller that will call the service
var controller = new getTransactionDetailsController(request);
controller.Execute();
// get the response from the service (errors contained if any)
var response = controller.GetApiResponse();
if (response != null && response.messages.resultCode == messageTypeEnum.Ok)
{
if (response.transaction == null)
return response;
Console.WriteLine("Transaction Id: {0}", response.transaction.transId);
Console.WriteLine("Transaction type: {0}", response.transaction.transactionType);
Console.WriteLine("Transaction status: {0}", response.transaction.transactionStatus);
Console.WriteLine("Transaction auth amount: {0}", response.transaction.authAmount);
Console.WriteLine("Transaction settle amount: {0}", response.transaction.settleAmount);
}
else if (response != null)
{
Console.WriteLine("Error: " + response.messages.message[0].code + " " +
response.messages.message[0].text);
}
return response;
}
}
}
В примере кода я передаю ниже учетные данные
const string apiLoginId = "5KP3u95bQpv";
const string transactionKey = "346HZ32z3fP4hTG2";
const string transactionId = "2249735976";
где я получаю данные, как на картинке ниже, но не могу получить данные кредитной карты

Я просто хочу получить данные кредитной карты для авторизации. Любая помощь
В своем коде я также добавил код, как показано ниже, но я получаю сообщение об ошибке
var obj = (creditCardMaskedType)response.transaction.payment.Item;
Console.WriteLine("Creditcard settle cardnumber: {0}", obj.cardNumber);
Ошибка
Дополнительная информация: Невозможно привести объект типа 'AuthorizeNet.Api.Contracts.V1.bankAccountMaskedType' к типу 'AuthorizeNet.Api.Contracts.V1.creditCardMaskedType'.