Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help setting up 2checkout with no SSL


xshopaholic

Recommended Posts

I would like to setup the catalog v2.2 with 2checkout without ssl. When the customer chooses to pay by credit card, I want them to go to the to the 2checkout payment page. I need help configuring the pm2checkout.php module.

 

There was another thread explaining how do do this:

 

http://www.oscommerce.com/forums/viewtopic.php...eckout&start=10

 

I couldn't figure it out. Can someone help me or post their pm2checkout.php if they got it to work? Thanks.

 

Gina

Link to comment
Share on other sites

This modified pm2checkout.php file seems to be a classified secret. I see that quite a few people, including myself are having trouble modifying the file from the sketchy instructions that have been posted.

 

I don't see why someone won't just post the modified file or even just paste the contents in a message.

 

I would be willing to even pay for the file if the price was reasonable.

 

Jayman

Link to comment
Share on other sites

Ok here is my pm2checkout.php. I have not tested with real transactions yet, but it works great in test mode. Enjoy! :)

 

<?php

/*

$Id: pm2checkout.php,v 1.12 2002/08/13 16:00:42 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

class pm2checkout {

var $code, $title, $description, $enabled;

var $cc_number, $cc_expires_month, $cc_expires_year;

 

// class constructor

function pm2checkout() {

global $HTTP_POST_VARS;

 

$this->code = 'pm2checkout';

$this->title = MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE;

$this->description = MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION;

$this->enabled = MODULE_PAYMENT_2CHECKOUT_STATUS;

}

 

// class methods

function javascript_validation() {

//return false;

}

 

function selection() {

$selection_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "n" .

' <tr>' . "n" .

' <td class="main"> ' . MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION . ' </td>' . "n" .

' </tr>' . "n" .

'</table>' . "n";

return $selection_string;

}

 

function pre_confirmation_check() {

//return false;

}

 

 

function confirmation() {

global $CardName, $CardNumber, $checkout_form_action;

$confirmation_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "n" .

' <tr>' . "n" .

' <td class="main"> ' . MODULE_PAYMENT_2CHECKOUT_TEXT_CONFIRMATION . ' </td>' . "n" .

' </tr>' . "n" .

'</table>' . "n";

 

$checkout_form_action = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c';

return $confirmation_string;

}

 

function process_button() {

global $CardNumber, $order;

 

$process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) .

tep_draw_hidden_field('x_amount', number_format($order->info['total'], 2)) .

tep_draw_hidden_field('x_invoice_num', date('YmdHis')) .

tep_draw_hidden_field('x_test_request', MODULE_PAYMENT_2CHECKOUT_TESTMODE) .

tep_draw_hidden_field('x_country', $order->customer['country']['title']) .

tep_draw_hidden_field('x_email', $order->customer['email_address']) .

tep_draw_hidden_field('x_phone', $order->customer['telephone']) .

tep_draw_hidden_field('x_ship_to_first_name', $order->delivery['firstname']) .

tep_draw_hidden_field('x_ship_to_last_name', $order->delivery['lastname']) .

tep_draw_hidden_field('x_ship_to_address', $order->delivery['street_address']) .

tep_draw_hidden_field('x_ship_to_city', $order->delivery['city']) .

tep_draw_hidden_field('x_ship_to_state', $order->delivery['state']) .

tep_draw_hidden_field('x_ship_to_zip', $order->delivery['postcode']) .

tep_draw_hidden_field('x_ship_to_country', $order->delivery['country']['title']) .

tep_draw_hidden_field('x_receipt_link_url', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .

tep_draw_hidden_field('x_email_merchant', MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT);

 

return $process_button_string;

}

 

function before_process() {

global $HTTP_POST_VARS;

 

if ($HTTP_POST_VARS['x_response_code'] != '1') {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_MESSAGE), 'SSL', true, false));

}

}

 

function after_process() {

//return false;

}

 

function output_error() {

global $HTTP_GET_VARS;

 

$output_error_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "n" .

' <tr>' . "n" .

' <td class="main"> <font color="#FF0000"><b>' . MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR . '</b></font><br> ' . stripslashes($HTTP_GET_VARS['cc_val']) . ' </td>' . "n" .

' </tr>' . "n" .

'</table>' . "n";

 

return $output_error_string;

}

 

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

return $this->_check;

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow 2CheckOut', 'MODULE_PAYMENT_2CHECKOUT_STATUS', '1', 'Do you want to accept 2CheckOut payments?', '6', '0', 'tep_cfg_select_option(array('1', '0'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('2CheckOut Login/Store Number', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', '18157', 'Login/Store Number used for 2CheckOut payments', '6', '0', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('2CheckOut Test Mode', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'Y', 'Test mode for 2CheckOut payments (Y/N)', '6', '0', 'tep_cfg_select_option(array('Y', 'N'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Email Merchant Every Order', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'FALSE', 'Email the merchant on every order made', '6', '0', 'tep_cfg_select_option(array('TRUE', 'FALSE'), ', now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_STATUS'");

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_LOGIN'");

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_TESTMODE'");

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT'");

}

 

function keys() {

return array('MODULE_PAYMENT_2CHECKOUT_STATUS', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT');

}

}

?>

 

Note: you need to add MODULE_PAYMENT_2CHECKOUT_TEXT_CONFIRMATION to lang. file.

Link to comment
Share on other sites

Thanks Mans for the file. It appears to be trying to work, but I have just one small problem. On my Payment Method page, right under the 2Checkout option, it reads:

 

Credit Card Test Info:

 

CC#: 4111111111111111

Expiry: Any

 

I've been looking in the Admin section and everywhere to find this so I can delete it, because when I click on Confirm Order and go to 2Checkout, I get a Parameter Error. It says:

Incorrect parameters were supplied therefore this purchase cannot begin.

 

But I'm much closer than I was before. Maybe you or someone can tell me what's causing this.

 

Thanks again,

 

Jayman

Link to comment
Share on other sites

"Note: you need to add MODULE_PAYMENT_2CHECKOUT_TEXT_CONFIRMATION to lang. file."

 

which file to add this line to? what dir is it in?

 

sorry, i'm kinda new. :)

Link to comment
Share on other sites

Hi reap,

 

Just copy the text below this line to a text file called pm2checkout.php.

That should be all you need to do.

 

Make sure you backup your original, just in case :wink:

 

Les

--------------------------------------------

 

<?php

/*

$Id: pm2checkout.php,v 1.12 2002/08/13 16:00:42 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

class pm2checkout {

var $code, $title, $description, $enabled;

var $cc_number, $cc_expires_month, $cc_expires_year;

 

// class constructor

function pm2checkout() {

global $HTTP_POST_VARS;

 

$this->code = 'pm2checkout';

$this->title = MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE;

$this->description = MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION;

$this->enabled = MODULE_PAYMENT_2CHECKOUT_STATUS;

$this->cc_number = tep_db_prepare_input($HTTP_POST_VARS['pm_2checkout_cc_number']);

$this->cc_expires_month = tep_db_prepare_input($HTTP_POST_VARS['pm_2checkout_cc_expires_month']);

$this->cc_expires_year = tep_db_prepare_input($HTTP_POST_VARS['pm_2checkout_cc_expires_year']);

}

 

// class methods

function javascript_validation() {

$validation_string = 'if (payment_value == "' . $this->code . '") {' . "n" .

' var pm_2checkout_cc_number = document.payment.pm_2checkout_cc_number.value;' . "n" .

' if (pm_2checkout_cc_number == "" || pm_2checkout_cc_number.length < ' . CC_NUMBER_MIN_LENGTH . ') {' . "n" .

' error_message = error_message + "' . MODULE_PAYMENT_2CHECKOUT_TEXT_JS_CC_NUMBER . '";' . "n" .

' error = 1;' . "n" .

' }' . "n" .

'}' . "n";

return $validation_string;

}

 

function selection() {

for ($i=1; $i < 13; $i++) {

$expires_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000)));

}

 

$today = getdate();

for ($i=$today['year']; $i < $today['year']+10; $i++) {

$expires_year[] = array('id' => strftime('%y',mktime(0,0,0,1,1,$i)), 'text' => strftime('%Y',mktime(0,0,0,1,1,$i)));

}

 

/*

$selection_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "n" .

' <tr>' . "n" .

' <td class="main"> ' . MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_NUMBER . ' </td>' . "n" .

' <td class="main"> ' . tep_draw_input_field('pm_2checkout_cc_number') . ' </td>' . "n" .

' </tr>' . "n" .

' <tr>' . "n" .

' <td class="main"> ' . MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_EXPIRES . ' </td>' . "n" .

' <td class="main"> ' . tep_draw_pull_down_menu('pm_2checkout_cc_expires_month', $expires_month, date('m')) . ' / ' . tep_draw_pull_down_menu('pm_2checkout_cc_expires_year', $expires_year) . '</td>' . "n" .

' </tr>' . "n" .

'</table>' . "n";

*/

return $selection_string;

}

 

function pre_confirmation_check() {

 

/*

include(DIR_WS_FUNCTIONS . 'ccval.php');

 

$cc_val = CCValidationSolution($this->cc_number);

if ($cc_val == '1') {

$cc_val = ValidateExpiry($this->cc_expires_month, $this->cc_expires_year);

}

if ($cc_val != '1') {

$payment_error_return = 'payment_error=' . $this->code . '&pm_2checkout_cc_expires_month=' . $this->cc_expires_month . '&pm_2checkout_cc_expires_year=' . $this->cc_expires_year . '&cc_val=' . urlencode($cc_val);

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, $payment_error_return, 'SSL', true, false));

}

*/

}

 

function confirmation() {

global $CardName, $CardNumber, $checkout_form_action;

 

/*

$confirmation_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "n" .

' <tr>' . "n" .

' <td class="main"> ' . MODULE_PAYMENT_2CHECKOUT_TEXT_TYPE . ' ' . $CardName . ' </td>' . "n" .

' </tr>' . "n" .

' <tr>' . "n" .

' <td class="main"> ' . MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_NUMBER . ' ' . $CardNumber . ' </td>' . "n" .

' </tr>' . "n" .

' <tr>' . "n" .

' <td class="main"> ' . MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_EXPIRES . ' ' . strftime('%B/%Y', mktime(0,0,0,$this->cc_expires_month, 1, '20' . $this->cc_expires_year)) . ' </td>' . "n" .

' </tr>' . "n" .

'</table>' . "n";

 

*/

$checkout_form_action = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c';

 

return $confirmation_string;

}

 

