Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Screwed by 2CheckOut!


Priest

Recommended Posts

  • Replies 195
  • Created
  • Last Reply

OOOOh, God, I'm so new to all this... A Q for 2CO users: How do you set up a test account for testing the module? Where? I know it must be somewhere on 2checkout.com in admin panel... but where?

 

Thank you

Link to comment
Share on other sites

Hi, in order to read the params passed from 2checkout in the pm2checkout_process.php file I needed to modify the

<?php 
foreach ($_GET as $key => $val)
{
print "<input type=\"hidden\" name=\"$key\" value=\"$val\">\n";
}

 

and ADD the following code referenced in this thread :

foreach ($_POST as $key => $val)
{
print "<input type=\"hidden\" name=\"$key\" value=\"$val\">\n";
}
?>

 

Is this the correct method to solve this problem? Has everyone else had to make this change to get it to work? if so it should be added to the contribution. :)

 

Also how can you test in "Demo" mode. I change the osC Admin (2Checkout payment module) section - Transaction mode to "Test" ticked. However I believe the order is being processed as per normal transaction. This leads me to ask how can you tell when making a transaction if you are in test or not by looking at the html source code?

 

 

THANKS!

Link to comment
Share on other sites

I keep getting -

 

Sorry, your order is not allowed as specified.

This sale has been rejected

 

 

 

Then, i log onto 2checkout.com and it says i have an order.

 

One Big Big question I have about this module is -

Is there anyway to get the credit card info forms to appear on my site, and have the customers enter their data there and THEN pass it over to 2checkout (with cc number of course) I have my own personal SSL certificate...

Link to comment
Share on other sites

Ok. I got it to work a few times after i turned off Direct Return (or, set it to NO)

 

I clicked on finalize order, everthing was fine except it got a message saying this data was going to be sent across a non secure connection.

 

In look and feel on the 2checkout site, i had my approved URL set to

www.neblinarecords.com/catalog/checkout_process.php

 

So i changed it to https://www.neblinarecords.com/catalog/checkout_process.php

 

and then i got

Sorry, your order failed.

 

Error: Authorization Failed

 

I went back and took off the https:// in look and feel and now it doesn't work!

Does anyone have any ideas?

Link to comment
Share on other sites

Also ----- Is there anyway to get the credit card info forms to appear on my site, and have the customers enter their data there and THEN pass it over to 2checkout (with cc number of course) I have my own personal SSL certificate...

Link to comment
Share on other sites

Ok, i just woke up this morning and now everything works! LOL i don't know about this stuff... hehe. Anyways I thought i would post up my code, i did a lot of changes, etc etc.... followed 2checkouts "must dos", etc and now it works perfect. Returns to my page, cleans out my shopping cart and everything. Well here goes, hope this helps.

 

Please note i have a personal SSL certificate and i briefly get the pm2checkout_process.php screen before it redirects to my site.

 

I will post my 2checkout look and feel settings next.

 

PS - No disrespect to anyone at all and a big thanks for developing this contrib, but the documentation leaves MUCH to be desired...

 

