Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Adding a new payment processor Details »»
Adding a new payment processor
Version: 1.00, by StewardManscat StewardManscat is offline
Developer Last Online: Nov 2009 Show Printable Version Email this Page

Version: 3.0.7 Rating:
Released: 04-21-2005 Last Update: Never Installs: 3
 
No support by the author.

I need to add a new payment processor. I am sure this has been done many times by many people. Sure wish vbulletin had a better forum search facility, because the answer must already be here.

But I don't dare even look. I'll get distracted by some other lovely toy, and there goes my effort!

Here I am going to just talk aloud, and document as I go. Perhaps someone will interrupt and send me to the proper place. Otherwise, maybe another can make use of this information.

Honestly, if I tell you guys what I am doing, as I do it, sometimes it helps me avoid the really stupid mistakes. Then again, sometimes not.

Enough editorial. Intended audience has some php/hacking experience. This is not a job for the rank novice. Watch me bleed.

Going to add two new processors. First stop: admin/functions_subscriptions.php

Find and modify:
PHP Code:
$_SUBSCRIPTIONS['methods'] = array(
    
'paypal'    =>    1,
    
'nochex'    =>    2,
    
'worldpay'    =>    4,
    
'authorize'    =>    8,
    
'inhouse'    =>    16,
    
'plugnpay'    =>    32
);

// ######################## 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),
    
'inhouse'    =>    array('usd' => true),
    
'plugnpay'    =>    array('usd' => true)
); 
I have added "inhouse" and "plugnpay". Carefully adding commas at the end of each new line (but screwing it up anyway).

For the bit values I choose increasing powers of two: after 32 comes 64, 128,512,1024... and if you have that more payment processors you surely have a calculator.

Next stop, using phpMyAdmin, I find the record in vb_settings where grouptitle='subscriptions'

I change the value for 'value' from 4 to 6, and I replace the value for 'optioncode' with the following.

PHP Code:
<span class=\"smallfont\" style=\"white-space:nowrap\">
<input type=\"hidden\" name=\"setting[
$setting[varname]][]\" value=\"0\" />
<label for=\"paypal\"><input type=\"checkbox\" name=\"setting[
$setting[varname]][]\" id=\"paypal\" value=\"1\" tabindex=\"1\" " iif(bitwise($setting['value'], 1), HTML_CHECKED) . " />PayPal</label><br />
<label for=\"nochex\"><input type=\"checkbox\" name=\"setting[
$setting[varname]][]\" id=\"nochex\" value=\"2\" tabindex=\"1\" " iif(bitwise($setting['value'], 2), HTML_CHECKED) . " />NOCHEX</label><br />
<label for=\"worldpay\"><input type=\"checkbox\" name=\"setting[
$setting[varname]][]\" id=\"worldpay\" value=\"4\" tabindex=\"1\" " iif(bitwise($setting['value'], 4), HTML_CHECKED) . " />WorldPay</label><br />
<label for=\"authorize\"><input type=\"checkbox\" name=\"setting[
$setting[varname]][]\" id=\"authorize\" value=\"8\" tabindex=\"1\" " iif(bitwise($setting['value'], 8), HTML_CHECKED) . " />Authorize.Net</label><br />
<label for=\"inhouse\"><input type=\"checkbox\" name=\"setting[
$setting[varname]][]\" id=\"inhouse\" value=\"16\" tabindex=\"1\" " iif(bitwise($setting['value'], 16), HTML_CHECKED) . " />In House</label><br />
<label for=\"plugnpay\"><input type=\"checkbox\" name=\"setting[
$setting[varname]][]\" id=\"plugnpay\" value=\"32\" tabindex=\"1\" " iif(bitwise($setting['value'], 32), HTML_CHECKED) . " />Plug n Pay</label><br />
</span> 
Just duplicated the last line twice, and modified the names and bit values to match what I have invented so far.

Next stop: admin/functions_subscriptions.php (again).

inside function construct_payment() there is a switch statement. I need to add two more cases. Eg:

PHP Code:
        case 'inhouse':
        
$form['action'] = 'http://mysite.com/purchase';
        
$form['method'] = 'post';
        
$form['hiddenfields'] = "
            <input type=\"hidden\" name=\"desc\" value=\"
$item\" />
            break; 
This is now specific to the processor. But the $form entires are self-explanatory, and, given the standard release of vb, there are some examples to follow. So I create the strings that will plopped into a template for the form action, method, and hidden fields.

So far so good. I am seeing me different payment methods in the admincp, and when I buy a subscription.

Only I'm not seeing a name for the button 'Orde using...'.

Oh crud. Now I need a phrase.

And so ends today's lesson in getting started with a new payment processor.

Those of you who can point me to existing threads, or otherwise provide documentation or encouragement: many thanks in advance.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-21-2005, 10:57 PM
StewardManscat StewardManscat is offline
 
Join Date: May 2004
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No wonder so many of my users hate vb.

I've been using it for over six months now, and here I am, wondering how to edit my own darn post. Grr!

And clearly I've posted in the wrong forum.

Oh well. Maybe another day it will be obvious to me.

Meantime, I have foolishly posted something I am incapable of editing or deleting.

Moderator assistance if and when possible please.
Reply With Quote
  #3  
Old 04-21-2005, 11:11 PM
StewardManscat StewardManscat is offline
 
Join Date: May 2004
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Still just finding where to make the mods....

The phrase search ends at a hard-coded array in forum/subscriptions.php