function process_button() {

global $CardNumber, $order;

 

$process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) .

tep_draw_hidden_field('x_amount', number_format($order->info['total'], 2)) .

tep_draw_hidden_field('x_invoice_num', date('YmdHis')) .

tep_draw_hidden_field('x_test_request', MODULE_PAYMENT_2CHECKOUT_TESTMODE) .

tep_draw_hidden_field('x_card_num', $CardNumber) .

tep_draw_hidden_field('x_exp_date', $this->cc_expires_month . $this->cc_expires_year) .

tep_draw_hidden_field('x_first_name', $order->customer['firstname']) .

tep_draw_hidden_field('x_last_name', $order->customer['lastname']) .

tep_draw_hidden_field('x_address', $order->customer['street_address']) .

tep_draw_hidden_field('x_city', $order->customer['city']) .

tep_draw_hidden_field('x_state', $order->customer['state']) .

tep_draw_hidden_field('x_zip', $order->customer['postcode']) .

tep_draw_hidden_field('x_country', $order->customer['country']['title']) .

tep_draw_hidden_field('x_email', $order->customer['email_address']) .

tep_draw_hidden_field('x_phone', $order->customer['telephone']) .

tep_draw_hidden_field('x_ship_to_first_name', $order->delivery['firstname']) .

tep_draw_hidden_field('x_ship_to_last_name', $order->delivery['lastname']) .

tep_draw_hidden_field('x_ship_to_address', $order->delivery['street_address']) .

tep_draw_hidden_field('x_ship_to_city', $order->delivery['city']) .

tep_draw_hidden_field('x_ship_to_state', $order->delivery['state']) .

