Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Backend Data from AuthorizeNet


Guest

Recommended Posts

We use SIM. And we finally got that part working. The real test was populating the backend database with the orders, especially the sale price and cost. At first it was assumed that such data could be obtained from AuthorizeNet's silentpost. Not so. The silentpost does not seem to include item information.

 

So, how can it be done? Well, it can be done using the transaction number that comes down with silentpost. It was necessary to write a special class (Java in our case) that uses the AuthorizeNet API to call AuthorizeNet back and ask for the detailed data on the items sold. This request is done using the transaction number as the key. The response to the API call results in all the necessary data, including the item name and item price, and even multiple items in the same order when that occurs.

 

We put the SKU in the model field of the catalog item. The question is how to get that model number into AuthorizeNet. It is not normally sent in the transaction string sent to the SIM. It could probably be solved various ways, possibly even adding a custom field. It was easier for use just to replace one of the name fields in the string with the model number. For some reason the default string being transmitted has two instances of the name field. Have you ever noticed that the name appears twice on the AuthorizeNet transaction page?

 

Consider the stock string in the sim module authorizenet_cc_sim.php (includes/modules/payments):

$process_button_string .= tep_draw_hidden_field('x_line_item', ($i+1) . '<|>' . substr($order->products[$i]['name'], 0, 31) . '<|>' . substr($order->products[$i]['name'], 0, 255) . '<|>' . $order->products[$i]['qty'] . '<|>' . $this->format_raw($order->products[$i]['final_price']) . '<|>' . ($order->products[$i]['tax'] > 0 ? 'YES' : 'NO'));

We replaced the first occurrence of 'name' with 'model'. The SKU in the model field now shows up on the AuthorizeNet transaction page as the item name. This SKU number is stored in AuthorizeNet database along with other item information.

 

To use the API it is necessary to download the jar with the classes. I believe the API is available for several programming languages. Google 'AuthorizeNet API' to get details.

 

It took a while to write the code to pull down the transaction information from the AuthorizeNet database, but we finally got it all working. Now when a customer uses a credit card to buy an item, the silentpost triggers everything necessary to populate our backend database.

 

A heads-up: Because the SKU was put in the first name field, the method getName has to be used instead of getItemId to retrieve the SKU number.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...