Jump to content

Archived

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

Priest

Screwed by 2CheckOut!

Recommended Posts

Many Thanks Fabien!

This first that fully began to work.

Did you really get this to work for you? I gave it a try and still NO LUCK! Starting to get frustrating! I feel like I have checked everything at least 8 times and still can't figure out what is wrong with it!


DJ

 

"I wake in a cold sweat every night with visions of code in my head" AHHHHHHH!

Share this post


Link to post
Share on other sites

I recently setup my 2checkout account. And am using the 2checkout module as is and it seems to be working fine?? What exactly is the issue??

 

Also I notice that credit cards are only billed in US Dollars. How do I setit up to bill in the selected currency??

 

Thanks,

 

Saleem

Share this post


Link to post
Share on other sites
I recently setup my 2checkout account. And am using the 2checkout module as is and it seems to be working fine?? What exactly is the issue??

 

Also I notice that credit cards are only billed in US Dollars. How do I setit up to bill in the selected currency??

 

Thanks,

 

Saleem

Not to long ago 2CO changed their programming and it has not worked with OScommerce since. Basically, after the credit card information has beed collected and the credit card has been approved, none of the informaion about the sale is being sent back to the web site so that OSC can list it in the sales section of the web site. In other words, sales are not being counted as sales.

 

Everything worked fine before they made the changes to their system and they have not been very cooperative as far as trying to fix the problems we are having...

 

I think thats about it? :)

 

If yours is working, I would really like to know how you have things set up and what module you are using.

 

Thanks


DJ

 

"I wake in a cold sweat every night with visions of code in my head" AHHHHHHH!

Share this post


Link to post
Share on other sites

I'm not sure whats going on but I think they have it fixed... I just did a test and everything went VERY GOOD!

 

not going to hold my breath though!


DJ

 

"I wake in a cold sweat every night with visions of code in my head" AHHHHHHH!

Share this post


Link to post
Share on other sites

It still seems to work for me. I have made no changes whatsoever to the 2checkout module. It is calling their old routine. And it works. I just want to make sure I can at least replicate the issue.

 

Saleem

Share this post


Link to post
Share on other sites

How do I tell?? I thought everyone was being moved over to the new system?? I just signed up 1-2 months ago.

 

Saleem

Share this post


Link to post
Share on other sites

I just signed up a couple of weeks ago and I got it working... It took a little while and a lot of tinkering but it works now.

 

If anyone would like to see my entire configuration (from files to 2CO setup) so you can compare, just ask!


DJ

 

"I wake in a cold sweat every night with visions of code in my head" AHHHHHHH!

Share this post


Link to post
Share on other sites

They've added a new "finalize order" button to the payment recieved page - on my account at least. This initiates the passback, and seems to work. Obviously, it's not ideal, and seemingly would point to an error at their end. Even using the demo link supplied in the help section our account refused to redirect on payment completion.

Share this post


Link to post
Share on other sites

Here is all the info for the 2CO contribution that I have working on my site. I use ipowerweb for my hosting so keep in mind that I'm sharing a SSL. I'm not sure why this works all I know is that it does. I know one of the problems I was having is I had 2CO set up with the wrong URLS. I hope this helps someone!

 

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.mysite.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 https://www.mysite.com/catalog/checkout_pro...gt;<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');

}

}

?>

 

2CO URL Configuration

 

Approved URL:

https://host141.ipowerweb.com/~myusername/c...out_process.php

 

Pending URL:

https://host141.ipowerweb.com/~myusername/c...out_process.php

 

Secret Word:

tango

 

OSC configuration:

 

Enable 2CheckOut Module

True

 

Login/Store Number

xxxxxx

 

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


DJ

 

"I wake in a cold sweat every night with visions of code in my head" AHHHHHHH!

Share this post


Link to post
Share on other sites

Please forgive me, but I've been studying over the posts about the new 2CO and the double CC info as well as the return params here in this thread and I'm still confused as to which code works and which files need to be edited. If someone could guide me a little more I'd be so grateful.

 

You guys/gals have obviously been relentless in testing and re-testing and editing to fix these probs and I really want to thank you all so much. I'm sure glad you all are here.

 

Again thanks loads.

 

cat

Share this post


Link to post
Share on other sites

Mine doesn't ask for a secret work in osC. Am I using an old 2co module? I'm using the one that came with osc..

 

Thanks,

Justin

Share this post


Link to post
Share on other sites

Yeah babee! I used DJ's (Netabove) code and it works. By passes the CC info on OS commerce.

 

I also figured out how to test in demo mode:

 

from 2CO admin paste the demo string into your browsers url box:

 

https://

www2.2checkout.com/2co/buyer/purchase?sid=221594&product_id=1&quantity=1&demo=Y

 

then return to your cart

 

To take it out of demo mode use the live string in the same way:

 

https://www2.2checkout.com/2co/buyer/purcha...id=1&quantity=1

 