tep_draw_hidden_field('x_ship_to_zip', $order->delivery['postcode']) .

tep_draw_hidden_field('x_ship_to_country', $order->delivery['country']['title']) .

tep_draw_hidden_field('x_receipt_link_url', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'NONSSL')) .

tep_draw_hidden_field('x_email_merchant', MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT);

 

return $process_button_string;

}

 

function before_process() {

global $HTTP_POST_VARS;

 

if ($HTTP_POST_VARS['x_response_code'] != '1') {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_MESSAGE), 'SSL', true, false));

}

}

 

function after_process() {

return false;

}

 

function output_error() {

global $HTTP_GET_VARS;

 

$output_error_string = '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "n" .

' <tr>' . "n" .

' <td class="main"> <font color="#FF0000"><b>' . MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR . '</b></font><br> ' . stripslashes($HTTP_GET_VARS['cc_val']) . ' </td>' . "n" .

' </tr>' . "n" .

'</table>' . "n";

 

return $output_error_string;

}

 

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

return $this->_check;

}

 

function install() {

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Allow 2CheckOut', 'MODULE_PAYMENT_2CHECKOUT_STATUS', '1', 'Do you want to accept 2CheckOut payments?', '6', '0', 'tep_cfg_select_option(array('1', '0'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('2CheckOut Login/Store Number', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', '33929', 'Login/Store Number used for 2CheckOut payments', '6', '0', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('2CheckOut Test Mode', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'Y', 'Test mode for 2CheckOut payments (Y/N)', '6', '0', 'tep_cfg_select_option(array('Y', 'N'), ', now())");

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Email Merchant Every Order', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'FALSE', 'Email the merchant on every order made', '6', '0', 'tep_cfg_select_option(array('TRUE', 'FALSE'), ', now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_STATUS'");

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_LOGIN'");

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_TESTMODE'");

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT'");

}

 

function keys() {

return array('MODULE_PAYMENT_2CHECKOUT_STATUS', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT');

}

}

?>

Link to comment
Share on other sites

hmm stuck it in and got this error...

 

"Fatal error: Cannot redeclare class pm2checkout in /www/users/reap/www/includes/modules/payment/pm2checkout.php on line 13

"

when checkout_payment.php came up after i hit continue....

Link to comment
Share on other sites

  • 4 weeks later...

Help!!!!

 

I can't get it to work. I deleted everything in the pm2checkout file in includes/modules/payments/ and then replaced it with the code. I then enabled 2checkout in admin and when I tried to place an order, the option just didn't show up....

 

what should I do?

Link to comment
Share on other sites

  • 2 weeks later...
Help!!!!

 

I can't get it to work. I deleted everything in the pm2checkout file in includes/modules/payments/ and then replaced it with the code. I then enabled 2checkout in admin and when I tried to place an order, the option just didn't show up....

 

what should I do?

 

PLEASE HELP!! I'm having the same problem.. Would someone please help with this. I really need to get this to work!

 

Thanks,

Alex

Extreme Alterations

Link to comment
Share on other sites

If you are using a post 11/01/02 snapshot, I have a successful bit of code posted at http://www.oscommerce.com/forums/viewtopic.php...26774&highlight that just asks for the name in the non SSL page for 2Checkout.

 

I can't however imagine why one would want to use 2checkout after my experience, no customer service, 5-7% of each transaction, pretty expensive, and they hold your money for two weeks or more, a pretty nasty experience from my seat.

 

You can do better with an authorize.net account, I use www.mbankcard.com.

 

But hey, it is your choice.

Mr. Ree

How to find answers to OSC Common Questions

1. Look at http://wiki.oscommerce.com

2. Search http://www.oscommerce.com/forums/

3. Post a request in http://www.oscommerce.com/forums/

Link to comment
Share on other sites

It's like $30.00 a month. Less than the present 5% + headaches from 2checkut.

 

Maybe take a look at the site in the link above, email or call Kent the owner.

Mr. Ree

How to find answers to OSC Common Questions

1. Look at http://wiki.oscommerce.com

2. Search http://www.oscommerce.com/forums/

3. Post a request in http://www.oscommerce.com/forums/

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...