PHP Code:
    // These phrases are constant since they are the name of a service
    
$tmp = array(
        
'paypal' => 'PayPal',
        
'nochex' => 'NOCHEX',
        
'worldpay' => 'WorldPay',
        
'inhouse' => 'In House',
        
'plugnpay' => 'Plug n Pay'
    
); 
Now, if I am groking in fullness, the $form array that I completed in an earlier step will be invoked. The payment processor takes over. I send a return url through a hidden field in this form (or by some admin panel at my payment processor). The return links are:

http://www.mysite.com/forum/subscriptions/inhouse.php
and
http://www.mysite.com/forum/subscriptions/inhouse.php

Now I'm ready to take an existing script from the subscriptions directory, rename it as inhouse.php or plugnpay.php, modify to accept the return values, and I might be done.

Cheers
Reply With Quote
  #4  
Old 04-21-2005, 11:28 PM
twoseven twoseven is offline
 
Join Date: Jan 2004
Location: in floris' pants
Posts: 226
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="https://vborg.vbsupport.ru/showthread.php?s=&threadid=66949" target="_blank">https://vborg.vbsupport.ru/showt...threadid=66949</a>
same thing released before by kall.
Reply With Quote
  #5  
Old 04-22-2005, 12:31 AM
LEAD_WEIGHT LEAD_WEIGHT is offline
 
Join Date: Feb 2005
Location: Canada
Posts: 369
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by twoseven
https://vborg.vbsupport.ru/showthrea...threadid=66949
same thing released before by kall.
Your point twoseven

vB Version: 3.0.3 Mod Version: 1.00 Supported
DB Changes
Installer included

Release: 07. Jul 2004 Installs: 5
Last Update: Never Rating:


At least he is trying to upgrade it from 3.0.3 to 3.0.7 so do not knock him for doing this gre:
Reply With Quote
  #6  
Old 04-22-2005, 12:40 AM
twoseven twoseven is offline
 
Join Date: Jan 2004
Location: in floris' pants
Posts: 226
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

there is no change from 3.0.3 the subscription info never changed
Reply With Quote
  #7  
Old 04-22-2005, 07:07 PM
jugo jugo is offline
 
Join Date: Feb 2004
Location: Reading your emails.
Posts: 573
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
But I don't dare even look. I'll get distracted by some other lovely toy, and there goes my effort!
LMAO!!! Very true!!! happens to me all the time.
Reply With Quote
  #8  
Old 04-23-2005, 09:11 AM
Deaths Deaths is offline
 
Join Date: Oct 2004
Location: Europe, Belgium
Posts: 679
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hehe, same here
Reply With Quote
  #9  
Old 04-24-2005, 11:13 AM
kall's Avatar
kall kall is offline
 
Join Date: Apr 2004
Location: New Zealand
Posts: 2,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by LEAD_WEIGHT
Your point twoseven

vB Version: 3.0.3 Mod Version: 1.00 Supported
DB Changes
Installer included

Release: 07. Jul 2004 Installs: 5
Last Update: Never Rating:


At least he is trying to upgrade it from 3.0.3 to 3.0.7 so do not knock him for doing this gre:
No, twoseven *is* right... releasing something exactly the same as something already released is generally not done around here.

Thank you for pointing out that I had it set at 3.0.3 though. You may not realise, having not released anything yourself, that this is a dropdown box, with no option to select 'various versions from 3.0.3 up'.

Twoseven is also right in saying there have been no changes to the system since my release, so that release still applies.
Reply With Quote
  #10  
Old 04-24-2005, 01:44 PM
StewardManscat StewardManscat is offline
 
Join Date: May 2004
Posts: 26
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Your release not only still applies, but you did it without all the whining and crying. And you found one final phrase that I did not. People trying to simply make the change should definitely follow your thread.

Kall shows different ways of making the mods: something about turning on debug and using the address bar to modify a setting. Even more potentially useful information.

I didn't quite understand I was "releasing" something here, I was just posting a whiner. We all have our days.

There is nothing to release. It's just a few steps to follow. So long as the threads are cross-linked, another may have twice the chance of understanding or learning. Or finding it in the first place.

Alert here's something curious. If you start with an existing subscriptions ipn (instant payment notification) module, you may find it includes init but not global.

Where do people define their group ids eg define('MYGROUP', 13). I would have guessed global.php

Other steps Many processors require a unique transaction identifier. I found I had to create a table. When the purchase was confirmed, write the userid and get an insert id. The subscription table itself will not do.

Now, if a cookie has expired when the IPN is received, you still have the insert id, and can recover the transaction details. I saved everything the processor sent:

PHP Code:
foreach ($_REQUEST as $key => $value)
  
$postdata .="\n$key => $value";

if (
status from processor is ok)
{
  
$DB_site->query("UPDATE ... postdata='".serialize($postdata)."'...

Many times you do not really understand what a processor is telling you until you see it in action. Once you have some rows in your table, you can see what they really meant by their status and return variables.

Also in this table, a COMPLETE status. If you try to complete a transaction that is already complete, you know somebody is hacking... or more likely, the payment processor is acting up, and users are desperately re-trying. Beats extending the subscription eight times. And provides a useful audit trail.

There's another difficulty for adult ("stupid") sites. Presenting all those payment methods is confusing for some people. Better to guide them one at a time, first through your main processor, then try for the others.

I'm not done yet! Appreciate the feedback.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:34 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.06028 seconds
  • Memory Usage 2,334KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (5)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete