cancel
Showing results for 
Search instead for 
Did you mean: 

Intergrate with Authorize.Net with a C Program

We need to send a credit card authoriztion from a C program running on a web server. There was not an example for a C program, but I have done this with other payment gateways that use the same method and have not had a problem. When I do it with Authorize.Net the SendRequest never returns. It does not time out and will run forever it I do not stop it. One time I let it run for 2 hours to see what would happen and nothing happened. I know that the request I am sending is good. I trapped it in the progam before it was sent, pasted into a web browser and it worked fine.

 

The first thing I do is get a connection to the server with the following command:

CHttpConnection* pServer = session.GetHttpConnection("https://test.authorize.net/gateway/transact.dll", 443);

I do get a connection to the server, I have tried ports 80 and 8080 with no different results

 

Then I open a request to the server with the following command:

CHttpFile* pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_POST, "<my request>", NULL, 1, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_NO_AUTO_REDIRECT | INTERNET_FLAG_EXISTING_CONNECT);

This commands returns successfully. I was not sure if I was suppose to POST or PUT here. I tried both with no different results. POST worked with other payment gateways.

 

Then I send the request with the following commands:

sprintf(header, "Content-Type: application/x-www-form-urlencoded");

pFile->SendRequest(header, strlen(header), NULL, 0);

This is the last thing it does and just hangs at this point.

 

Any help on this would be appreciated.

 

rkriscka
Member
2 REPLIES 2

the sample I found have the post value send in the sendRequest and not in the openrequest

 

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q165298

 

 

443 and POST.

RaynorC1emen7
Expert

I rearranged everything as specified in the article with the same results. Everything is good until the sendRequest and it just hangs, I get no response back from Authorize.Net, not even an error. My client is getting anxious to get this working and I have two more ready to go with Authorize.Net as soon as I get this working. Any suggestions at all?