Catalog/pm2checkout_process.php

 

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<style type="text/css">
body {backgorund-color:#FFFFFF;}
body, td, div {font-family: verdana, arial, sans-serif; font-size:14px;}
</style>
</head>
<body onload="document.twocoprocessform.submit()">
<form name="twocoprocessform" method="POST" action="https://www.neblinarecords.com/catalog/checkout_process.php">
<table cellpadding="0" width="100%" height="100%" cellspacing="0">
<tr>
<td align="middle" style="height:100%; vertical-align:middle;">
<?php 
foreach ($_GET as $key => $val)
{
print "<input type=\"hidden\" name=\"$key\" value=\"$val\">\n";
}
?>
Thank you... redirecting to http://www.neblinrecords.com/catalog/checkout_process.php;<br><br>If<br>If the page fails to redirect click <input type="submit" value="here">
</td>
</tr>
</table>
</form>
</body>
</html>

 

catalog/includes/modules/payment/pm2checkout.php

<?php
/*
$Id: pm2checkout.php,v 1.19 2003/01/29 19:57:15 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright ? 2003 osCommerce

Released under the GNU General Public License

Updates May 13 2004 by http://www.rayservers.com

*/

class pm2checkout {
var $code, $title, $description, $enabled;

// class constructor
function pm2checkout() {
global $order;

$this->code = 'pm2checkout';
$this->title = MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE;
$this->description = MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_2CHECKOUT_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_2CHECKOUT_STATUS == 'True') ? true : false);
$this->check_hash = ((MODULE_PAYMENT_2CHECKOUT_CHECK_HASH == 'True') ? true : false);
$this->secret_word = MODULE_PAYMENT_2CHECKOUT_SECRET_WORD;
$this->login_id = MODULE_PAYMENT_2CHECKOUT_LOGIN;

if ((int)MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID;
}

if (is_object($order)) $this->update_status();

// $this->form_action_url = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c';
$this->form_action_url = 'https://www2.2checkout.com/2co/buyer/purchase';
}

// class methods
function update_status() {
global $order;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_2CHECKOUT_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_2CHECKOUT_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
}

if ($check_flag == false) {
$this->enabled = false;
}
}
}

function javascript_validation() {
return false;
}

function selection() {
global $order;

$selection = array('id' => $this->code,
'module' => $this->title
);

return $selection;
}

function pre_confirmation_check() {
return false;
}

function confirmation() {
global $HTTP_POST_VARS;
if (DEFAULT_CURRENCY <> 'USD')
$title = $this->title . MODULE_PAYMENT_2CHECKOUT_CURRENCY_CONVERSITION;
else
$title = $this->title;
$confirmation = array('title' => $title);

return $confirmation;
}

function process_button() {
global $HTTP_POST_VARS, $order, $currency, $currencies;

if (DEFAULT_CURRENCY <> 'USD')
{
$cOrderTotal = $currencies->get_value("USD") * $order->info['total'];
}
else
$cOrderTotal = $order->info['total'];


$process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) .
tep_draw_hidden_field('x_amount', number_format($cOrderTotal, 2, '.', '')) .
tep_draw_hidden_field('x_invoice_num', date('YmdHis')) .
tep_draw_hidden_field('x_test_request', ((MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test') ? 'Y' : 'N')) .
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_email_merchant', ((MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT == 'True') ? 'TRUE' : 'FALSE'));

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));
}

// check the md4 hash
if ($this->check_hash == true) {
$compare_string = $this->secret_word . $this->login_id . $HTTP_POST_VARS['x_trans_id'] . $HTTP_POST_VARS['x_amount'];
// make it md5
$compare_hash1 = md5($compare_string);
// make all upper
$compare_hash1 = strtoupper($compare_hash1);
$compare_hash2 = $HTTP_POST_VARS['x_MD5_Hash'];
if ($compare_hash1 != $compare_hash2) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_HASH_MESSAGE), 'SSL', true, false));
}
}*/
return false;

}

function after_process() {
return false;
}

