XF 1.2 Classifying User Upgrades as Donations

Hello, XenForo Community!

I've used search, I've used Google, I've looked into the HTML, I've looked at the php files, and I just can't seem to figure out how to change the type of transaction XenForo makes with PayPal for purchasing a user upgrade.

I'd like it so that when a user purchases an upgrade that it be flagged as a donation to PayPal, to avoid merchant fees that shouldn't exist as it isn't actually a 'purchase'. As far as I can tell, I can generate the proper links by creating donation flagged donor buttons through PayPal, but I can't figured out how to hook them into the User Upgrade system.

Any help regarding this would be greatly appreciated.
Aye - I've looked at the code inside that template but I still have been unable to figure out how it's getting the unique PayPal address that it uses for purchases.
I can only assume it's some sort of internal component that I've been unable to find.

This line in particular stands out to me:
<input type="hidden" name="custom" value="{$visitor.user_id},{$upgrade.user_upgrade_id},token,{$visitor.csrf_token_page}" />

But I can't find where $visitor.csrf_token_page is set.


XenForo developer
Staff member
Don't change that line... :)

I'm not totally sure what you're trying to change. It will be in the PayPal docs somewhere, but it may interfere with the other components of the system, depending on how PayPal works.

Trying to change the type may involve the "cmd" param, though this may then change callback details in an invalid way.
The best way I can think to explain it is thusly:

For simplicity, let's say PayPal offers two modes of transaction (despite them offering more) and let's ignore subscription based transactions for the moment.
The two transactions we have are:
  • Merchant
  • Donation
When a user makes a merchant transaction, the way XenForo is currently configured to use, the 'seller' recieves payment and is then asked to print a shipping label if applicable.
A Merchant transaction is classified by PayPal as an exchange of tender for goods - and as thus, is covered under PayPal's buyer protection.
This type of transaction also incurs a transaction fee from PayPal, and for larger transactions, this can be in upwards of $5 off the purchase for the seller.

When a user makes a donation transaction, PayPal recognizes this as a donation and asks for no additional action by the 'seller' or reciever.
It permits the reciever to easily issue a refund if they so desire, and also waives any transaction fees, resulting in a full monetary exchange.

My goal here is to switch XenForo's User Upgrades from processing transactions as a Merchant, and instead process them as Donations.
The experience for the enduser is almost the same, and from what I know, the transaction process is almost identical as well. I can imagine that there may be some callback issues, but I also believe that these can be fixed.
I'm not a technical guru, but I usually can figure things out - it's just stumped me this time around.


Well-known member
This is an important issue, because defining donations as goods can cause a slurry of charge-backs and if you run a non-profit / charitable organization like me then it can also cause issues with the tax agency.