0
votes

Okay, so we have a member site using Joomla, and a component that allows users to perform certain tasks (creating teams). They are allowed to login, and create a team, but they can't add members to this team until they pay a $25.00 fee.

This happens through Paypal IPN. There is essentially this form below... (some personal data removed).

	
	<input type="hidden" name="cmd" value="_xclick">
	<input type="hidden" name="item_name" value="<?php echo $item_name;?>">
	<input type="hidden" name="business" value="[email protected]">
	<input type="hidden" name="amount" value="25">
	<input type="hidden" name="quantity" value="1">
	<input type="hidden" name="no_note" value="1">

        <!--<input name="userId" value="<?php //echo $user->id;?>" type="hidden">-->
        <!--<input name="task" value="paypal_register" type="hidden">-->
	<input type="hidden" name="currency_code" value="USD">
	<!-- Enable override of buyers's address stored with PayPal . --> 
	<!-- Set variables that override the address stored with PayPal. -->
	<input type="hidden" name="return" value="<?php echo JURI::ROOT().'index.php?option=com_fastball&view=payment&task=paypal_register';?>">
	<input type="hidden" name="notify_url" value="<?php echo JURI::ROOT().'index.php?option=com_fastball&view=payment&task=paypal_register&userId='.$user->id.'&ipn=1';?>">
	<!--<input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">-->
</form>

Now sometimes the IPN redirects and works just fine. But other times it cuts the url short from "index.php?option=com_fastball&view=payment&task=paypal_register&userId=" to "index.php?option=com_fastball", therefore not activating the view in Joomla that contains the code to update the database on notification.

It seems fairly random. There are several scenarios, 1 - New User Creating New Team. 2 - Old User Creating New Team. 3- Old User Renewing Old Team.

But regardless of that, they ALL hit this payment form button with THESE notify URL as hidden input.

So I'm not sure where paypal is either A.) Getting the shortened URL, or B.) They are cutting it short for some reason. It returns to the shortened URL with all of the Paypal Post info showing in the URL Parameters (&st=Completed&amt=25.00 etc from paypals servers)

This has been extremely frustrating and I may not have explained it well so if you have any questions or thoughts, just let me know. Thanks!

2

2 Answers

0
votes

For URL paths you should use JURI::base() not JURI::ROOT. You can check the documentation here https://docs.joomla.org/Constants.

0
votes

This appears to be a recent PayPal problem. All the urls (return, cancel_return, and notify_url) PayPal is stripping the url of all content after the first '&'.

Note also that the issue appears to be intermittent; it may be dependent on the PayPal server you connect to (QueryString values removed from the IPN endpoint by PayPal).

I have made some modifications to my own PayPal form replacing just the '&' with '&amp;' (the encoded version) and that seems to work.