Back to vBulletin 3.0 Add-Ons

Adding a new payment processor
Mod Version: 1.00, by StewardManscat

This modification is in the archives.
vB Version: 3.0.7 Rating: (0 vote - 0 average) Installs: 3
Released: 22 Apr 2005 Last Update: Never Downloads: 0
Not Supported  

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.

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2024