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)

kall 08-09-2004 10:00 PM

2checkout.com (version 2) Subscription Option
 
Need to give your members the option of paying through 2checkout.com?

This is the modification for you.


It works just like the currently offered payment gateways...you choose 2checkout as an option in the Paid Subscriptions section of your Admin CP, enter your 2checkout id number, and you are good to go.

Members will be diverted to the 2checkout secure payment page, once the transaction is confirmed, 2checkout tells your vb (through a new php file in /subscriptions), and the automatic subscription process goes ahead.

Addendum: This works for Version 2 of 2checkout.com.

This was originally going to be 'sold' to people who wanted it, but I'll just post it here and if anyone feels like rewarding me, there's a paypal addy at the end of the .txt :)

Update: 12/11/2004: Changed the variable from 2co to checkout. Not really a big change.

Natch 08-09-2004 11:16 PM

Great idea - I know at least one guy who will use this :D

templates911 08-10-2004 02:35 AM

Thanks, ive been looking for something like this.

zajako 08-10-2004 02:49 AM

oh hell yeah !!!!!

*<3's kal in a strickly heterosexual way*!!

now i dont gotta get ripped off by paypal >.<

templates911 08-10-2004 03:23 AM

im getting an 404 not found error saying the payment url doesnt exist when I try to purchase a subscription.

templates911 08-10-2004 04:08 AM

It seems that your using the Version 2 of 2checkout.com. I have a version 1 and it required different things. Do you think you could take a look at it if I PM you?

kall 08-10-2004 09:13 AM

Quote:

Originally Posted by templates911
It seems that your using the Version 2 of 2checkout.com. I have a version 1 and it required different things. Do you think you could take a look at it if I PM you?

Umm...

I could have a go...

:)

rookie7 08-10-2004 10:50 PM

Thanks for sharing.

por4x4 08-11-2004 12:20 AM

Quote:

Originally Posted by zajako
now i dont gotta get ripped off by paypal >.<

They charge more than Paypal does.

Princeton 08-12-2004 06:47 PM

great addition:up: thank you

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!

mixylplik3 09-02-2004 05:19 PM

Edit. I stupidly realized I'm not using v2. How irritating.

vprp 10-28-2004 05:59 AM

Does this use recurring billing?

vprp 10-28-2004 07:56 AM

I installed this and it looks like it doesn't do recurring billing. Is there any way to modify this hack like the PayPal recurring billing hack?

https://vborg.vbsupport.ru/showthread.php?t=64834

Thanks.

MarkG 12-07-2004 01:57 PM

will be trying it out next week. thank you!

dr-jamal 12-10-2004 09:39 AM

well .. thanks for the hack ..

I followed all the instructions .. but it didn't work fully ..

see the pic I attached ..

I made a new Subscription ..
when I try to subscripe by pressing "order by 2checkout" .. it takes me to 2checkout.com ordering page but it doesn't show the amount of money .. :disappointed: .. what's wrong?

webrats 04-29-2005 02:08 PM

recurring PLEASE!@

Crazy Serb 10-02-2005 12:11 AM

is there a new version of this for vbulletin 3.5?!! pleassseeee!

indie 01-07-2006 04:48 AM

Can this be made for 3.5? There is a 2checkout script in vB, but it does not automatically upgrade, you have to do it manually. Unless there is some way of just getting the current vB script to work automatically? I have 2checkout version 2. Thanks!


All times are GMT. The time now is 04:47 PM.

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.02421 seconds
  • Memory Usage 1,837KB
  • 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
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (28)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete