[Solved] cbsubs ipn url conflict with online shop ipn url

11 years 3 months ago - 11 years 2 months ago #220464 by mozgras
I'm developing a custom IPN to resolve payment notification conflicts with our online shop. I've tried creating a generic php script handle ipn notifications from 2CO. Depending on certain variables I can tell if the ipn is for cbsubs or hikashop. My thought is to then post the $_REQUEST data to the appropriate url. I've managed to send the data to hikashop successfully, where the component updates the order status. However, I'm not having success with sending the $_REQUEST data to the cbsubs ipn url. Any thoughts why this approach may or may not work would be greatly appreciated.

Please Log in to join the conversation.

11 years 3 months ago #220467 by beat
That's a nice feature request, as 2Checkout supports only 1 fixed IPN URL !

I'm suggesting to add in CBSubs 2Checkout gateway a new parameter:

"Pass-through IPN URL for second E-commerce system" actually.

That way, if CBSubs realizes an IPN from 2Checkout is not for CBSubs, it would "proxy" that to a 2nd predefined URL. Then if the other E-commerce system supports same, you could even have a third one... :)

Would that make sense ?

Do you want to take a look at that ? and if yes, need a hint where to add the code ?

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in to join the conversation.

11 years 3 months ago #220473 by mozgras
Yes. That would be great. Hints would be wonderful. Thanks for the help!

Please Log in to join the conversation.

11 years 3 months ago - 11 years 3 months ago #220524 by mozgras
I added this code to line 111 of cbpaidsubscriptions.twocheckout:
$hikashop_url = "http://worsleyinstitute.com/index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=pay2co&tmpl=component";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $hikashop_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

This simply passes $postdata to the hikashop ipn url. Looks like it's working!

Please Log in to join the conversation.

11 years 3 months ago - 11 years 3 months ago #220541 by beat

mozgras wrote: I added this code to line 111 of cbpaidsubscriptions.twocheckout:

$hikashop_url = "http://worsleyinstitute.com/index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=pay2co&tmpl=component";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $hikashop_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
curl_close($ch);

This simply passes $postdata to the hikashop ipn url. Looks like it's working!


Great!
Thanks for sharing your solution :)

Your line 111 is probably different than the CBSubs GPL 3.0 twocheckout main PHP file, but the code above seems to be all what's needed for proxying the IPN to the second E-commerce system.

#3907

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info
The following user(s) said Thank You: mozgras

Please Log in to join the conversation.

11 years 3 months ago - 11 years 3 months ago #220609 by mozgras
Not an IPN issue, but similarly, another issue is the checkout redirect url. I have it set in 2CO to a custom php script (that will redirect the user to either a hikashop or cbsubs thank you for your payment page), but it seems cbsubs overrides this with the x_receipt_link_url parameter. Is there a way to use the 2CO setting always? Overriding it null in the plugin code at checkout, before going to 2CO, partially works in that the user is correctly redirected to the url setting in 2CO, however when I tested this approach it seemed to prohibit the user from getting a registration confirmation email.

Besides the conflict with hikashop (as I want the user to be redirected to a different thank you page) is that I'm getting "no suitable basket found" error with a legitimate subscription payment. For now, I modified the code in cbpaidControllerCBTab.php to redirect the page to the my custom thank you page instead of displaying the error. This all works, but I've had to add another modification to the code, which isn't preferable.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.226 seconds

Facebook Twitter LinkedIn