4

We* have a web application, created by Delphi + Intraweb (for the front end/web code management) that manages an ordering process. It acquires ordering information, then sends a transaction request to authorize.net (essentially using their SIM sample code). This works beautifully, and the credit card order is processed.

However, when authorize.net sends the form post back to the relay response url (http://developer.authorize.net/guides/SIM/Receipt_Options/Relay_Response.htm), the Intraweb app blows up. I can see, using TamperData, that the form data is being sent correctly. She can see that her program opens a database connection, then times out.

  • I've exhausted my google-fu, and haven't found any examples of Intraweb code being able to accept incoming form posts. (That's probably all we really need. If we could get the data into the Intraweb/Delphi world, we could then manage the rest.)
  • The Intraweb documentation suggests that IW will accept params passed on a URL, but doesn't mention accepting POST data.
  • The authorize.net community forum has an asked/answered post, that says basically "Sorry, we don't have any Delphi code samples, ask your vendor."
  • Intraweb Tech Support hasn't been able to help her. (I think they haven't responded to the request from several weeks ago, but I'm not certain.)
  • I suggested that she create a test application stub that mimicked the authorize.net form post, to be sure that the form objects were being properly created. (I don't really understand what's happening under the covers of the drag-n-drop form fields, but I poured over the generated source code to try to figure this out.) But a form POST is a form POST, right? I mean, it's HTTP, not magic. But there were two problems with that. 1.) Intraweb seems to force form field names to all CAPS. 2.) She says that IW won't accept underscores as a part of the form field name. And of course, we're stuck with what authorize.net sends, lower-case, underscore separated, and all.

Do you have any insights, pointers to sample code, or advice to chuck it all and move to another solution? We'd greatly appreciate any of the above.

*We = an old-skool Delphi programmer/DBA who knows Delphi inside out but Intraweb "automagically works" and me, a Java programmer and occasional PHP hacker on the other side of the country, who's allergic to visual IDE's but trying to interpret teh Internets & the mysteries of HTTP for her. For this particular problem, we appear to be less than the sum of our parts.

buzzo
  • 110
  • 7
  • You can manage the post from a separate application. If you're Delphi shop, you can do that from a Delphi program + INDY. Intraweb, btw, is made in INDY. I don't know the authorize.net service, but I'm sure you can manage this using INDY and then performing a redirection to the IW application. – jachguate Apr 01 '11 at 18:50
  • Thanks jachguate! I saw references to INDY when researching the problem, but I wasn't sure if it was necessary, or if Intraweb could handle it all by itself. – buzzo Apr 01 '11 at 18:58
  • @buzzo, Intraweb is based in INDY... I never tried that, but you have to try if this is possible before looking to other side, hopefully someone with the experience comes here and tell us how to do that. – jachguate Apr 01 '11 at 23:34
  • 1
    Drag and drop creation of a form in IW will not help - this is the part which creates the HTTP POST request. Instead, the IW app needs a generic HTTP POST event handler for the incoming form data from authorize.net. This should be possible (with the help of the IW support). Maybe it requires to go one level down to the WebBroker layer. For debugging, I would run a Indy HTTP server and examine the incoming form parameters, this requires only a couple of code lines. – mjn Apr 02 '11 at 11:17
  • OK, that's really useful. I wasn't sure if IW had a genericHTTP POST event handler or if it automagically created object-specific POST handlers based on the "form object" that was drag-n-dropped into the app. That was my original guess, assuming that's how "normal" forms were managed. *Does* IW support POSTs at all? I was assuming that they did, at least for internal page-to-page use, but my colleague just said something that makes me think they don't support POST at all. Can that be true? – buzzo Apr 02 '11 at 17:11
  • The IW documentation linked in your question above mentions that Page mode uses HTTP POST - but this is to handle user input in the IW HTML form, not for arbitrary incoming POST requests. I just found an accepted SO answer which shows actually what has to happen in this event handler, in PHP code, it is rather short (but has an include("../../simdata.php")): http://stackoverflow.com/questions/1209525/good-authorize-net-php-libraries/1221473#1221473 – mjn Apr 02 '11 at 17:32
  • Thanks, @mjn. That code looks pretty similar to the sample code we're looking at (well, except in PHP, of course). The trick is that we're trying to simply get the parameters out in IW: If I just knew how to do THIS, that would solve my problem. $responseCode = $_POST['x_response_code']; – buzzo Apr 05 '11 at 14:39

3 Answers3

2

I suggest you use the SOAP interface for Authorize.net. I have a Delphi/Intraweb application that handles payments and subscriptions with authorize.net, took me 1 hour to figure it out. Just setup a small test project and import the wsdl from authorize.net, you would be able to handle everything they provide in no time. If want to try and have problems, I can help you with some examples from my code.

ioan ghip
  • 1,202
  • 2
  • 16
  • 27
  • Thanks! Code samples would be wonderful. But a pointer to a basic Delphi/Intraweb SOAP setup might be a good place for us to start. Got any suggestions? (I'm off to google now...) – buzzo Apr 07 '11 at 20:08
  • OK, it looks like we've got the Delphi SOAP infrastructure set up and tested, and are now trying to get a sample authnet transaction processed. If the offer for code examples still stands, that would be a great help! – buzzo Apr 11 '11 at 15:38
  • OK, here you go: first you import the WSDL from authorize.net and you will get something like this: http://pastebin.com/xYPaapbm . Then use code like this example to do whatever you want: http://pastebin.com/MweDSvfb – ioan ghip Apr 13 '11 at 20:08
  • And here is how you call the code in your main form: http://pastebin.com/W5dFxEWC – ioan ghip Apr 13 '11 at 20:17
2

Thanks to pointers from @ioan, we've got a SOAP solution up and running. It took my colleague a bit of trial and error to write the Pascal code, but she passed it on to me to post in case it saves anyone else some time. Here's what she ended up with:

procedure TfrmSOAP.btnGetUnsettledReportClick(Sender: TObject);
var
  X : ServiceSoap;
  MyAuthentication : MerchantAuthenticationType;
  MyRequest : GetUnsettledTransactionListRequestType;
  aResponse : GetUnsettledTransactionListResponseType;
  msg : string;
  i : integer;
begin
  inherited;
  //Call the service
  X := GetServiceSoap(false);
  //create some variables/parameters to pass back and forth
  MyAuthentication := MerchantAuthenticationType.Create;
  MyRequest := GetUnsettledTransactionListRequestType.Create;
  aResponse := GetUnsettledTransactionListResponseType.Create;
  try
    //assign values to the MerchantAuthenticationType parameter
    MyAuthentication.name_ := APILoginTest;
    MyAuthentication.transactionKey := TransKeyTest;
    //request a list of unsettled transactions
    aResponse := X.GetUnsettledTransactionList(MyAuthentication, MyRequest);
    //check to see if the request was successful
    if aResponse.resultCode <> messagetypeenum(0) then
        begin
          ShowMsg('Error');
          ShowMsg(aResponse.messages[0].text);
        end;
    //step through the list, and display i, InvoiceNo, and LastName.
    for i := 0 to high(aResponse.transactions) do
       msg := msg + IntToStr(i) + ') ' + aResponse.transactions[i].invoiceNumber
              + '  '+ aResponse.transactions[i].lastName + #13;
    ShowMsg(msg);
  finally
    MyRequest.Free;
    MyAuthentication.Free;
    aResponse.Free;
  end;
end;

She also sends the reminder to be sure you're using the right info when running tests vs. production: "I was using the URL in the downloaded WSDL. Which is for production accounts. You must use a different one for test accounts. So I kept getting an empty list, and thought it was error in my code, not getting a response."

Thanks again for all of the help and suggestions!

buzzo
  • 110
  • 7
  • I'm kind of late with the code, I see that you already figured out. OK, here you go, the way I did it: first you import the WSDL from authorize.net and you will get something like this: http://pastebin.com/xYPaapbm . Then use code like this example to do whatever you want: http://pastebin.com/MweDSvfb , And here is how you call the code in your main form: pastebin.com/W5dFxEWC – ioan ghip Apr 13 '11 at 20:18
0

There was once a credit card component from Arcana (www.arcanatech.com) that was made specifically to work with Intraweb and authorize.net. While it was a little tricky to configure the SSL required for use, this piece of code was inexpensive and is still in use to this day in applications written 6-8 years ago.

WmFox
  • 1