function get_error() {
global $HTTP_GET_VARS;

$error = array('title' => MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR,
'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

return $error;
}

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 ('Enable 2CheckOut Module', 'MODULE_PAYMENT_2CHECKOUT_STATUS', 'True', 'Do you want to accept 2CheckOut payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login/Store Number', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', '18157', 'Login/Store Number used for the 2CheckOut service', '6', '2', 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 ('Transaction Mode', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'Test', 'Transaction mode used for the 2Checkout service', '6', '3', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', 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 ('Merchant Notifications', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'True', 'Should 2CheckOut e-mail a receipt to the store owner?', '6', '4', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '5', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_2CHECKOUT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '6', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '7', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', 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 ('Check MD5 hash', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'False', 'Should the 2CheckOut MD5 hash facilty to be checked?', '6', '8', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret Word', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD', 'tango', 'Secret word for the 2CheckOut MD5 hash facility', '6', '9', now())");
}

function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
return array('MODULE_PAYMENT_2CHECKOUT_STATUS', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'MODULE_PAYMENT_2CHECKOUT_ZONE', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD');
}
}
?>

 

catalog/includes/languages/english/modules/payment/2checkout.php

<?php
/*
 $Id: pm2checkout.php,v 1.3 2002/11/18 14:45:23 project3000 Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

 define('MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE', 'Credit Card');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION', 'Credit Card Test Info:<br><br>CC#: 4111111111111111<br>Expiry: Any');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_TYPE', 'Type:');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_OWNER', 'Credit Card Owner:');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_OWNER_FIRST_NAME', 'Credit Card Owner First Name:');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_OWNER_LAST_NAME', 'Credit Card Owner Last Name:');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_NUMBER', 'Credit Card Number:');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_EXPIRES', 'Credit Card Expiry Date:');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_CHECKNUMBER', 'Credit Card Checknumber:');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_CREDIT_CARD_CHECKNUMBER_LOCATION', '(located at the back of the credit card)');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_JS_CC_NUMBER', '* The credit card number must be at least ' . CC_NUMBER_MIN_LENGTH . ' characters.\n');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_MESSAGE', 'There has been an error processing your credit card. Please try again.');
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_HASH_MESSAGE', 'Your payment seems to come from other site then 2CheckOut . Please do not continue the checkout procedure AND contact us!');  
 define('MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR', 'Credit Card Error!');

 define('MODULE_PAYMENT_2CHECKOUT_CURRENCY_CONVERSITION', ' - Prices will be converted to US Dollars on confirmation.');
?>

Link to comment
Share on other sites

Please note I redirect to the special pm2checkout_process.php

file... also please note i have a personal SSL certificate installed on my site. And for beginners please note you MUST

 

b]2CO URL Configuration[/b]

 

Turn Redirect to NO or it will not work (i know it sounds stupid but hey)

 

Approved URL:

https://www.yoursite.com/catalog/pm2checkout_process.php

 

Pending URL:

https://www.yoursite.com/catalog/pm2checkout_process.php

 

Secret Word:

tango

 

OSC configuration:

 

Enable 2CheckOut Module

True

 

Login/Store Number

xxxxxx (not log in name, account number goes here)

 

Transaction Mode

Production

 

Merchant Notifications

True

 

Payment Zone

--none--

 

Set Order Status

default

 

Sort order of display.

0

 

Check MD5 hash

True

 

Secret Word

tango

Link to comment
Share on other sites

  • 3 weeks later...
Just received an email from 2checkout telling me they will be migrating all V1 accounts to V2 by march 31st...

 

Im eyeballin upgrading to the latest version of osC. With the idea that 2checkout is gonna upgrade everyone to V2 in the next month..

 

Who here has V2 running successfully, and what version of osC are you running?

 

Thomas

A signature is something that reflects its user. - The dictionary

 

The question is not, 'to code, or not to code'

the question is, 'if we do not code, are we really alive?'

-- anonymous

Link to comment
Share on other sites

Hi,

 

I use multiple stores currently my 2Checkout account. From the sounds of things in this thread, it looks like the new version of 2Checkout will only allow a single store per account - can anyone tell me if this is correct?

Link to comment
Share on other sites

Hi,

 

I use multiple stores currently my 2Checkout account.  From the sounds of things in this thread, it looks like the new version of 2Checkout will only allow a single store per account - can anyone tell me if this is correct?

 

From reading the 2CO site it does seem that only one site can use one account which I guess was always the rule. They seem to be only allowing passback routines to reach the domain that was registered when you opened the account. One of problems this causes is to need the extra redirect file if you have shared SSL on your site. I can see this causing all sorts of browser error massages as the user switches from secure to non-secure pages if they leave their browser with its default settings. Overall 2CO seems to be shooting themself in foot;-(

 

Danny

Link to comment
Share on other sites

I've just started with the upgrade to version 2 but I can't get too far as I get a

 

Prohibited

Order Number xxxxxxxxxx

Sorry, your order is not allowed as specified.

This sale has been rejected

 

I think our version 2 account might not be enabled yet. Anyway I think I can see the problem in the latest module, 9th. March in the contributions, regarding the Demo switching.

 

In some of the 2Checkout specs. it says:

Additional Parameters:

demo - Y to enable demo mode only, do not pass demo in at all to disable demo mode.

 

This means passing Demo=N has the same result as Demo=Y, you stay in the test mode. You don't want "Demo" in the string at all for production. I will put in my fix below but I'm sure some php coder could come up with better as I'm pretty useless.

 

Before the code, one question. Earlier in this thread I think users had seen a change in color of the 2Checkout logo depending if you were in demo or not. I'm not seeing that. I see a "you are in demo" message below the credit card details input form but my logo stays yellow. Is anyone still seeing the color change?

 

Here's my fix for the demo switch in includes/modules/payment/pm2checkout.php

 

if (MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test'){

$process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) .
tep_draw_hidden_field('x_amount', number_format($cOrderTotal, 2, '.', '')) .
tep_draw_hidden_field('x_invoice_num', date('YmdHis')) .
tep_draw_hidden_field('DEMO', 'Y') .
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('tco_currency', $currency) .
tep_draw_hidden_field('x_email_merchant', ((MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT == 'True') ? 'TRUE' : 'FALSE'));
}

else
{
$process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) .
tep_draw_hidden_field('x_amount', number_format($cOrderTotal, 2, '.', '')) .
tep_draw_hidden_field('x_invoice_num', date('YmdHis')) .
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('tco_currency', $currency) .
tep_draw_hidden_field('x_email_merchant', ((MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT == 'True') ? 'TRUE' : 'FALSE'));
}	

return $process_button_string;
}

Link to comment
Share on other sites

Well what is the latest notice about 2checkout ?

i?m sure i?m not the only one that continue with some problems with 2co and the new server.

 

all is working fine for me, i receive the sale, but the products are not recorded.

 

every sale on purchase item only send em a value like :

"Cart 20050321155427"

 

this is the most important, how i can see what products were included ?

is there a solution for this or i have to change to other card processor company?

 

the second, and if anyone have the solution are the 2 ourls that we have to configure on the 2co page:

the model is:

 

http://www.mydomain.com/checkout_process.php

 

or

 

http://www.mydomain.com/pm2checkout_process.php

 

 

 

 

Pepin

Link to comment
Share on other sites

I've just started with the upgrade to version 2 but I can't get too far as I get a

 

Prohibited

Order Number xxxxxxxxxx

Sorry, your order is not allowed as specified.

This sale has been rejected

 

Just heard from 2Checkout that you can't use 4111111111111111 as the test number. See below.

 

Another likely cause is that a banned credit card is being used for a demo

transaction. Demo transactions are still sent through parts of our fraud

system, and will therefore get caught with this error. Make sure you are not

using all 1's for the credit card number and also make sure that it does not

begin with '411'. Using sequential numbers can also cause this error to occur,

such as using 123456789. A safe one to use for testing is '597910143452349' or

any other random number that fits the above criteria while still consisting of

15 or 16 digits.

 

Danny

Link to comment
Share on other sites

In case it's of help to anyone changing over to the 2Checkout version 2 here's what we have working now.

 

If you haven't been following the thread - this is 2Checkout upgrading their software from version 1 to 2 and the Oscommerce module for 2Checkout that doesn't collect credit card information at the Oscommerce site but lets 2Checkout collect it on their pages. If you are still using version 1 of 2Checkout don't use the latest files.

 

Our starting point was the latest, 9th. March, contribution at http://www.oscommerce.com/community/contributions,904 by James Butler and following the 2Checkout instructions for the upgrade using a shopping cart with the Authorize.net parameter set.

 

In the "Look and Feel" section in your 2Checkout version 2 admin make sure that the direct return is set to "No". In both the Approved URL and Pending URL put "http://www.your-site.com/checkout_process.php". More on this last bit as it is different from the contribution. I think 2Checkout changed how they gave a return during this thread. In the beginning it sounds like they were not allowing a true return to the Oscommerce site but now with the direct return off, (that's where the customer has to click a button to finalize the order), and the authorize.net parameter set they are. This means we can return directly to the "checkout_process.php" file and we don't have to use the "pmcheckout_process.php" file in the contribution.

 

(A note to anyone selling digital goods, both a pending and an approved sale will show as good sales this way. If you need split them you will have to capture the information in the return string.)

 

Here are the other changes we made to the contribution.

 

1/ As in my earlier post the test/demo switch will not work as per the contribution. The word Demo must not be in the string at all for production.

2/ With currency conversions 2Checkout uses its own exchange rate which is about 7% worse than that your site uses if you use the automatic rate update. This could be quite upsetting to customers so it's probably best to tell them that the charge will be converted to US dollars or whatever and let their credit card company take care of the rate. To do this change the currency line in the string to USD or your fixed 2Checkout currency. (I think to change to another base currency you have to set it in the 2Checkout version 2 bank account details page which has a help file at https://www2.2checkout.com/currency_warning.html.)

3/ If you would like to pre-populate the 2Checkout string fully minus the card information there are couple of fields that might be troublesome for non-US and Canadian customers. The state field for countries other than the US and Canada should be 'Outside US and Canada' and there is minimum number of digits for telephone numbers outside of these two countries. You can get past this by building a simple switch in the string to change the state and add '011' to the telephone number.

4/ Although 2Checkout still suggests adding "tep_draw_hidden_field('x_receipt_link_url', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'))" to the string it seems to make no difference whether it's there or not. It will not override the settings in the "Look and Feel" and if you leave the "Look and Feel' return fields empty there will never be a return. I added it to the contribution but haven't bothered taking it out.

5/ 2Checkout has tightened up on allowing just one domain to use the 2Checkout account. A return will only be allowed to the domain the account was registered with. This causes a problem for those of us that use shared SSL which has another domain. As it is now if the customer is using IE with the defaults set they will get two warnings, a change from secure to non-secure and one from non-secure to secure after they click the finalize order button at 2Checkout. I will see if we can change the registered domain to the shared SSL and report back on that.

 

So summing up, we have used just two files from the contribution, the languages pm2checkout.php and the includes/modules/payment pm2checkout.php. The latter we have modified as below.

 

<?php
/*
$Id: pm2checkout.php,v 1.19 2003/01/29 19:57:15 hpdl Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright ? 2003 osCommerce

Released under the GNU General Public License

Updates May 13 2004 by http://www.rayservers.com 

*/

class pm2checkout {
var $code, $title, $description, $enabled;

// class constructor
function pm2checkout() {
global $order;

$this->code = 'pm2checkout';
$this->title = MODULE_PAYMENT_2CHECKOUT_TEXT_TITLE;
$this->description = MODULE_PAYMENT_2CHECKOUT_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_2CHECKOUT_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_2CHECKOUT_STATUS == 'True') ? true : false);
$this->check_hash = ((MODULE_PAYMENT_2CHECKOUT_CHECK_HASH == 'True') ? true : false);
$this->secret_word = MODULE_PAYMENT_2CHECKOUT_SECRET_WORD;
$this->login_id = MODULE_PAYMENT_2CHECKOUT_LOGIN;

if ((int)MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID;
}

if (is_object($order)) $this->update_status();

// don't use with ver.1 $this->form_action_url = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c';
$this->form_action_url = 'https://www2.2checkout.com/2co/buyer/purchase';
}

