[Skip to main content](#vessel-content)

#   onPaymentNotification() not invoked when returning

##

- **[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")**
- [![franchsesko's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35015-franchsesko "View franchsesko's Profile") Topic Author
- [ Offline](/forum/user/35015-franchsesko)

Less More

- Posts: 5
- Thank you received: 0
-
-

11 years 9 months ago [\#187618](#187618) by [franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")  *[onPaymentNotification() not invoked when returning](/forum/29-payment-methods/874415-onpaymentnotification-not-invoked-when-returning#187618 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.2 -- PHP version -- : 5.4.26 -- Browser(s) name and version -- : Firefox last -- Error-message(debug-mod must be tuned on) -- : None  Hi,  I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function. successUrl:   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  errorUrl :   www.mysitech/index.php?option=com&#95;hikash...der&#95;id=29&amp;Itemid=143  cancelUrl :   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console. My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process. Although message is notified to the user thanking them for their purchase. How's that even possible ?!?")* was created by *[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")*

-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.2
-- PHP version -- : 5.4.26
-- Browser(s) name and version -- : Firefox last
-- Error-message(debug-mod must be tuned on) -- : None

Hi,

I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function.
successUrl: [ www.mysite.ch/index.php?option=com\_hikas...der\_id=29&amp;Itemid=143](http://www.mysite.ch/index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id=29&Itemid=143)
errorUrl : [ www.mysitech/index.php?option=com\_hikash...der\_id=29&amp;Itemid=143](http://www.mysitech/index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=29&Itemid=143)
cancelUrl : [ www.mysite.ch/index.php?option=com\_hikas...der\_id=29&amp;Itemid=143](http://www.mysite.ch/index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id=29&Itemid=143)
My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console.
My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process.
Although message is notified to the user thanking them for their purchase.
How's that even possible ?!?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NzQ0MTUtb25wYXltZW50bm90aWZpY2F0aW9uLW5vdC1pbnZva2VkLXdoZW4tcmV0dXJuaW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")**
- [![franchsesko's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35015-franchsesko "View franchsesko's Profile") Topic Author
- [ Offline](/forum/user/35015-franchsesko)

Less More

- Posts: 5
- Thank you received: 0
-
-

11 years 9 months ago [\#187653](#187653) by [franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")  Replied by *[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")* on topic *[onPaymentNotification() not invoked when returning](/forum/29-payment-methods/874415-onpaymentnotification-not-invoked-when-returning#187653 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.2 -- PHP version -- : 5.4.26 -- Browser(s) name and version -- : Firefox last -- Error-message(debug-mod must be tuned on) -- : None  Hi,  I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function. successUrl:   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  errorUrl :   www.mysitech/index.php?option=com&#95;hikash...der&#95;id=29&amp;Itemid=143  cancelUrl :   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console. My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process. Although message is notified to the user thanking them for their purchase. How's that even possible ?!?")*

By the way, under my avatar it's written "hikashop essential",so just to be fair because I think I missed the field or whatever, I've bought Hikashop business and so did my final customer. Just saying ![:-)](/media/kunena/emoticons/9.png ":-)")

Help !

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NzQ0MTUtb25wYXltZW50bm90aWZpY2F0aW9uLW5vdC1pbnZva2VkLXdoZW4tcmV0dXJuaW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")**
- [![franchsesko's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35015-franchsesko "View franchsesko's Profile") Topic Author
- [ Offline](/forum/user/35015-franchsesko)

Less More

- Posts: 5
- Thank you received: 0
-
-

11 years 9 months ago [\#187696](#187696) by [franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")  Replied by *[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")* on topic *[onPaymentNotification() not invoked when returning](/forum/29-payment-methods/874415-onpaymentnotification-not-invoked-when-returning#187696 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.2 -- PHP version -- : 5.4.26 -- Browser(s) name and version -- : Firefox last -- Error-message(debug-mod must be tuned on) -- : None  Hi,  I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function. successUrl:   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  errorUrl :   www.mysitech/index.php?option=com&#95;hikash...der&#95;id=29&amp;Itemid=143  cancelUrl :   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console. My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process. Although message is notified to the user thanking them for their purchase. How's that even possible ?!?")*

OK, I did specify the notification url for the payment processor return, and then, in the onPaymentNotification() handler, i redirect to custom pages (error, ok or cancelled) with a location header.
Seems to work.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NzQ0MTUtb25wYXltZW50bm90aWZpY2F0aW9uLW5vdC1pbnZva2VkLXdoZW4tcmV0dXJuaW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

11 years 9 months ago [\#187633](#187633) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[onPaymentNotification() not invoked when returning](/forum/29-payment-methods/874415-onpaymentnotification-not-invoked-when-returning#187633 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.2 -- PHP version -- : 5.4.26 -- Browser(s) name and version -- : Firefox last -- Error-message(debug-mod must be tuned on) -- : None  Hi,  I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function. successUrl:   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  errorUrl :   www.mysitech/index.php?option=com&#95;hikash...der&#95;id=29&amp;Itemid=143  cancelUrl :   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console. My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process. Although message is notified to the user thanking them for their purchase. How's that even possible ?!?")*

Hi,

Are you sure that it is not called ?
Do you have added some "echo" in that function and checked the payment log file in Configuration &gt; Main &gt; Files ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NzQ0MTUtb25wYXltZW50bm90aWZpY2F0aW9uLW5vdC1pbnZva2VkLXdoZW4tcmV0dXJuaW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")**
- [![franchsesko's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35015-franchsesko "View franchsesko's Profile") Topic Author
- [ Offline](/forum/user/35015-franchsesko)

Less More

- Posts: 5
- Thank you received: 0
-
-

11 years 9 months ago -  11 years 9 months ago [\#187722](#187722) by [franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")  Replied by *[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")* on topic *[onPaymentNotification() not invoked when returning](/forum/29-payment-methods/874415-onpaymentnotification-not-invoked-when-returning#187722 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.2 -- PHP version -- : 5.4.26 -- Browser(s) name and version -- : Firefox last -- Error-message(debug-mod must be tuned on) -- : None  Hi,  I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function. successUrl:   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  errorUrl :   www.mysitech/index.php?option=com&#95;hikash...der&#95;id=29&amp;Itemid=143  cancelUrl :   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console. My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process. Although message is notified to the user thanking them for their purchase. How's that even possible ?!?")*

Hi,
The payment log file is empty and seems to stays like that.
In my plugin, I do log activity to a file , so I'm quite sure the onPaymentNotification() was not called when the payment gateway jumped to the url I was giving this way: Code:

HIKASHOP_LIVE.'index.php?option=com_hikashop&amp;ctrl=checkout&amp;task=after_end&amp;order_id='.$invoiceID . $this-&gt;url_itemid

(invoiceID being the order_id).
So I give always the same url to jump back to, whatever the payment processor result: Code:

$success_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&amp;ctrl=checkout&amp;&amp;task=notify&amp;notif_payment=' . $this-&gt;name . '&amp;tmpl=component&amp;order_id='. $order-&gt;order_id . '&amp;lang='.$this-&gt;locale . $this-&gt;url_itemid . '&amp;src=callback'

I added the "src=callback" parameter, so I know my notification function is being called back after jumping to the payment processor website, and not as an IPN asynchronous notification.
Then, as the processor posts back a "status" code (error, cancel or success), I can react (modifyOrder) and then redirect ("location:" header) to any page I want, which are now parameterized urls in the plugin configuration.
Works like a charm (at least seems to).
So, IPN style notifications are not necessary, but always possible and handled.
Hope this will remain rock solid; do you think anything may be wrong with that ?

Last edit: 11 years 9 months ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile"). Reason: [code] is nice !

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NzQ0MTUtb25wYXltZW50bm90aWZpY2F0aW9uLW5vdC1pbnZva2VkLXdoZW4tcmV0dXJuaW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

11 years 9 months ago [\#187738](#187738) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[onPaymentNotification() not invoked when returning](/forum/29-payment-methods/874415-onpaymentnotification-not-invoked-when-returning#187738 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.2 -- PHP version -- : 5.4.26 -- Browser(s) name and version -- : Firefox last -- Error-message(debug-mod must be tuned on) -- : None  Hi,  I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function. successUrl:   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  errorUrl :   www.mysitech/index.php?option=com&#95;hikash...der&#95;id=29&amp;Itemid=143  cancelUrl :   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console. My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process. Although message is notified to the user thanking them for their purchase. How's that even possible ?!?")*

Hi,

For payment log, you have to "echo" something during the notification to put it in the log (if you return correctly from the function).
The best is to use the function "writeToLog" (if you extends from the HikaShopPaymentPlugin interface) so you can easily put content in the payment log even if you put an "exit" or do an "$app-&gt;redirect".

I hope that it will help you to debug your plugin.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NzQ0MTUtb25wYXltZW50bm90aWZpY2F0aW9uLW5vdC1pbnZva2VkLXdoZW4tcmV0dXJuaW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")**
- [![franchsesko's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/35015-franchsesko "View franchsesko's Profile") Topic Author
- [ Offline](/forum/user/35015-franchsesko)

Less More

- Posts: 5
- Thank you received: 0
-
-

11 years 9 months ago [\#187870](#187870) by [franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")  Replied by *[franchsesko](/forum/user/35015-franchsesko "View franchsesko's Profile")* on topic *[onPaymentNotification() not invoked when returning](/forum/29-payment-methods/874415-onpaymentnotification-not-invoked-when-returning#187870 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.2 -- PHP version -- : 5.4.26 -- Browser(s) name and version -- : Firefox last -- Error-message(debug-mod must be tuned on) -- : None  Hi,  I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function. successUrl:   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  errorUrl :   www.mysitech/index.php?option=com&#95;hikash...der&#95;id=29&amp;Itemid=143  cancelUrl :   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console. My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process. Although message is notified to the user thanking them for their purchase. How's that even possible ?!?")*

Thanks Jerome,

I'm not quite at ease relying on "echo" to do anything in a class member, but I now understand why I saw these echo statements in the samples and why there was some kind of "history.&gt;data = ob_get_clean()" statements lying around, which were also a bit confusing.
So, I've stripped all "echo"s away and I use the history-&gt;data member to effectively store the provider error messages or meaningful response data.

I missed the "writeToLog()" function.
I use a custom made "debug_print()" function (along with a debug flag to switch it on/off, and other decorations), that opens a file in append mode, write to it and closes it on each call.
So I have my own debug log file system, and that's what I used to see if my member functions were invoked or not.
I'm going publish that piece of debug in a post on my blog (francescofoti.com) for anyone who may be interested.
I'll eventually use the writeToLog() function anyway in a future release, to comply with your guidelines.

And, we should be going live with my Datatrans payment plugin tomorrow (tada!); after testing with real credit cards, on the final customer website: [ www.selfbox.ch](http://www.selfbox.ch) (full https soon).

Btw, if you've got some sort of "certification" process for these kind of plugins, or a directory where I can list it, I'm interested, as I'm going to propose it on the market.

Thanks for your appreciated support.
Kind regards,
Francesco.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NzQ0MTUtb25wYXltZW50bm90aWZpY2F0aW9uLW5vdC1pbnZva2VkLXdoZW4tcmV0dXJuaW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

11 years 9 months ago [\#187904](#187904) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[onPaymentNotification() not invoked when returning](/forum/29-payment-methods/874415-onpaymentnotification-not-invoked-when-returning#187904 "-- HikaShop version -- : 2.3.5 -- Joomla version -- : 3.2 -- PHP version -- : 5.4.26 -- Browser(s) name and version -- : Firefox last -- Error-message(debug-mod must be tuned on) -- : None  Hi,  I send these urls to my payment provider, Datatrans, which are setup in the onAfterOrderConfirm() event function. successUrl:   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  errorUrl :   www.mysitech/index.php?option=com&#95;hikash...der&#95;id=29&amp;Itemid=143  cancelUrl :   www.mysite.ch/index.php?option=com&#95;hikas...der&#95;id=29&amp;Itemid=143  My payment provider then correctly redirects to these urls, and also posts transaction data, we can see that with the Firefox debug console. My problem is that in all cases, my plugin onPaymentNotification() never gets called, so I can't finish the process. Although message is notified to the user thanking them for their purchase. How's that even possible ?!?")*

Hi,

That's great !

We're listing all the payment plugins 3rd party developers provide in our "payment plugins" section of the documentation.
We'll be happy to add a link to your page presenting it once you have it online. Just drop us a line via our contact form:
[ www.hikashop.com/support/contact-us.html](https://www.hikashop.com/support/contact-us.html)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84NzQ0MTUtb25wYXltZW50bm90aWZpY2F0aW9uLW5vdC1pbnZva2VkLXdoZW4tcmV0dXJuaW5nP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.305 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
