vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Major Additions - Add Google Checkout to Paid Subscriptions (https://vborg.vbsupport.ru/showthread.php?t=249656)

CaseLogic 08-30-2010 10:00 PM

Add Google Checkout to Paid Subscriptions
 
1 Attachment(s)
This is my first released mod, so please rate!

This modification will allow you to use Google Checkout as a payment processor for paid subscriptions.

Google Checkout Steps
-Under Settings->Preferences, select the option to automatically authorize and charge
-Under Settings->Integration, uncheck the digitally signed cart box
-For the API Callback URL, enter in the following:
http://path to your forum/payment_gateway.php?method=gcheckout
-Select the Notification Serial # method
-Select API version 2.5 (do NOT check the notification filtering checkbox!)
-Note your Merchant ID and Merchant Key on the right-hand side (will need for below)

vBulletin Steps
-Upload class_gcheckout.php to <forum base>/includes/paymentapi
-Install product
-Under Paid Subscriptions->Payment API Manager->Google Checkout, enter in the merchant ID and key found under your Settings.
-Activate Google Checkout payment API
-Optionally run "Test Communication" under Paid Subscriptions to ensure successful setup and integration

Known Issues
-Incorrect operation on 32bit systems! (found 12/14/2010)
-Only works with curl installed
-Chargeback handling not implemented yet

Release notes
1.01
-Replaced mysql_ function in install code with vB SQL wrapper
1.0
- Original version

CaseLogic 08-31-2010 03:09 AM

I'm willing to bet this will work in vb4 with little to no modifications, but I can't say for sure! Let me know if anyone tries...

edit: I forgot templates are different, so see this post

Stifler 08-31-2010 05:02 AM

Quite awesome mate. Very useful feature (should've been built in).. Gonna test this out on vb4.. crossing my fingers.

Xtrigit 08-31-2010 05:51 AM

Thanks!

BirdOPrey5 08-31-2010 01:21 PM

How could 3 people have installed this with only 1 download so far?

Quote:

vB Version: 3.8.x Rating: (2 votes - 5.00 average) Installs: 3
Released: Today Last Update: Never Downloads: 1

CaseLogic 09-02-2010 12:17 PM

Quote:

Originally Posted by Stifler (Post 2091893)
Quite awesome mate. Very useful feature (should've been built in).. Gonna test this out on vb4.. crossing my fingers.

Any luck with vB4? Please let me know!

schlottkej 09-03-2010 07:34 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2092001)
How could 3 people have installed this with only 1 download so far?

People clicking install to keep track of the progress of the addon.

MichaelDance 09-04-2010 10:54 AM

i followed everything but all i get is;
Oops!
We were unable to process your request.

Time when the error happened: 2010-09-04T11:53:58 (UTC) (48f6db3d54788)

CaseLogic 09-05-2010 01:27 PM

is that when you are going to the google checkout cart? at what stage in the process is it giving you this error?

whitey06 09-05-2010 05:27 PM

1 Attachment(s)
Nice mod, have been looking for this but when installing it in VB4 get these msgs in the attached screenshot. Then when the page has reloaded, after going into the google checkout options, it doesnt give me the option to input the merchant ID or merchant key

CaseLogic 09-05-2010 05:36 PM

yeah the code that it is trying to execute is inserting google checkout into the vB API. The error is coming from mysql_real_escape_strings, which is throwing an access denied error (commonly because there isn't a valid mysql connection).

First thing I would is uninstall (assuming it installed the product despite the error), then reinstall. It's possible it was a fluke with mysql, although not really likely.

I will look into replacing that function with the appropriate vB wrapper

CaseLogic 09-05-2010 05:53 PM

Quote:

Originally Posted by whitey06 (Post 2094214)
Nice mod, have been looking for this but when installing it in VB4 get these msgs in the attached screenshot. Then when the page has reloaded, after going into the google checkout options, it doesnt give me the option to input the merchant ID or merchant key

I just updated to version 1.01 which replaced that mysql call with vB's version. See how that works for you and then get back to me

whitey06 09-06-2010 05:39 PM

Ok installed and all working now, that did the trick, dont see any issues, did communication test and all was good :)

Forgot to mention in my last post that for VB4, the template fetch command in the php file needs changing to the correct format or an error message comes up on the subscriptions page, I replaced it with the following:
PHP Code:

$templater vB_Template::create('subscription_payment_gcheckout');
            
$templater->register('cost'$cost);
            
$templater->register('currency'$currency);
            
$templater->register('item'$item);
            
$templater->register('no_shipping'$no_shipping);
            
$templater->register('settings'$settings);
            
$templater->register('subinfo'$subinfo);
            
$templater->register('timeinfo'$timeinfo);
            
$templater->register('userinfo'$userinfo);
        
$form['hiddenfields'] .= $templater->render(); 

Also for anyone that uses it, only use it for the currency that your checkout account allows, i.e. USD for US & GBP for UK.

But all in all, great mod and much needed in VB :D

CaseLogic 09-06-2010 07:42 PM

Quote:

Originally Posted by whitey06 (Post 2094676)
Ok installed and all working now, that did the trick, dont see any issues, did communication test and all was good :)

Forgot to mention in my last post that for VB4, the template fetch command in the php file needs changing to the correct format or an error message comes up on the subscriptions page, I replaced it with the following:
PHP Code:

$templater vB_Template::create('subscription_payment_gcheckout');
            
$templater->register('cost'$cost);
            
$templater->register('currency'$currency);
            
$templater->register('item'$item);
            
$templater->register('no_shipping'$no_shipping);
            
$templater->register('settings'$settings);
            
$templater->register('subinfo'$subinfo);
            
$templater->register('timeinfo'$timeinfo);
            
$templater->register('userinfo'$userinfo);
        
$form['hiddenfields'] .= $templater->render(); 

Also for anyone that uses it, only use it for the currency that your checkout account allows, i.e. USD for US & GBP for UK.

But all in all, great mod and much needed in VB :D

good call, I forgot that vB4 changed their template formats :)

thanks for the code, I'll have to add it into a vb4 version for the future (I don't have a vb4 forum to test it on right now unfortunately)

whitey06 09-07-2010 02:24 PM

Ive actually now encountered a problem. I was originally using the Buy Now Buttons and had the product as a digital product and was adding my users manually to the paid subscriptions but now when they are purchasing, its completing the order but then telling me I have to ship the order when the order is Digital so no shipping is required, also it is not changing the usergroup of the customer upon completion of the order.
Its showing up in the transaction stats but not for an individual subscription.

Hope that makes sense and you can help me out with this.

CaseLogic 09-07-2010 02:33 PM

Quote:

Originally Posted by whitey06 (Post 2095033)
Ive actually now encountered a problem. I was originally using the Buy Now Buttons and had the product as a digital product and was adding my users manually to the paid subscriptions but now when they are purchasing, its completing the order but then telling me I have to ship the order when the order is Digital so no shipping is required, also it is not changing the usergroup of the customer upon completion of the order.
Its showing up in the transaction stats but not for an individual subscription.

Hope that makes sense and you can help me out with this.

Unfortunately I couldn't immediately figure out the shipping thing. Even when marked as digital, it still tries to go through the shipping process and I'm not familiar enough with GC to get around that.

However, the vB Payment API reacts to the 'charge' process, and should be adding the paid subscription successfully once it's charged. The ship state has no impact to the paid subscription.

So if you go into transaction log, are you seeing the date, the correct user, and a successful charge? Or is it showing Failure?

