Has anyone implemented the messaging iso8583 for Amex? I have a port and ip, but when I send an echo message (1804) with a socket it does not answer anything ... The Encoding is EBCDIC. Does anyone have an example? The code is in C#
Console.WriteLine("Send Message Echo...");
ManageConnection.ManageSocket _manage = new ManageConnection.ManageSocket(IpAmex, PortAmex);
TupleList<Encoding, string> _request = new TupleList<Encoding, string>();
_request.Add(Encoding.GetEncoding(500), "1804");
_request.Add(Encoding.UTF8, "2030018000000000");
_request.Add(Encoding.GetEncoding(500), "000000");
_request.Add(Encoding.GetEncoding(500), "112233");
_request.Add(Encoding.GetEncoding(500), "1709141205108318700");
var _response = _manage.SendMessageSocket(_request);
return _response;
public string SendMessageSocket(TupleList<Encoding, string> _messages) {
string _return = String.Empty;
try
{
byte[] bytes = new byte[65000];
IPAddress ipAddress = IPAddress.Parse(IP);
IPEndPoint remoteEP = new IPEndPoint(ipAddress, Port);
Socket sender = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
sender.Connect(remoteEP);
Console.WriteLine("Enviando mensaje....");
var bytesMessage = GetCompleteMessage(_messages);
// This function GetCompleteMessage= byte[] bytesMessage = { 241, 248, 240, 244, 32, 48, 1, 128, 0, 0, 0, 0, 240, 240, 240, 240, 241, 241, 241, 242, 242, 243, 243, 241, 247, 240, 249, 241, 244, 241, 242, 240, 245, 241, 240, 248, 243, 241,248, 247, 240, 240 };
int bytesSent = sender.Send(bytesMessage);
Console.WriteLine("Esperando respuesta....");
int bytesRec = sender.Receive(bytes); //Here don't receive nothing
int len = Array.IndexOf(bytes, byte.MinValue);
var responseString = Encoding.UTF8.GetString(bytes, byte.MinValue, len);
sender.Shutdown(SocketShutdown.Both);
sender.Close();
return xmlResponseString;
}
catch (Exception ex)
{
throw;
}
}
The message is for the ISO8583 Global Credit Authorization Guide (GCAG),
1. ISO8583-like specifications used by American Express.
They used several customized ISO 8583 dialects, for sample:
Looking to your MTI 1804 I guess it is GCAG and, yes, the message usually EBCDIC encoded.
From your request is not clear exactly the message body. Please Add the hexadecimal representation of your network message. It could show the potential issue with the message body encoding.
We are supporting online services around ISO8583 dialects and financial data. Here is the GCAG ISO 8583 message body parser. You can check the outgoing message structure and your EBCDIC encoding.
2. About American Express hosts.
I could agree that there are many TCP/IP Socket services which may forward and exchange message data with Amex or process message themselves, but in fact Amex uses Global Web Services (GWS) IP Payments Gateway in most cases, which is HTTPS connection with specific HTTP Headers.
Because of HTTP/HTTPS data transferring thru GWS the message, even EBCDIC encoded, processed as ASCII hexadecimal string.
TCP/IP Socket connections may have additional message headers, length bytes, starting and ending packet data. Ensure connection requirements for your TCP/IP host.
As an working example of Amex ISO 8583 message processing with test cards authorizations you can try GCAG host simulator posting your request messages directly thru the form or starting HTTPS host simulator service.
3. Example as a bonus
Here is your 1804 message corrected with primary bitmap processed thru Amex GCAG host simulator. Messages structure represented in YAML.