News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Another paid subscriptions bug?

Started by Krashsite, May 24, 2012, 12:56:41 AM

Previous topic - Next topic

Sir Osis of Liver


Yes, that's the usual error.  It's not a gateway problem because payment is successful, and subscriptions.php receives the IPN - correct payment details are in the logged error.  It just isn't processed correctly and the subscription isn't activated.  This is a common problem, and doesn't always involve recurring payments.  I've been unable to duplicate it on my test forums, so it may be host or php config related.

"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

emanuele

As far as I can tell from the code, that error is generated here:
$txnType = '';
$gatewayHandles = loadPaymentGateways();
foreach ($gatewayHandles as $gateway)
{
$gatewayClass = new $gateway['payment_class']();
if ($gatewayClass->isValid())
{
$txnType = $gateway['code'];
break;
}
}

if (empty($txnType))
generateSubscriptionError($txt['paid_unknown_transaction_type']);


and isValid simply checks if the gateway *can* handle the transaction.
The checks for paypal are rather trivial:
public function isValid()
{
global $modSettings;

// Has the user set up an email address?
if (empty($modSettings['paypal_email']))
return false;
// Check the correct transaction types are even here.
if ((!isset($_POST['txn_type']) && !isset($_POST['payment_status'])) || (!isset($_POST['business']) && !isset($_POST['receiver_email'])))
return false;
// Correct email address?
if (!isset($_POST['business']))
$_POST['business'] = $_POST['receiver_email'];

if ($modSettings['paypal_email'] !== $_POST['business'] && (empty($modSettings['paypal_additional_emails']) || !in_array($_POST['business'], explode(',', $modSettings['paypal_additional_emails']))))
return false;
return true;
}

so:
* is paypal enabled?
* is there:
   * a) a txn_type or a payment_status POSTed?
   or
   * b) business or receiver_email POSTed?
* is the email correct?

and that's all...
It doesn't check what tnx_type contains at all.

The only case I didn't see the subscription activated was when paypal (seller paypal) was wrongly set to "ask me" for currencies different than USD and the subscriptions were set in something different than USD. In that case paypal correctly don't accept the payment and SMF doesn't activate the subscription.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Sir Osis of Liver


I only encountered the currency problem once, and was able to fix it.  All the other forums with failed subscriptions were using USD.  If you look at my first post top of this thread, I found IPN transaction types that are specified in Subscriptions-PayPal.php, and others that are not.  In some cases sub will fail with unknown txn_type error even though txn_type in IPN is valid and specified in Subscriptions-PayPal.php.  IIRC, in at least one case, a sub was successful with a txn_type that is not specified in Subscriptions-PayPal.php.  Wasn't able to duplicate the problem, so didn't pursue it.  I can't do anything with recurring payments because I have a personal Paypal account, and it requires a business account, but otherwise Paid Subs has worked for me in all 2.0.x versions. 

"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

madfiddler

Wonder if I should start accepting USD rather than GBP then....

Sir Osis of Liver


Paid Subs should accept GBP - it's one of the currency choices in Settings.

"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

madfiddler

Yep, I just want to find a way to make this work, and not have the 2005 bug. Just a thought to try dollars and see if that does indeed work.

madfiddler

Tried $ instead of £. Get the 'pending payment' issue.

Sir Osis of Liver


Is your Paypal account set up for GBP?

"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

madfiddler

I have a business account which is set in GPB, yes, but accepts anything it seems. I've reverted back to GBP payment now, just thought I'd try.

I wonder if this is a server issue though. The SFMHacks Shop IPN appear to work either however my server logs show that Paypal is indeed contacting the server.

madfiddler

Something else which is interesting, if I select currency "other" it says

currency code - GBP
symbol used - £%1.2f

Shouldn't symbol used be £%1.2f ?

Perhaps the internal symbol for GBP when selecting the drop down menu is incorrect?

Sir Osis of Liver


&pound will give you the correct symbol in html.

Post an error from your error log for a failed subscription.

"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

madfiddler

OK, thanks.

I've never been able to find an error in the log, no mention at all. Only only mention in the server log saying there was a call from notify.paypal.com

Sir Osis of Liver


If there's no error, that usually means the IPN never reached the forum.  It's being blocked, either by a mod or your host.  If you contact Paypal merchant support, they can confirm that the IPN was sent, and if it's getting to the forum or not.
"The best laid schemes o' mice an' men / Gang aft a-gley." - Robert Burns

madfiddler


Arantor

Retracked under https://github.com/SimpleMachines/SMF2.1/issues/1169 to prevent it falling through the cracks any further. (Having a central place to co-ordinate all the issues does actually help :))

Advertisement: