In sample-code-csharp-master.zip from 3/23/2017 5:14 PM setting GetCustomerProfile's unmaskExpirationDate to true returns expirationDate "XXXX". Would Authorize.Net fix GetCustomerProfile so setting unmaskExpirationDate to true returns the actual expiration date? The Authorize.NET\Utility\HttpXmlUtility.cs code in the if statement below returned unmasked expiration dates:
if (type.FullName == "AuthorizeNet.APICore.getCustomerProfileRequest")
but the else code from sdk-dotnet-master.zip 3/23/2017 12:30 PM returned "XXXX", rather than expiration date. The else code did not send <unmaskExpirationDate> to Authorize.Net in the webRequest.GetRequestStream(). See second code chunk below.
public ANetApiResponse Send(ANetApiRequest apiRequest) {
//Authenticate it
AuthenticateRequest(apiRequest);
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(_serviceUrl);
webRequest.Method = "POST";
webRequest.ContentType = "text/xml";
webRequest.KeepAlive = true;
//set the http connection timeout
var httpConnectionTimeout = AuthorizeNet.Environment.getIntProperty(Constants.HttpConnectionTimeout);
webRequest.Timeout = (httpConnectionTimeout != 0 ? httpConnectionTimeout : Constants.HttpConnectionDefaultTimeout);
//set the time out to read/write from stream
var httpReadWriteTimeout = AuthorizeNet.Environment.getIntProperty(Constants.HttpReadWriteTimeout);
webRequest.ReadWriteTimeout = (httpReadWriteTimeout != 0 ? httpReadWriteTimeout : Constants.HttpReadWriteDefaultTimeout);
// Serialize the request
var type = apiRequest.GetType();
if (type.FullName == "AuthorizeNet.APICore.getCustomerProfileRequest")
{
var req = (getCustomerProfileRequest)apiRequest;
var s3 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><getCustomerProfileRequest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
+ "xmlns:xsd =\"http://www.w3.org/2001/XMLSchema\" xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">"
+ "<merchantAuthentication><name>" + req.merchantAuthentication.name + "</name>"
+ "<transactionKey>" + req.merchantAuthentication.Item + "</transactionKey></merchantAuthentication>"
+ "<customerProfileId>" + req.customerProfileId + "</customerProfileId>"
+ "<unmaskExpirationDate>" + (req.unmaskExpirationDate ? "true" : "false") + "</unmaskExpirationDate>"
+ "</getCustomerProfileRequest>";
byte[] bytes = Encoding.UTF8.GetBytes(s3);
webRequest.GetRequestStream().Write(bytes, 0, bytes.Length);
}
else
{
var serializer = new XmlSerializer(type);
XmlWriter writer = new XmlTextWriter(webRequest.GetRequestStream(), Encoding.UTF8);
serializer.Serialize(writer, apiRequest);
writer.Close();
}
// Get the response
WebResponse webResponse = webRequest.GetResponse();
// Load the response from the API server into an XmlDocument.
var xmlDoc = new XmlDocument();
xmlDoc.Load(XmlReader.Create(webResponse.GetResponseStream(), new XmlReaderSettings()));
var response = DecideResponse(xmlDoc);
CheckForErrors(response, xmlDoc);
return response;
}
You can put the following code after var type = apiRequest.GetType(); to put apiRequest in a string.
var type = apiRequest.GetType(); var serializer2 = new XmlSerializer(type); MemoryStream memoryStream = new MemoryStream(); XmlWriter writer2 = new XmlTextWriter(memoryStream, Encoding.UTF8); serializer2.Serialize(writer2, apiRequest); memoryStream.Position = 0; var streamReader = new StreamReader(memoryStream); var s = streamReader.ReadToEnd(); streamReader.Dispose(); memoryStream.Dispose();
Looks like the SDK update broke how unmaskExpirationDate works, getting “XXXX” instead of the real date is definitely frustrating. I was checking this while working on some Kids colouring pages stuff, and honestly these kinds of glitches slow everything down.
11-24-2025 06:54 AM
Looks like the SDK update broke how unmaskExpirationDate works, getting “XXXX” instead of the real date is definitely frustrating. I was checking this while working on some Kids colouring pages stuff, and honestly these kinds of glitches slow everything down.
11-24-2025 06:57 AM - edited 11-24-2025 06:58 AM