// class methods
function update_status() {
global $order;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_2CHECKOUT_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_2CHECKOUT_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
}

if ($check_flag == false) {
$this->enabled = false;
}
}
}

function javascript_validation() {
return false;
}

function selection() {
global $order;

$selection = array('id' => $this->code,
'module' => $this->title
);

return $selection;
}

function pre_confirmation_check() {
return false;
}

function confirmation() {
global $HTTP_POST_VARS;
//if (DEFAULT_CURRENCY <> 'CAD')
//$title = $this->title . MODULE_PAYMENT_2CHECKOUT_CURRENCY_CONVERSITION;
//else
$title = $this->title; 
$confirmation = array('title' => $title);

return $confirmation;
}

function process_button() {
global $HTTP_POST_VARS, $order, $currency, $currencies;

//if (DEFAULT_CURRENCY <> 'CAD')
//{
//$cOrderTotal = $currencies->get_value("CAD") * $order->info['total'];
//}
//else
$cOrderTotal = $order->info['total'];

// see if customer is in the US
if ($order->customer['country']['title'] != 'United States' and $order->customer['country']['title'] != 'Canada')
{
$customer_2co_state = 'Outside US and Canada';
$customer_2co_telephone = '011 ' . $order->customer['telephone'];
}
else
{	
$customer_2co_state = $order->customer['state'];
$customer_2co_telephone = $order->customer['telephone'];
}

if (MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test'){

$process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) .
tep_draw_hidden_field('x_amount', number_format($cOrderTotal, 2, '.', '')) .
tep_draw_hidden_field('x_invoice_num', date('YmdHis')) .
tep_draw_hidden_field('DEMO', 'Y') .
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', $customer_2co_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', $customer_2co_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', MODULE_PAYMENT_2CHECKOUT_LINK_URL) . 
tep_draw_hidden_field('tco_currency', 'USD') .
tep_draw_hidden_field('x_email_merchant', ((MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT == 'True') ? 'TRUE' : 'FALSE'));
}

