Login / Logout



Advertisement

AC File Payments and notify_url

How to receive IPN for web server in local network

AC File Payments is Joomla extension that helps you to provide files to your users in a variety of secure ways.

This Joomla extension is not using hosted button, but the backend logic is aware of the situation that your Joomla site may receive the payment data being manipulated.

So I did not really have to amend this Joomla extension to suit my use which is very good. What I needed this Joomla extension to do more was to enable to receive IPN for my Joomla site in a local network.

My Joomla site is in local network and the port number for the global IP is assigned there. Therefore, I had to amend AC File Payments to be able to set notify_url like http://123.123.123.123:8001/blabla/xxx.php

And here is what I did to make that happen (I am using version 1.0.1):

1. To add the following parameters to administrator/components/com_acfilepayments/config.xml

<param name="notify_host" type="text" size="30" default="" label="Notify Host" description="Enter global IP or domain when you use for Paypal notify_url if necessary (e.g. 123.123.123.123, 123.123.123.123:8080, www.abc.com)" />

<param name="sandbox_notify_host" type="text" size="30" default="" label="Sandbox Notify Host" description="Enter global IP or domain when you use Paypal sandbox if necessary (e.g. 123.123.123.123, 123.123.123.123:8080, www.abc.com)" />

2. To customize "purchase" method in components/com_acfilepayments/models/acfilepayments.php

First, find the lines below:

//$notifyurl = $siteroot.'index.php?option=com_acfilepayments&task=ipn';
$notifyurl = rtrim($siteroot,'/').JRoute::_( 'index.php?option=com_acfilepayments&task=ipn' );

And add the following lines above them:

$params      = &JComponentHelper::getParams('com_acfilepayments');
$notify_host = $params->get('sandbox')
    	     ? $params->get('sandbox_notify_host')
    	     : $params->get('notify_host');
if ($notify_host) {
	$aHost = explode(':', $notify_host);
	if (isset($aHost[0])) $uri->setHost($aHost[0]);
	if (isset($aHost[1])) $uri->setPort($aHost[1]);
	$siteroot = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
}

After applying the logic:

$params      = &JComponentHelper::getParams('com_acfilepayments');
$notify_host = $params->get('sandbox')
    	     ? $params->get('sandbox_notify_host')
    	     : $params->get('notify_host');
if ($notify_host) {
	$aHost = explode(':', $notify_host);
	if (isset($aHost[0])) $uri->setHost($aHost[0]);
	if (isset($aHost[1])) $uri->setPort($aHost[1]);
	$siteroot = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
}
//$notifyurl = $siteroot.'index.php?option=com_acfilepayments&task=ipn';
$notifyurl = rtrim($siteroot,'/').JRoute::_( 'index.php?option=com_acfilepayments&task=ipn' );


After the customisation you should be able to set notify_url for your Joomla site as a combination of global IP and port number. Of course you have to set up your router as forwarding the data to your web server if it is in a local network.

E.g. 123.123.123.123:8001

About the Author

Hiro Nozu

Hiro Nozu is a web developer who specializes in building CMS websites with Joomla. He has been in the field for over 10 years, and has been loving every minute of it. Check out some of his past work. He developed the extension Easy Search after the 3 months of involvement in the CMS at iFactory.

Comments (0)

Leave a comment

Please login to leave a comment. Optional login below.