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

Main Menu

Paid subscriptions bug

Started by Krashsite, December 08, 2015, 03:21:36 PM

Previous topic - Next topic

Sir Osis of Liver

Per this topic, the problem is caused by something PayPal does, so technically isn't an SMF bug, but should be corrected.  I have replicated the problem on a clean test install.

On completing payment, the PayPal return link takes subscriber back to board index, not the payment confirmation page.  PayPal converts ; or = characters in the action link to hex, and that causes the link to fail and go to board index.  If the ; or = characters in any link are converted to hex codes, SMF ignores the action and returns to board index.

The link is generated here -


$fields = $gateways[$id]->fetchGatewayFields($context['sub']['id'] . '+' . $memID, $context['sub'], $context['value'], $period, $scripturl . '?action=profile;u=' . $memID . ';area=subscriptions;sub_id=' . $context['sub']['id'] . ';done');

PayPal converts the link to index.php?action=profile%3bu%3d111%3barea%3dsubscriptions%3bsub%5fid%3d8%3bdone, it fails and returns to board index.

The OP who reported the glitch fixed it like this -

$fields = $gateways[$id]->fetchGatewayFields($context['sub']['id'] . '+' . $memID, $context['sub'], $context['value'], $period, $scripturl . '?action=profile&u=' . $memID . '&area=subscriptions&sub_id=' . $context['sub']['id'] . '&done');

The modified link is index.php?action=profile&u=111&area=subscriptions&sub_id=8&done.  PayPal does not convert & or = to hex, SMF reads the link normally, and goes to payment confirmation.  SMF is not bothered by & replacing ; (also works with #, and probably other characters).  At some point PayPal must have changed the way they process the return link, and since the subscription still works, no one noticed the difference (I didn't).

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

Sir Osis of Liver

After two weeks of dicking around, this is the best explanation I could get from PayPal merchant support -

I have consulted this with our engineering team and as per their findings, PayPal did not accepted the ; as a valid character in return URL as encoded on PayPal end is following the standard of Windows-1252 formatting.

Whenever the return URL is specified with a character such ; will be replace with %3b as our encoded URL is specified on such ways following the Windows-1252 encoded and UTF-8.

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