else
{
$process_button_string = tep_draw_hidden_field('x_login', MODULE_PAYMENT_2CHECKOUT_LOGIN) .
tep_draw_hidden_field('x_amount', number_format($cOrderTotal, 2, '.', '')) .
tep_draw_hidden_field('x_invoice_num', date('YmdHis')) .
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', $customer_2co_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', $customer_2co_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', MODULE_PAYMENT_2CHECKOUT_LINK_URL) . 
tep_draw_hidden_field('tco_currency', 'USD') .
tep_draw_hidden_field('x_email_merchant', ((MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT == 'True') ? 'TRUE' : 'FALSE'));
}	

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));
}

// check the md4 hash
if ($this->check_hash == true) {
$compare_string = $this->secret_word . $this->login_id . $HTTP_POST_VARS['x_trans_id'] . $HTTP_POST_VARS['x_amount'];
// make it md5
$compare_hash1 = md5($compare_string);
// make all upper
$compare_hash1 = strtoupper($compare_hash1);
$compare_hash2 = $HTTP_POST_VARS['x_MD5_Hash'];
if ($compare_hash1 != $compare_hash2) {
tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR_HASH_MESSAGE), 'SSL', true, false));
}
}*/
return false;

}

function after_process() {
return false;
}

function get_error() {
global $HTTP_GET_VARS;

$error = array('title' => MODULE_PAYMENT_2CHECKOUT_TEXT_ERROR,
'error' => stripslashes(urldecode($HTTP_GET_VARS['error'])));

return $error;
}

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 ('Enable 2CheckOut Module', 'MODULE_PAYMENT_2CHECKOUT_STATUS', 'True', 'Do you want to accept 2CheckOut payments?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Login/Store Number', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', 'nnnnn', 'Login/Store Number used for the 2CheckOut service', '6', '2', 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 ('Transaction Mode', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'Production', 'Transaction mode used for the 2Checkout service', '6', '3', 'tep_cfg_select_option(array(\'Test\', \'Production\'), ', 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 ('Merchant Notifications', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'True', 'Should 2CheckOut e-mail a receipt to the store owner?', '6', '4', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', '500', 'Sort order of display. Lowest is displayed first.', '6', '5', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_2CHECKOUT_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '6', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '7', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', 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 ('Check MD5 hash', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'False', 'Should the 2CheckOut MD5 hash facilty to be checked?', '6', '8', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret Word', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD', 'tango', 'Secret word for the 2CheckOut MD5 hash facility', '6', '9', now())"); 
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Return Link', 'MODULE_PAYMENT_2CHECKOUT_LINK_URL', 'http://www.your-site.com/checkout_process.php', 'The return url for 2CO', '6', '10', now())");
}

function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
return array('MODULE_PAYMENT_2CHECKOUT_STATUS', 'MODULE_PAYMENT_2CHECKOUT_LOGIN', 'MODULE_PAYMENT_2CHECKOUT_TESTMODE', 'MODULE_PAYMENT_2CHECKOUT_EMAIL_MERCHANT', 'MODULE_PAYMENT_2CHECKOUT_ZONE', 'MODULE_PAYMENT_2CHECKOUT_ORDER_STATUS_ID', 'MODULE_PAYMENT_2CHECKOUT_SORT_ORDER', 'MODULE_PAYMENT_2CHECKOUT_CHECK_HASH', 'MODULE_PAYMENT_2CHECKOUT_SECRET_WORD', 'MODULE_PAYMENT_2CHECKOUT_LINK_URL');
}
}
?>

 

A couple of quick notes. We changed the module to default to production not test and we don't use the Hash so I don't know how well that works.

 

A quick question. Does anyone no what the ['title'] in $order->customer['country']['title'] refers to?

 

Danny

Link to comment
Share on other sites

After i tried paid for my item

2checkout send me this email.....

<_<

 

We attempted to create the following product but couldn't find all the

required paramters.

 

The following paramters are required for product creation:

c_prod

c_name

c_price

c_description

 

For this product: c_prod_0 = MSIMEXP

We received the name properly : c_name_0 = Microsoft IntelliMouse Explorer

We did NOT receive a description, it should have been sent as c_description_0

We did NOT receive a price, it should have been sent as c_price_0

Link to comment
Share on other sites

  • 11 months later...

phew... I finially got my 2checkout mod working to some degree....

 

I also noticed many of you were talking about how the script always defaults to the US currency so I added a code to the modso that the user is directed to the currency of there choice when going to 2checkout.

 

The only problem with this is 2checkout always checks for the US value and adjust the price to there conversion ratio so the price might be slightly off from your site and 2checkout. I emailed them regardign this and here is what they said

 

 

Thank you for contacting 2Checkout.com. I am sorry for any inconvenience.

Your account is set to display in US dollars. The value you send into the system will be considered a USD amount and then converted to the local currency of the buyer. We do not have a documented feature that will allow you to pass in a specific currency, you can only set your currency from within your account. The conversion rate that you are using for your conversions is different from the conversion rate that we are using. This rate changes everyday. If you are attempting to work in multiple currencies you may find some issues when passing them to our system because we can only accept one currency. The customer can change the currency on our site by clicking on the small flags located at the top of our payment pages.

 

There is an update at the contrib area or you can click the contrib in my sig.

Sincerely

Mike

Link to comment
Share on other sites

  • 5 months later...
Full Shopping Car Routine Specs As Provided by OsCommerce.

I'm posting this in hopes a kind sole will see our plight and help us create an updated 2checkout module:

 

 

Is 2ChkOut returns a boolean value or some thing to show the status of the payment process as a part of the response.

like (Processed: returns Y if processed, N otherwise)

Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...

check to be sure you entered the right customer id number when you installed 2checkout. check the secret word you enter. and otherwise I had to install the newest 2checkout contrib from harold. you can find it in contribs.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...