onPaymentNotification method
I created new custom payment plugin and my bank work with curl I can Successfully redirect to my bank and Successfully payment but when callback from bank to my site only back to this link:
index.php?option=com_hikashop
and not change my order status only show default status in my order list my transaction add in my bank Successfully but in my site no change status to confirm I think onPaymentNotification problem with curl method and I am using curl for verify my payment. this is my onPaymentNotification method:
I checked my order report from backend and it's empty. Please help me thank you.
Please Log in or Create an account to join the conversation.
- Posts: 12953
- Thank you received: 1778
Your issue is coming from your "callback URL" you should use a URL which will call the "OnPaymentNotification" function of your payment plugin, to do that you'll have to use that kind of URL :
Please Log in or Create an account to join the conversation.
But I have callback URL and it's in onAfterOrderConfirm method it's this is:
my onAfterOrderConfirm work and it's code this is:
it's my Callback url
Please Log in or Create an account to join the conversation.
I think that the problem is on this line:
curl_setopt($ch,CURLOPT_POSTFIELDS,"api=$api&amount=$amt&redirect=$callBackUrl");
If you do that it won't work as the URL need to be encoded.
See this for more information on your issue:
stackoverflow.com/questions/1163421/how-...rl-value-in-curl-php
Please Log in or Create an account to join the conversation.
I'm use urlencode methode and now my callback work and back form bank to this link:
index.php?option=com_hikashop&ctrl=checkout&task=notify¬if_payment=mybank&tmpl=component&lang=en&Itemid=251
but my page now is blank and hasn't data and not change my payment status.
Please check my onPaymentNotification method from my first post to this topic I think this part not work
Please Log in or Create an account to join the conversation.
Please try:
Please Log in or Create an account to join the conversation.
I found problem in my onPaymentNotification method in this method $this->payment_params is empty and return false
now it's work but email not send after verify my email code this is:
Please Log in or Create an account to join the conversation.
Make sure that you have such line before calling the modifyOrder function:
$history = 1;
Please Log in or Create an account to join the conversation.
I'm add $history = 1; but sending email not work yek my code is:
Email sending only when order created
Please Log in or Create an account to join the conversation.
Sorry, I wanted to say that code in my previous message:
$history = true;
Please Log in or Create an account to join the conversation.
Tank you dear Nicolas but I tested before this code and not send yet
Please Log in or Create an account to join the conversation.
The "modifyOrder" function is there to help the modification of the order (change his order status, attach some history data and send an email).
In your code, you save the order object using the order class and you're also using the modifyOrder function.
So, your updating the order too many times, for the same content.
Please just use the "modifyOrder" function and do not use the "$orderClass->save" function unless you really need to.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
thank you
I can send email by this code:
for example with this code not change email subject and send with only default data:
Please Log in or Create an account to join the conversation.
I'm sorry but I don't understand what is your question here.
Please Log in or Create an account to join the conversation.
sorry dear nicolas
I want add my bank transaction id into my email but can't add it.
email only send whit hikashop default value
Please Log in or Create an account to join the conversation.
$email->body = JText::sprintf("Hello,\r\n A Postfinance notification was refused because the response from the Post finance server was invalid")."\r\n\r\n".$order_text;
to:
$email->body = JText::sprintf("Hello,\r\n Payment received with bank transaction id:".$transaction_id)."\r\n\r\n".$order_text;
Please Log in or Create an account to join the conversation.
I tested your code before and now test again but it's not work.
when use this code: $history->notified = 1; email send and it's send only with default hikashop data
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
user details
order details
but I want send with email my custom data too. but not send my bank transaction id when add it to my email body text.
I don't know what is problem
Please Log in or Create an account to join the conversation.
I thought that you wanted to send a notification in a payment plugin you're developing, then I thought that you wanted to add the transaction id in the notification email that you added in that new payment plugin. And now you're telling me that you don't want to send the transaction id but send custom data.
What custom data do you want to send ?
In which email exactly do you want to add it ?
Please provide precise information on what you want to do so that we can provide precise information on how to do it.
Please Log in or Create an account to join the conversation.