If it is showing that it Charged, that means everything went through successfully and beyond that, VB Core API is taking over (so my code doesn't impact that). I would make sure your paid subscription is setup correctly to move them to the right usergroup.

whitey06 09-07-2010 03:51 PM

Ok ive now just checked and the log is now showing as failure for the subscriptions that have been purchased.

When clicked on failure its giving me the transaction details with 3 different sub categories:

API:

VB error code - Invalid subscription ID

Get:

Method - Google Checkout

Post:

Shows all details of the transaction

My paid subscription is set up correctly as I use another method on them aswell which works 100% fine and have used many others.

CaseLogic 09-08-2010 11:35 PM

Quote:

Originally Posted by whitey06 (Post 2095081)
Ok ive now just checked and the log is now showing as failure for the subscriptions that have been purchased.

When clicked on failure its giving me the transaction details with 3 different sub categories:

API:

VB error code - Invalid subscription ID


Get:

Method - Google Checkout


Post:

Shows all details of the transaction


My paid subscription is set up correctly as I use another method on them aswell which works 100% fine and have used many others.

I'm currently out of town on business travel, so my response time will be a noticeably slower the next few days.

The first thing I would check is to verify that your template is properly using all the variables, notably the $hash (which it is using to tie the checkout transaction to a user). My guess is that the variable is not properly registering in the template object, or there is a typo in the modified template (because I'm assuming you edited the code and template to support vb4).

When you are on the page that says "Order now using Google Checkout", go look at the source and verify that the form input item "item_merchant_id_1" (or something similar, this is off memory) is being set properly. It should look like some random numbers and letters with some dashes in there. If it is blank or something obviously incorrect, I would say that is your issue.

whitey06 09-09-2010 08:01 AM

Quote:

Originally Posted by CaseLogic (Post 2095627)
I'm currently out of town on business travel, so my response time will be a noticeably slower the next few days.

The first thing I would check is to verify that your template is properly using all the variables, notably the $hash (which it is using to tie the checkout transaction to a user). My guess is that the variable is not properly registering in the template object, or there is a typo in the modified template (because I'm assuming you edited the code and template to support vb4).

When you are on the page that says "Order now using Google Checkout", go look at the source and verify that the form input item "item_merchant_id_1" (or something similar, this is off memory) is being set properly. It should look like some random numbers and letters with some dashes in there. If it is blank or something obviously incorrect, I would say that is your issue.

Ive checked the page source and it is as u say "item_merchant_id_1", the only thing that ive edited is the code in the class php file. I re-uploaded your file without the modifications and apart from the template error code:
PHP Code:

Warningfetch_template() calls should be replaced by the vB_Template class. Template namesubscription_payment_gcheckout in [path]/includes/functions.php on line 3893 

It all works the same way and goes straight through the process but just doesnt change the usergroup at the end of it.

Thanks for the replies.

CaseLogic 09-09-2010 10:12 PM

Quote:

Originally Posted by whitey06 (Post 2095743)
Ive checked the page source and it is as u say "item_merchant_id_1", the only thing that ive edited is the code in the class php file. I re-uploaded your file without the modifications and apart from the template error code:
PHP Code:

Warningfetch_template() calls should be replaced by the vB_Template class. Template namesubscription_payment_gcheckout in [path]/includes/functions.php on line 3893 

It all works the same way and goes straight through the process but just doesnt change the usergroup at the end of it.

Thanks for the replies.

under the failure log where you see the error code, look for that same key (item_merchant_id_1) and see if it has anything that makes sense (random numbers, letters, and dashes that is like 20-30 characters long)

invalid subscription ID means that google checkout and my API are not correctly exchanging that hash back and forth that identifies the exact transaction

whitey06 09-10-2010 07:43 AM

Hi,

In the log in the admincp, there is the following:

"order-summary_shopping-cart_items_item-1_merchant-item-id"

And then its blank next to it.

I think I have found the issue, when I use your php file from this thread, when looking at the page source on the "order using google checkout page", the "item_merchant_id_1" has a value of letters and numbers as you said, as soon as I edit the template part in the php file to enable it to function properly in VB4, the "item_merchant_id_1" value is then blank in the page source so I think it just needs the correct template class for VB4, the code that I am using mustn't be far away from it, just not quite right.

EDIT: Ok ive now edited the template code so that the page source shows a value for "item_merchant_id_1". I'll keep a check on it and see how it goes and post my findings.

whitey06 09-10-2010 10:34 AM

Ok I can now confirm that the recent change I made has now worked and the plugin is now working, doing everything it should be :D
The code change I made was to the template part again and is as follows:

PHP Code:

$templater vB_Template::create('subscription_payment_gcheckout');
            
$templater->register('hash'$hash);
            
$templater->register('cost'$cost);
            
$templater->register('currency'$currency);
            
$templater->register('item'$item);
            
$templater->register('no_shipping'$no_shipping);
            
$templater->register('settings'$settings);
            
$templater->register('subinfo'$subinfo);
            
$templater->register('timeinfo'$timeinfo);
            
$templater->register('userinfo'$userinfo);
        
$form['hiddenfields'] .= $templater->render();
        return 
$form

Thanks again for the help and replies.

CaseLogic 09-10-2010 02:52 PM

Quote:

Originally Posted by whitey06 (Post 2096162)
Ok I can now confirm that the recent change I made has now worked and the plugin is now working, doing everything it should be :D
The code change I made was to the template part again and is as follows:

PHP Code:

$templater vB_Template::create('subscription_payment_gcheckout');
            
$templater->register('hash'$hash);
            
$templater->register('cost'$cost);
            
$templater->register('currency'$currency);
            
$templater->register('item'$item);
            
$templater->register('no_shipping'$no_shipping);
            
$templater->register('settings'$settings);
            
$templater->register('subinfo'$subinfo);
            
$templater->register('timeinfo'$timeinfo);
            
$templater->register('userinfo'$userinfo);
        
$form['hiddenfields'] .= $templater->render();
        return 
$form

Thanks again for the help and replies.

no problem thanks for the vb4 code :)

MichaelDance 09-13-2010 09:31 AM

Quote:

Originally Posted by CaseLogic (Post 2094098)
is that when you are going to the google checkout cart? at what stage in the process is it giving you this error?

The First stage, but ill update to the 1.1 and see but if it comes up again bye bye google.



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

No sorry im not using as it wont work for me..
Click on:
Order Using Google Checkout

Takes me to:
https://checkout.google.com/api/chec...ant/2147483647

Error:

Oops!
We were unable to process your request.


Time when the error happened: 2010-09-13T10:35:26 (UTC) (49021a792b5c8)


I entered all my information correct..

Tbh i dont like it now. I'm clicking un-installed.

dimopoulos 11-18-2010 12:08 PM

Great plugin!!

Thank you for sharing. I really wanted to have an alternative to Paypal and now I have it.

dimopoulos 11-20-2010 03:02 PM

I am having an issue in the integration.

I followed the instructions.

Created the GCheckout account.
Added bank information/verified bank etc.

Settings/Preferences
- Automatically authorize and charge

Settings/Integration
- Not checked the digitally signed cart box
- Typed (correctly) the callback URL
- Selected the first option in the Serial # (I don't have https)
- Selected API 2.5

In vBulletin I uploaded the class, installed the product and set up the merchant ID and merchant Key. I activated the gateway and tested the communication - all is OK.

Now when I go with a test account to subscribe, I see the google checkout option. I click on it, go to the relevant page with my subscription and pay for it.

In the Google Checkout account, I do see the charge, however it awaits for me to click the relevant button to make the order shipped. This is issue number 1.

Even when I do click shipped, I do not see the order in the logs nor do I see the subscription activated through the callback....

I am somewhat baffled by this. Any help is appreciated.

CaseLogic 11-20-2010 03:18 PM

Quote:

Originally Posted by dimopoulos (Post 2123888)
I am having an issue in the integration.

I followed the instructions.

Created the GCheckout account.
Added bank information/verified bank etc.

Settings/Preferences
- Automatically authorize and charge

Settings/Integration
- Not checked the digitally signed cart box
- Typed (correctly) the callback URL
- Selected the first option in the Serial # (I don't have https)
- Selected API 2.5

In vBulletin I uploaded the class, installed the product and set up the merchant ID and merchant Key. I activated the gateway and tested the communication - all is OK.

Now when I go with a test account to subscribe, I see the google checkout option. I click on it, go to the relevant page with my subscription and pay for it.

In the Google Checkout account, I do see the charge, however it awaits for me to click the relevant button to make the order shipped. This is issue number 1.

Even when I do click shipped, I do not see the order in the logs nor do I see the subscription activated through the callback....

I am somewhat baffled by this. Any help is appreciated.

for starters, you don't have to worry about clicking ship or anything. once the order is charged, that is enough to initiate the proper callback to vB. vB doesn't care about the status of the shipment, so you don't have to click ship or anything.

if you are not seeing anything in the transaction logs, then google checkout is not communicating properly with vB. If there was an error in the communication, you'd still see that in the logs.

Double- and triple-check the URL that google checkout is contacting. It should be your forum address/payment_gateway.php?method=gcheckout

If that is correct, go to the Google Checkout Integration console (https://checkout.google.com/sell/set...grationConsole). See if there are any errors listed.

Next, go to your transaction log verify the recent transactions (successful or otherwise). See if there are any listed errors for your recent GC transactions, anything at all being logged under gcheckout can be helpful

Finally, the process isn't as instantaneous as paypal. It usually takes 5-10 mins on average,
though.

dimopoulos 11-21-2010 11:39 AM

Hello CaseLogic,

Thank you for the prompt reply.

The issue seems to be twofold. For starters Google did not authorize the transaction (even after 10-15 minutes). My credit card was being checked and that took more than 4 hours. In the end they did charge it successfully.

Now something happened with the communication itself which I am going to try and assess looking at the logs as you suggested.

Thank you again. I will keep you posted.

CaseLogic 11-21-2010 01:08 PM

Let me know so I can help you debug

dimopoulos 11-22-2010 08:40 PM

1 Attachment(s)
Hello CaseLogic,

It appears that the issue was from Google's fraud detection department. It took them several hours to clear my credit card and my second test was successful. The communication with vBulletin is complete and I have enabled the modification for my forum.

Two issues that I want to draw your attention to:

1. I have added the gcheckout_order_instructions phrase so as to display some information when one is presented with the Google Checkout button (follows the other payment apis)
2. In the class itself I have introduced the $_server variable which defaults to checkout.google.com. However you can if you wish set it to sandbox.google.com/checkout so that you can do some testing.

I am attaching the changed files for your attention.

Thank you again!

CaseLogic 11-22-2010 09:05 PM

Great I'm glad that it's working for you now.

I will keep your changes in mind. I've been meaning to update with a bit more functionality such as the bits you've included, but I've been too busy lately.

Thanks again

OldSchoolDSL 12-10-2010 11:33 PM

Quote:

Originally Posted by CaseLogic (Post 2124790)
Great I'm glad that it's working for you now.

I will keep your changes in mind. I've been meaning to update with a bit more functionality such as the bits you've included, but I've been too busy lately.

Thanks again

Before vBulletin.com ends support for vBulletin 3. Can you please be so kind as to update this mod and release this for vBulletin 4?

CaseLogic 12-10-2010 11:42 PM

Quote:

Originally Posted by OldSchoolDSL (Post 2132157)
Before vBulletin.com ends support for vBulletin 3. Can you please be so kind as to update this mod and release this for vBulletin 4?

Yeah I plan to. In the mean time, someone else has posted some edits you can make to make this compatible with vb4

BirdOPrey5 12-11-2010 02:49 AM

I heard somewhere on vbulletin.com native support for Google Checkout was coming soon for VB4. Might want to double check before you put in too much time.

CaseLogic 12-15-2010 12:30 AM

I figured out the issue that some (or at least 1) person reported in this thread. There is a problematic intval() call in the form generation function. Merchant ID's are generally very large numbers. intval() is either a 32 bit or a 64 bit function, depending on the host. If it's a 32 bit system, it will max out and cap at the wrong value.

For those running into the "oops!" error, please fix the following line by removing intval:

Code:

$form['action'] = 'https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/' . intval($settings['gmerchantid']);
to this:

Code:

$form['action'] = 'https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/' . $settings['gmerchantid'];

CaseLogic 12-15-2010 12:32 AM

Quote:

Originally Posted by BirdOPrey5 (Post 2132221)
I heard somewhere on vbulletin.com native support for Google Checkout was coming soon for VB4. Might want to double check before you put in too much time.

Thanks for the heads up

MichaelDance 12-15-2010 01:36 PM

thank you mate for the fix :)

OldSchoolDSL 12-15-2010 07:27 PM

Quote:

Originally Posted by BirdOPrey5 (Post 2132221)
I heard somewhere on vbulletin.com native support for Google Checkout was coming soon for VB4. Might want to double check before you put in too much time.

They've been claiming they'll work on this since...forever....

I'll wait for a mod (think it will happen sooner -vs- bulletin.com)

CaseLogic 12-16-2010 01:30 PM

if someone can be kind enough to let me use their vB4 forum, I can update this for vB4 in an hour tops.

OldSchoolDSL 12-17-2010 02:00 AM

Quote:

Originally Posted by CaseLogic (Post 2134819)
if someone can be kind enough to let me use their vB4 forum, I can update this for vB4 in an hour tops.

What do you need?


All times are GMT. The time now is 05:46 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.02599 seconds
  • Memory Usage 1,922KB
  • 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
  • (2)bbcode_code_printable
  • (6)bbcode_php_printable
  • (17)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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