cheers.

 

cat

Share this post


Link to post
Share on other sites

WOO WHO!

 

Glad it works Cat! but I cant take the credit... I just played around with it until it worked...

 

I could not even tell you what I did now to get it running... I guess thats why my partner yells at me for not making 'code notes'! :D


DJ

 

"I wake in a cold sweat every night with visions of code in my head" AHHHHHHH!

Share this post


Link to post
Share on other sites
Mine doesn't ask for a secret work in osC. Am I using an old 2co module? I'm using the one that came with osc..

 

Thanks,

Justin

Justin, I think you are using the old 2CO code...

 

Try the code I left on page 9 of this thread and you should be ok... It works for me and Cat at least...


DJ

 

"I wake in a cold sweat every night with visions of code in my head" AHHHHHHH!

Share this post


Link to post
Share on other sites

Well your tinkering is A OK by me ;)

 

I just came across a very different problem though. I got an order and it went through fine, BUT OS Commerce did NOT record the sale (did record the customer sign up however) and 2CO is not giving me a detailed report of the sale :/ SO I have no idea what my customer ordered! :o

 

Any ideas on this?

 

I can tell you that quantity says 1 and there is no product number which I did set up, and I have no one product that costs the amount that was charged :o

 

Needless to say, I'm in big trouble here and need some serious help.

 

TIA

 

cat

Share this post


Link to post
Share on other sites

I have version 2.2MS2... Can i Use 2checkout to receive credit card in my site?

I have add the 2checkout module but it request the credit card number in the oscommerce cart.. What have i to do ??

Thanks.

Share this post


Link to post
Share on other sites

OK. I'm a weenie. Duh, yeah this is exactly what you all have been talking about throughout this thread I just didn't realize what was being said til I tried all the workarounds and started getting the same results.

 

So here's where I stand:

 

I disabled the automatic redirect param so that it would give me the "finalize order" link on the 2CO order page .../buyer/purchase, blah blah and when the button is clicked to go back to .../checkout_process I get this error:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/fatmatt/public_html/shopcart/includes/modules/payment/pm2checkout.php:194) in /home/fatmatt/public_html/shopcart/includes/functions/general.php on line 29

 

Is there something else I need to change in the code? Something I need to comment out?

 

I'm so confused :blink:

Share this post


Link to post
Share on other sites

Catarina,

 

Sounds like there is an error in your pm2checkout.php... tough to say what without seeing the code. However, seeing as your using the finalize order button, you should be able to use the recently upgraded pm2checkout (may 16th) in the contributions area... without needing (m)any modifications.

 

http://www.oscommerce.com/community/contributions,904

 

I'd suggest: uninstall you current version, backup then remove your current pm2checkout.php from /includes/modules/payment/ and upload the new version above... reinstall, fill out your admin details.

 

In 2co admin, Set both return URL's in your 'look and feel' too: www.yoursite.com/catalog/checkout_process.php ... Set direct return off.

 

The instructions say to use pm2checkout_process.php but I didn't need this... the values we passed back happily to checkout_process.php... your mileage may vary.

 

Ignore the header stuff in the install instructions (unless you wanna go down that road... you'll need SSL)

 

Lastly... I commented out the

tep_draw_hidden_field('x_test_request', ((MODULE_PAYMENT_2CHECKOUT_TESTMODE == 'Test') ...

line because I seemed to be getting stuck in test mode... again, YMMV

 

Good luck :)

Share this post


Link to post
Share on other sites

I have set up osC for my stores and quite a few for customers.

 

Some of my customers and I have older 2co accounts and our original 2.2MS2 stores work fine.

 

I just got off the phone with 2co after reading this entire thread:

Still no set date on moving old customers to the new system.

 

One question they could not answer (and forgive me if I missed the answer here) was:

 

What if I upgrade my sites now with the new module posted here (thanks) ... will I be connected to the new 2co module and will it work? - or do I have to wait until 2co changes my account (and forgets to notify me :o ) then upgrade my sites?

 

Any thoughts?


Ack Ack!

Share this post


Link to post
Share on other sites

Hey RicherD. Thanks for your response. Quick question/s:

 

Are you saying that I can't use my own headers if I don't have SSL? That I have to use 2co's default?

 

You wanna' hear something weird? I can get the order to re-direct to .../process_checkout and .../pm2checkout_process after getting that header error msg by refreshing the page several times and then it records the sale through osc . Of course it always tells me it's an insecure page. You think this might be why it won't just go the first time? You think it's because I'm trying to use my own headers?

 

I don't know jack about php except to follow instructions, so...

 

also when you refer to the secret word also being set as the same as in the control panel, do you mean the password on my 2co account? I'm not clear on what "control panel" means.

 

My store is down a week and counting now :(

 

You guys/gals are awesome and I appreciate all your help and input.

 

cat

Share this post


Link to post
Share on other sites

×