Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 5th Aug 2012, 11:22 AM   #1
Active Warrior
War Room Member
 
Join Date: 2010
Location: United Kingdom
Posts: 34
Thanks: 1
Thanked 7 Times in 7 Posts
Default
Merchant Fee Muncher (PHP Function)
Share on: 
fb share twitter share gplus share more share

Ok so here's how coffee break discussions go. The subject was merchant fees. PayPal specifically, but the merchant itself is irrelevant. Let's say you "as a merchant" receive $100. Based on PayPal's standard fee schedule of 2.9% of the total transaction and fixed rate amount of $0.30 you will receive the total net amount of $96.80. The main topic of the discussion I had was if that $96.80 was used to purchase something from another PayPal merchant based on the same fee schedule and then if that merchant spent his net amount with another merchant and so on, then how long would it take before the original $100 is completely consumed by the merchant (i.e. they keep all of it)? The answer is 81 transactions. In order to calculate this I built a quick php function so thought I would post it here just for fun. It will work with any merchant and not just PayPal, but by default the function is setup by default based on PayPal's fee schedule. Based on bigger numbers? PayPal will take $10,000,000 in 468 transactions if the orginal transaction is kept and spent within PayPal's system and passed on through merchant to merchant in exchange for goods and services. Staggering!

Anyway, here's the code:

PHP Code:
<?php

/*

Function Arguments

    amount = Original transaction amount.
    percent = Fee percentage taken by merchant per transaction.
    fixed = Fixed rate amount taken by merchant per transcation.
    nibble = Internal function use only!

*/

function fee_muncher($amount=100,$percent=2.9,$fixed=.3,$nibble=0)
{
    global 
$history;
    
$munched = $amount * ((100-$percent) / 100) - $fixed;

    
$history[$nibble] = array('gross' => number_format($amount, 2, '.', ','),
                  
'net' => number_format($munched, 2, '.', ','),
                  
'fee' => number_format($amount - $munched, 2, '.', ','),
                  
'transaction' => $nibble+1);

    if (
$munched > .1)
        return (
fee_muncher($munched,$percent,$fixed,$nibble+1));
    else
        return (
$nibble+1);
}

/*

Example Usage:

*/

echo fee_muncher(5000,2.9,0.30); // Number of transactions before $5,000 USD is fully assimilated by merchant.
print_r($history); // Multi-dimensional array holding all the transaction info.

?>
Just for fun remember.

Live Track Mobile Spy - Android Spy Software
Postcode Palâ„¢
- Geo Datasets for GB, NI, CI and the Isle of Man
vulcanscripts is offline  
Closed Thread


Bookmarks

Tags
fee, function, merchant, muncher, php


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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 05:51 PM.