HOW TO: Integrate Hosted Checkout with osCommerce

Created by Richard Moore, Modified on Wed, 12 Apr, 2023 at 12:02 PM by Richard Moore


Terminology


installation root:


the file system directory where osCommerce is installed, e.g. /var/www/html/oscommerce


base URL:


the URL to reach the installed osCommerce, e.g. http://mydomain.com/oscommerce/


checkout process URL:


the URL for the osCommerce handler that processes the transaction results for a payment.
on an unmodified osCommerce installation this will be [base URL]/catalog/checkout_process.php


Steps



  1. Download the customized authorizenet_cc_sim.php file at the bottom of this article

  2. Replace [installation root]/catalog/includes/modules/payment/authorizenet_cc_sim.php with the one downloaded in Step 1

  3. Log in to your osCommerce administration panel

  4. Click on Modules on the left menu

  5. Select the "Authorize.net Credit Card SIM" module

  6. Install the module (if this has not been done previously)

  7. Configure as in the screenshot below

  8. Click update to complete the configuration


oscommerce-authnet.png


By default the customized authorizenet_cc_sim.php script is set to behave exactly the same as the original one, meaning payments are sent to Authorize.Net. To use E-xact's Hosted Checkout service, edit authorizenet_cc_sim.php to set the $exact_mode variable as described in the Receipting Options section.


Receipting Options


There is no Silent Post handler in the osCommerce source code, so a customized one would be needed to use this feature. See explanation in Zen Cart Receipting Options for details.


The data that is returned to osCommerce from E-xact is used to display and email customer receipts, as well as to update its own database. Additional actions may be performed as well depending on the configuration of osCommerce.


Default Hosted Receipt


Shopping Cart


Using a text editor open the [installation root]/catalog/includes/modules/payment/authorizenet_cc_sim.php file.


Find this line:


var $exact_mode;

Change it to:


var $exact_mode = self::hosted;

sample of the sent payment request parameters:


x_fp_sequence = 961
x_fp_timestamp = 1271879002
x_fp_hash = 6adf60472153092e9a870180a810ba0f
x_login = WSP-E-XAC-95-38
x_version = 3.1
x_show_form = PAYMENT_FORM
x_first_name = John
x_last_name = Oscommerce
x_company =
x_address = 1234 Main Street
x_city = Vancouver
x_state = British Columbia
x_zip = V5R3G4
x_country = Canada
x_phone = 604-123-4567
x_cust_id = 2
x_customer_ip = 10.70.20.106
x_email = llin@e-xact.com
x_description = osCommerce Test Store
x_amount = 44.99
x_currency_code = CAD
x_method = CC
x_type = AUTH_ONLY
x_ship_to_first_name = John
x_ship_to_last_name = Oscommerce
x_ship_to_company =
x_ship_to_address = 1234 Main Street
x_ship_to_city = Vancouver
x_ship_to_state = British Columbia
x_ship_to_zip = V5R3G4
x_ship_to_country = Canada
x_test_request = TRUE
x_line_item = 1<|>Microsoft IntelliMouse Pro<|>Microsoft IntelliMouse Pro<|>1<|>39.99<|>NO
x_freight = 5.00
osCsid = utvsvsc33hifs0kk2gmjgko8t4

Payment Page


set Return Link Method (for receipt page) to POST


set Receipt Link URL to the checkout process URL


Relay Response


The option Pass HTTP Redirects to the Customer's Browser can be enabled, since osCommerce's checkout process handler does return a redirect (HTTP Status 302) to the destination page. The destination page would be [base URL]/catalog/checkout_success.php for a successful payment, or [base URL]/catalog/checkout_payment.php for a failed payment.


Shopping Cart


Using a text editor open the [installation root]/catalog/includes/modules/payment/authorizenet_cc_sim.php file.


Find this line:


var $exact_mode;

Change it to:


var $exact_mode = self::relay;

payment request will include:



  • x_relay_response set to TRUE

  • x_relay_url set to checkout process URL


sample of the sent payment request parameters:


x_fp_sequence = 897
x_fp_timestamp = 1271880313
x_fp_hash = eafa4a5abae131f12808fd4afd06a827
x_login = WSP-E-XAC-95-38
x_version = 3.1
x_show_form = PAYMENT_FORM
x_first_name = John
x_last_name = Oscommerce
x_company =
x_address = 1234 Main Street
x_city = Vancouver
x_state = British Columbia
x_zip = V5R3G4
x_country = Canada
x_phone = 604-123-4567
x_cust_id = 2
x_customer_ip = 10.70.20.106
x_email = llin@e-xact.com
x_description = osCommerce Test Store
x_amount = 34.99
x_currency_code = CAD
x_method = CC
x_type = AUTH_CAPTURE
x_relay_response = TRUE
x_relay_url = http://mydomain.com/oscommerce/catalog/checkout_process.php
x_ship_to_first_name = John
x_ship_to_last_name = Oscommerce
x_ship_to_company =
x_ship_to_address = 1234 Main Street
x_ship_to_city = Vancouver
x_ship_to_state = British Columbia
x_ship_to_zip = V5R3G4
x_ship_to_country = Canada
x_test_request = TRUE
x_line_item = 1<|>Courage Under Fire<|>Courage Under Fire<|>1<|>29.99<|>NO
x_freight = 5.00
osCsid = utvsvsc33hifs0kk2gmjgko8t4

Payment Page


check Allow Relay Response


set Relay Response URL to the checkout process URL


REDI


Shopping Cart


Using a text editor open the [installation root]/catalog/includes/modules/payment/authorizenet_cc_sim.php file.


Find this line:


var $exact_mode;

Change it to:


var $exact_mode = self::redir;

sample of the sent payment request parameters:


x_fp_sequence = 32
x_fp_timestamp = 1271880821
x_fp_hash = a57a7e16c36200e92dfc5fa45e141a44
x_login = WSP-E-XAC-95-38
x_version = 3.1
x_show_form = PAYMENT_FORM
x_first_name = John
x_last_name = Oscommerce
x_company =
x_address = 1234 Main Street
x_city = Vancouver
x_state = British Columbia
x_zip = V5R3G4
x_country = Canada
x_phone = 604-123-4567
x_cust_id = 2
x_customer_ip = 10.70.20.106
x_email = llin@e-xact.com
x_description = osCommerce Test Store
x_amount = 504.99
x_currency_code = CAD
x_method = CC
x_type = AUTH_CAPTURE
x_ship_to_first_name = John
x_ship_to_last_name = Oscommerce
x_ship_to_company =
x_ship_to_address = 1234 Main Street
x_ship_to_city = Vancouver
x_ship_to_state = British Columbia
x_ship_to_zip = V5R3G4
x_ship_to_country = Canada
x_test_request = TRUE
x_line_item = 1<|>Hewlett Packard LaserJet 1100Xi<|>Hewlett Packard LaserJet 1100Xi<|>1<|>499.99<|>NO
x_freight = 5.00
osCsid = utvsvsc33hifs0kk2gmjgko8t4

Payment Page


set Return Link Method (for receipt page) to REDI


set Receipt Link URL to the checkout process URL


set Maximum Number of Payment Attempts to 1 (recommended)


Downloads

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article