It can get frustrating at times when you move you WHMCS folder or any other billing platform that uses PayPal recurring payments. Especially when using Instant Payment Notifications (IPN) through PayPal. This is due to the fact that you can not update their old subscription addresses without cancelling them and getting the people to start again.
I went on the hunt to find out what can be done and I came back with two options. One which was recommended by a friend and the other which was sent to me through WHMCS.
/**
* WHMCS Callback Redirect Script
*
* This file can be used to redirect payment gateway callback requests from
* an old location to a new one preserving POST data.
*
* @author WHMCS Limited <development@whmcs.com>
* @copyright Copyright (c) WHMCS Limited 2005-2017
*/
// Enter the new url the callback file is located at
$url = 'https://www.yourdomain.com/new/path/to/paypal.php';
// --- Do not edit below this line. ---
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
if (curl_errno($ch)) {
$response = 'Could not connect to new callback file: ' . curl_errno($ch) . ' - ' . curl_error($ch);
}
curl_close($ch);
echo $response;
To stay up to date with more web hosting and design tips and tricks follow us each week as we take you on a journey through the web hosters blog!
Need web hosting or a web design contact us today!
“To be Australia’s best web hosting provider excelling in customer service”
contact@hbhosting.com.au
© Copyright 2017 – 2020 | HBHosting | ABN 12 718 788 074 |
2 Responses
hi, i am having same issue ..anyways you did not clear some info about your 2nd coding option…
i mean in which directory location i need to create this paypal.php file
You need to create the same location as Paypal knows, so its different for everyone