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

#   How can I print a message from onPaymentNotificati

##

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

Less More

- Posts: 4
- Thank you received: 0
-
-

10 years 1 month ago -  10 years 1 month ago [\#249535](#249535) by [oby](/forum/user/43072-oby "View oby's Profile")  *[How can I print a message from onPaymentNotificati](/forum/29-payment-methods/886355-how-can-i-print-a-message-from-onpaymentnotificati#249535 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.2 -- Browser(s) name and version -- : Firefox 48.0.2 -- Error-message(debug-mod must be tuned on) -- : None  As a requirement of a custom payment plugin I am develping for Hikahop, I need to print a message from onPaymentNotification function to the default cancel url. I placed the following code in the onPaymentNotification function of Hikashop. The codes in the two conditions work fine as required, but the echoed message in line 15 does not display of the cancel&#95;url when condition for cancel is met. I am using the defualt cancel url as shown in line 15")* was created by *[oby](/forum/user/43072-oby "View oby's Profile")*

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.2
-- Browser(s) name and version -- : Firefox 48.0.2
-- Error-message(debug-mod must be tuned on) -- : None

As a requirement of a custom payment plugin I am develping for Hikahop, I need to print a message from onPaymentNotification function to the default cancel url.
I placed the following code in the onPaymentNotification function of Hikashop. The codes in the two conditions work fine as required, but the echoed message in line 15 does not display of the cancel_url when condition for cancel is met. I am using the defualt cancel url as shown in line 15
Code:

if ($Response_Code==="00") { if ($Amount==$amt) { $this-&gt;modifyOrder($order_id, $this-&gt;payment_params-&gt;verified_status, true, true); $this-&gt;app-&gt;redirect($return_url); return true; } } elseif ($Response_Code!=="00") { //This function modifies the order with the id $order_id, to attribute it the status invalid_status. $this-&gt;modifyOrder($order_id, $this-&gt;payment_params-&gt;invalid_status, true, true); echo "The response code is: ".$Response_Code; $this-&gt;app-&gt;redirect($cancel_url); // $cancel_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&amp;ctrl=order&amp;task=cancel_order&amp;order_id='.$order_id.$this-&gt;url_itemid; return false; }

Last edit: 10 years 1 month ago by [Jerome](/forum/user/80-jerome "View Jerome's Profile"). Reason: [code] is nice

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84ODYzNTUtaG93LWNhbi1pLXByaW50LWEtbWVzc2FnZS1mcm9tLW9ucGF5bWVudG5vdGlmaWNhdGk/dG1wbD1tYXJrZG93bg==) 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: 86289
- Thank you received: 14265
-
-

10 years 1 month ago [\#249548](#249548) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How can I print a message from onPaymentNotificati](/forum/29-payment-methods/886355-how-can-i-print-a-message-from-onpaymentnotificati#249548 "-- HikaShop version -- : 2.6.4 -- Joomla version -- : 3.6.2 -- Browser(s) name and version -- : Firefox 48.0.2 -- Error-message(debug-mod must be tuned on) -- : None  As a requirement of a custom payment plugin I am develping for Hikahop, I need to print a message from onPaymentNotification function to the default cancel url. I placed the following code in the onPaymentNotification function of Hikashop. The codes in the two conditions work fine as required, but the echoed message in line 15 does not display of the cancel&#95;url when condition for cancel is met. I am using the defualt cancel url as shown in line 15")*

Hi,

I see two issues with your code:
1. You do a redirect after displaying the message. So even though that message is added to the display buffer of PHP, the buffer is dumped by PHP when it does the redirect. Thus, it's normal nothing is displayed.
2. The onPaymentNotification function's displayed elements are automatically retrieved from the display buffer and stored in the payment log file (that you can access in the HikaShop configuration) when the onPaymentNotification function returns, so even if you remove the redirect, your message would only go in the payment log file. You would have to create a new buffer with the ob_start(); function before returning.
3. The onPaymentNotification function is usually called by the payment gateway, and in that case what you'll display in it will returned to the payment gateway, not the customer, and thus he won't see the message. That however, is not always the case (even thought it is for most payment gateways).

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI5LXBheW1lbnQtbWV0aG9kcy84ODYzNTUtaG93LWNhbi1pLXByaW50LWEtbWVzc2FnZS1mcm9tLW9ucGF5bWVudG5vdGlmaWNhdGk/dG1wbD1tYXJrZG93bg==) 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.124 seconds

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

[](#top)
