OJS Paypal Payments IPN Problems

I have an issue with IPN usage with the Paypal payments plugin.

Here is an email that the Paypal plug in generates.

Open Journal Systems has encountered unusual activity relating to PayPal
payment support for the journal -------------------------. This activity
may need further investigation or manual intervention.

This email was generated by Open Journal Systems’ PayPal plugin.

Additional information (if supplied):
Granted amount: 26.63
Queued amount: 25
Granted currency:
Queued currency:
Granted to PayPal account:
Configured PayPal account:

(I removed server variable information)

After my own research, I found out that the Granted and Queued amount must be equal.

would not having the additional 0’s be the cause? Could it be that Paypal charging tax that is causing the issue?
or is there other information missing above?


PS: I have already tested and got working the IPN system with a sandbox paypal account.

Hi @jamesp,

Can you account for the 26.63 vs. 25? Is it possible that e.g. PayPal is exchanging between currencies, or that the price otherwise changed somehow?

Alec Smecher
Public Knowledge Project Team

The 26.63 is related to 6.5% sales tax. The amount should be correct.

This seems to be the source file that does the comparison.

I don’t completely understand the source yet, does it include or update the amount from paypal after tax is applied?

One solution could be to rewrite the code to pull the tax amount from a database and update the variable with that information, if it is not already supplied.

Hi @jamesp,

Hmm, I’m afraid I’m not particularly certain how PayPal is supposed to handle taxes – I would expect them to be either handled fully by PayPal, or fully by the client application. It looks like in this case it’s divided between the two. We use PayPal in a Canadian context ourselves, and taxes aren’t divided out like this. Is there a particular kind of tax in your jurisdiction that might explain this?

Just to be sure this isn’t a rabbit hole, is there some other change that might explain it, beyond taxes?

Alec Smecher
Public Knowledge Project Team

Well, I solved the tax issue by modifying the paypal plugin to specify no tax in the post back to paypal (The paypal account is set to auto apply state sales tax). So for article sales, we would take the taxes out from the current sale amount manually.

Other issues with the granter user account popped up afterward, but the plugin generated different errors, so it seems the tax was it’s own issue. One solution could be to change the comparison field to compare only the pretax amount, but I suppose that would just open up a potential exploit if it was hacked (I assume a hacker could then send false communications specifying a higher tax amount).

I don’t know the exact laws on US states sales tax, but I think its based on the location of the company selling online.


If I follow, are you taking out the taxes after the sale is made?

What did you modify in the PayPal plugin? Is it just changing the PayPal Account to no instead of auto?

Buyers pays tax if their location is the same as the company selling.

I have noticed that the unusual PayPal notice shows up when the buyer has paid tax on their purchase.

It would be great if there is a fix for this.


In the source file I listed above I changed this,

		'item_number' => $queuedPayment->getAssocId(),
		'cmd' => '_xclick'

To this

		'item_number' => $queuedPayment->getAssocId(),
		'cmd' => '_xclick',
		'tax' => 0

I basically just added the line ‘tax’ => 0 and added a comma at the end of the previous line.

This will force paypal to not charge tax to the order when the IPN is sent to OJS. What I meant above is that if paypal doesn’t automatically take out tax from the order amount, you will need to do the accounting for that yourself.

The file is located in “web-root/plugins/paymethod/paypal”.


Hi all,

Did you have any local tax settings entered in your PayPal account? (That’s on your PayPal merchant account, not within OJS.)

Alec Smecher
Public Knowledge Project Team

I believe we had to setup state sales tax in paypal. I think it is only applied to same state transactions.

Yes, there is local tax (sales tax) in PayPal, but they only apply to those purchases where they buyer is in the same state as us, the seller.


Thanks for the share. I will look at the file.

For us, it is better to have the taxes added when purchase is made via PayPal. It is also easy to see purchases made by buyers in your state. The amount will always be the same. I think subtracting that after the sale would take a much longer time.

Ideally, it would be great if buyers that buy and are charged a sales tax do not generate this warning which prevents them from downloading the article.


Hi all,

Would someone be able to try this change and report back?

Currently the amount is verified by checking the IPN variable called mc_gross – this is the gross transaction amount. Rather, we should probably be using auth_amount – the authorized amount. (Details here.)

To make this change in OJS 2.x, edit plugins/paymethod/paypal/PayPalPlugin.inc.php. Look for mc_gross, which should appear in this line:

(($queuedAmount = $queuedPayment->getAmount()) != ($grantedAmount = $request->getUserVar('mc_gross')) && $queuedAmount > 0) ||

Change mc_gross to auth_amount.

This should permit OJS to correctly accept payments that include tax amounts, rather than flagging a suspicious transaction.

If one of you can confirm whether this works, I’ll include the change in the next release.

Alec Smecher
Public Knowledge Project Team

I tested your changes and it didn’t work. Here are the available variables listed in the error message:


None of them have the pretax amount.


Hi @jamesp,

Is the pretax amount equal to the mc_gross amount minus the tax amount?

Alec Smecher
Public Knowledge Project Team

Yep, that seems to be the case.

I personally will not be able to do another test though, but if should work with that calculation.


Hi Alec,

I just saw your request.

I will try the code and report back.

Thanks for looking into it. It is greatly appreciated.