vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   2checkout.com (version 2) Subscription Option (https://vborg.vbsupport.ru/showthread.php?t=68170)

fastforward 08-14-2004 03:27 AM

kall,

Can you share the version for 2checkout 1 users please?

Many thanks

kall 08-14-2004 05:09 AM

Quote:

Originally Posted by fastforward
kall,

Can you share the version for 2checkout 1 users please?

Many thanks

I'm sorry...I don't know what that would be.

Somebody sent me a list of variables that it asks for, but these are the same variables I used to create this hack for version 2.

As I can't actually get access to version 1 (as they aren't giving it to new users), I can't test it I'm afraid.

nick_1 08-14-2004 06:31 PM

I'll see about getting my version written up for 2checkout 1. I've had it running ages but haven't had time to sort it out.

The basis of the hack was simply to replace the authorise.net payment code a modification which points at 2co's payment gateway. They are quite similar but not a perfect replacement so i duplicated much of the code.

As far as i remember the main changes were in includes/functions_subscriptions.php This is what i did...

find:
PHP Code:

 // ######################## Define payment bits ###################
$_SUBSCRIPTIONS['methods'] = array(
    
'paypal'    =>    1,
    
'nochex'    =>    2,
    
'worldpay'    =>    4,
    
'authorize'    =>    8,
); 

Replace with:
PHP Code:

 // ######################## Define payment bits ###################
$_SUBSCRIPTIONS['methods'] = array(
    
'paypal'    =>    1,
    
'nochex'    =>    2,
    
'worldpay'    =>    4,
    
'authorize'    =>    8,
    
'2checkout'    =>    16
); 

Find:
PHP Code:

// ######################## Define supported curencies ###################
$_SUBSCRIPTIONS['curencies'] = array(
    
'paypal'    =>    array('usd' => true'gbp' => true'eur' => true),
    
'nochex'    =>    array('gbp' => true),
    
'worldpay'    =>    array('usd' => true'gbp' => true'eur' => true),
    
'authorize'    =>    array('usd' => true'gbp' => true'eur' => true)
); 

Replace with:
PHP Code:

// ######################## Define supported curencies ###################
$_SUBSCRIPTIONS['curencies'] = array(
    
'paypal'    =>    array('usd' => true'gbp' => true'eur' => true),
    
'nochex'    =>    array('gbp' => true),
    
'worldpay'    =>    array('usd' => true'gbp' => true'eur' => true),
    
'authorize'    =>    array('usd' => true'gbp' => true'eur' => true),
    
'2checkout'    =>    array('usd' => true)
); 

Find:
PHP Code:

        case 'authorize':
            
$form construct_authorize_form($cost$item$currency);
            break; 

Add below:
PHP Code:

        case '2checkout':
            
$form construct_2checkout_form($cost$item$currency);
            break; 

This is my replacement of construct_authorize_form() add to the bottom of the file.
PHP Code:

function construct_2checkout_form($amount$id$currency 'USD')
{
    global 
$vboptions$authorize_txnkey;

    
$sequence vbrand(11000);
    
$fingerprint hmac($authorize_txnkey$vboptions['authorize_loginid'] . '^' $sequence '^' TIMENOW '^' $amount '^' $currency);
    
$timenow TIMENOW;

    
$id .= "_$currency";

    
//$form['action'] = 'https://secure.authorize.net/gateway/transact.dll';
    
$form['action'] = 'https://www.2checkout.com/cgi-bin/Abuyers/purchase.2c';
    
$form['method'] = 'post';
    
$form['hiddenfields'] = <<< HTML
    <input type="hidden" name="x_fp_hash" value="$fingerprint" />
    <input type="hidden" name="x_login" value="
$vboptions[authorize_loginid]" />

    <input type="hidden" name="x_amount" value="
$amount" />
    <input type="hidden" name="x_currency_code" value="
$currency" />
    <input type="hidden" name="x_invoice_num" value="
$id" />
HTML;
    return 
$form;


I'm sure 2co should accept more variables than that but thats all it seems to accept for me. Also, 2co ignores your currency code so don't change the code to allow other types of currency. I have actually used the same authorize_txnkey for both 2co and authorize.net payments but you might wish to change this to improve security.

Once thats all done set the shopping cart preferences in your 2co admin panel to point back at the authorize.net payment page which will accept the payment correctly (/subscriptions/authorize.php). Try it out in test mode with garbage card numbers to check it all works and you should find its working nicely.

I hope this helps, it was rather important to my site as we were trying to improve our payment system after using a poorly intergrated one.

Nick

fastforward 08-15-2004 12:03 AM

Hello nick,

I've got 2checkout accepting payments using your code. Many thanks.

One question. If your 2checkout account is in test mode, should it return valid codes and should the vb account be upgraded? My authorize.php is simply displaying a white page when it returns. There are no parse errors, so I'm guessing it's hitting one of the exit; statements.

Thanks again for your help.

zajako 08-15-2004 01:34 AM

i have a problem with this,

what do i do for the settings for the button to appear, basicaly what im asking is how to set it up to actualy work, you provided the edits for the functions_subscriptions page but i cant get the propper button to display.

can you edit kall's txt file to make it be specific for the other edits needed to work?

kall 08-15-2004 04:22 AM

Quote:

Originally Posted by zajako
can you edit kall's txt file to make it be specific for the other edits needed to work?

If my permission is needed, you have it in full.

:)

nick_1 08-15-2004 08:40 AM

It seems i made changes to subscriptions/authorize.php after all. This is my replacement one:

Find:
PHP Code:

$check_hash strtoupper(md5($vboptions['authorize_loginid'] . $_POST['x_trans_id'] . $_POST['x_amount']));

if (
$check_hash == $_POST['x_MD5_Hash'] AND $_POST['x_response_code'] == 1

Replace with:
PHP Code:

$check_hash strtoupper(md5($authorize_txnkey $vboptions['authorize_loginid'] . $_POST['x_trans_id'] . $_POST['x_amount']));

if (
$check_hash == $_POST['x_MD5_Hash'] AND $_POST['x_response_code'] == 1

Also to get text on the button you need to add a phrase, I believe adding a global phrase named 2checkout containing the word 2checkout will do the job.

I hope thats it.

Nick

zajako 08-15-2004 12:02 PM

umm my authorize.php doesnt have those lines.... it has this instead...

PHP Code:

$check_hash md5($authorize_secret_key $_POST['x_trans_id'] . $_POST['x_amount']);

if (
$check_hash == $_POST['x_MD5_Hash']) 


arfan 08-29-2004 09:30 PM

Hey lol sorry im newbie does this work with VB 3.03?

arfan 08-29-2004 09:31 PM

MY bad lol im soo stupid didnt read top, got confused with version 2 thing sorry my bad!


All times are GMT. The time now is 07:57 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01227 seconds
  • Memory Usage 1,782KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete