PDA

View Full Version : Tracking payment amounts


MPDev
22 Feb 2006, 19:25
By default, vBulletin has an amount and currency column in it's paymenttransaction table, but these fields are not used (reported as a "bug", was told these would be removed in future version).

However, a couple simple lines and with PayPal you can record both of these fields. This is critical for me as it allows me to track who paid how much.

In includes/paymentapi/class_paypal.php, find:

$this->transaction_id = $this->registry->GPC['txn_id'];

and after add:

// MDP
$this->transaction_amt = $this->registry->GPC['mc_gross'];
$this->transaction_cur = $this->registry->GPC['mc_currency'];

then in ./payment_gateway.php find:

$trans['state'] = $apiobj->type;

and after add:

// MDP
$trans['amount'] = $apiobj->transaction_amt;
$trans['currency'] = $apiobj->transaction_cur;

That's it! Now your paymenttransaction table will include the amount the user paid and the currency used.

This works with both 3.53 and the new 3.54 releases.

MPDev
22 Feb 2006, 19:26
Reserved.

amykhar
22 Feb 2006, 19:57
This, I think I shall like. Now, we just need to write up reports against the table and stick them in the admincp stats section.

MPDev
22 Feb 2006, 20:02
Exactly! I sent these small code changes into vB, but they responded that they would rather remove the columns in an update. Personally, this is a big deal for my site - we get tens of thousands of dollars in "donations" a year and knowing who gave how much is how we rate our members. It's also how I can track how much we've taken in versus how much we've spent.

Tracking amounts opens up a whole new area of reporting, tracking and promotions.

amykhar
22 Feb 2006, 21:43
I think they're making a big mistake dropping those columns. Also, it might be better if we rename them and rename them in your code to prevent legacy data from being dropped in an upgrade.

MorrisMcD
22 Feb 2006, 23:07
I think they're making a big mistake dropping those columns. Also, it might be better if we rename them and rename them in your code to prevent legacy data from being dropped in an upgrade.


I agree with this

Reeve of shinra
23 Feb 2006, 01:57
I agree with all points in this thread

MPDev
23 Feb 2006, 17:48
Good idea, Amy; I'll extend my instructions in the near future to do just that.