Hi all,
I want to setup the Paypal module on my dolibarr installation.
My dolibarr is hosted locally and not available on a public TLD.
I access my dolibarr like dolibarr.mylan.net
The configured baseurl for dolibarr is dolibarr.mylan.net
I want to make the Paypal payment available publicly, so therefore I need to set a separate external url for the Paypal module.
I have added a subdomain like https://payment.mytld.com
and routed it through a reverse proxy to a vhost on the dolibarr server.
The apache2 serves the public payment interface on port 82
Using this method I can use the external url for the test scenario like:
https://payment.mytld.com/newpayment.php?amount=10&tag=your_tag
I can also click on Pay with Paypal on this site.
I’m redirected to Paypal and can do the payment.
But now when I should be redirected back to the paypal module from Dolibarr I get a technical error due to a wrong url set in the token or in the response.
The error seems to be that, when performing the payment, paypal wants to send me back to my internal URL:
http://dolibarr.mylan.net/dolibarr/public/payment/paymentok.php
instead of the correct external url:
https://payment.mytld.com/paymentok.php
For the Dolibarr Ticket System I can setup a separate URL for the public interface. Is this in any way possible for the paypal module as well?
Any help is appreciated!
Best regards
Bastian
in the newpayment.php I found the following:
// Define $urlwithroot
//$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
//$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
$urlwithroot = DOL_MAIN_URL_ROOT; // This is to use same domain name than current. For Paypal payment, we can use internal URL like localhost.
$urlok = $urlwithroot.'/public/payment/paymentok.php?';
$urlko = $urlwithroot.'/public/payment/paymentko.php?';
// Complete urls for post treatment
$ref = $REF = GETPOST('ref', 'alpha');
$TAG = GETPOST("tag", 'alpha');
$FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more information
Which is the problem. Because the DOL_MAIN_URL_ROOT is always used to build the requests
also the DOL_URL_ROOT seems to be related to the DOL_MAIN_URL_ROOT according to the wiki entry Link to wiki
Would it be advisable to introduce a new variable in the local config.php file?
But even if so, I’d need to make sure to
- have the value in my config.php
- check where to load it into a php variable
- adjust the payment module manually to use the new variable
Oh and it would be also necessary to let the paypal Dolibarr module know about the separate URLs because of the automatically generated URLs on the invoices, etc.
So hardcoding a separate URL in the php files of the payment module will probably not be sufficient 