SagePay South Africa / Netcash - Custom Plugin

  • Posts: 152
  • Thank you received: 1
10 years 2 months ago #173018

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3

Hey Guys,

Please help me, I'm 99% of the way on the custom development of the SagePay South Africa plugin. In SA we need a service key generated in the merchant account - which I now have - but I also need a accept and decline url. What would that be?


Believe in Better

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
10 years 2 months ago #173021

Hello,
1.
Regarding the "service key generated in the merchant account" the solution will just be to directly create an option through your SagePay configuration page.
2.
For the Accept and Decline url, you can also create option or use a code like this to directly form the accept/decline urls :

$notify_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment=sagepay&tmpl=component&lang='.$this->locale . $this->url_itemid;
$return_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id='.$order->order_id . $this->url_itemid;
$cancel_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id='.$order->order_id . $this->url_itemid;
You'll find that example on the Paypal.php file of the PayPal plugin.

Last edit: 10 years 2 months ago by Mohamed Thelji.

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 1
10 years 2 months ago #173347

It seems I need to supply the accept and decline URLs to sagepay. Here is what they have said on their site:

Specify the payment options you require on application for the service. (Additional payment options can be added or removed at any time by request via your account manager)
Sage Pay will issue a Pay Now service key and make the payment options available on your Sage Connect profile.
Log in to your Sage Pay account and set the Sage connect profile.
Develop the form POST on your system to send the payment instruction to paynow.sagepay.co.za/site/paynow.aspx
Develop the Approve and Decline URLs on your system.
A logo pack with the “Pay Now Button” is available from Sage Pay Marketing – please request this from This email address is being protected from spambots. You need JavaScript enabled to view it.

So for me it means I need to know what those URLs will look like. For example
Accept = www.mysite.co.za/accept-url.html
Decline = www.mysite.co.za/decline-url.html

Could you help me out with something like that?


Believe in Better
Last edit: 10 years 2 months ago by nowherenowhere.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
10 years 1 month ago #173350

Hi,

Both should be:
www.mysite.co.za/index.php?option=com_hi...t&lang=en&Itemid=XXX where XXX is the id of the menu item on the checkout.
Then, at the end of the onPaymentNotification function of your plugin you probably need to redirect the customer to the thank you URL: www.mysite.co.za/index.php?option=com_hi...er_id=YYY&Itemid=XXX where XXX is the id of the menu item on the checkout and YYY the order_id of the current order.

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 1
10 years 1 month ago #173396

Hi Nicolas,

Ah okay, is this like if I say force menu on checkout? and then go menu manager > menu > new item (any type) and then in hika config set that item as the forced menu item . then notify the payment gateway peeps that

www.mysite.co.za/index.php?option=com_hi...t&lang=en&Itemid=XXX where XXX is the id of the menu item on the checkout. (my new item (any type) ID)

Okay I think that makes sense let me try it

Tx


Believe in Better

Please Log in or Create an account to join the conversation.

  • Posts: 152
  • Thank you received: 1
10 years 1 month ago #173727

Hi Nicolas,

We still seem to be having a problem here with the URL. seems that the payment gateway - doenst accept a URL like this for the accept and decline. Would it be possible to get a more friendly one?

So instead of this:
website.co.za/index.php?option=com_hi...t&lang=en&Itemid=258

this:
website.co.za/accept-payment.html


Believe in Better

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 1 month ago #173990

Hi,

You can use the plugin options to set the confirm url and the cancel url.
The user will be redirected to the "ugly" one but HikaShop will perform his actions and redirect the customer to the nice urls (depending the order status).

Regards,


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

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
10 years 1 month ago #174648

Hi Jerome,

Do I understand correctly:

I create the fields in the plugin for cancel/decline url and Accept/return url and then save/set the nice url in that field e.g. mysite.co.za/accept_payment.html . Does this let Hikashop listen to that url? Because I have to set the same url in the payment gateway options in sage pay now configuration. I think the notification calls coming back from sage pay now will go to either of the two url's?
I have mysite.co.za/accept_payment.html set as Accept url on sagepay configuration and mysite.co.za/accept_payment.html in admin plugin form field.

Regards,

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
10 years 1 month ago #174798

Hi, how did you get past this point? - I think I am having the same problem with coding my plugin for sagepaynow.

In testing the plugin I get access to the sagepaynow welcome screen - choose the mastercard/visa option, but when I click on Pay now - I get no further action. I don't know if I have the correct accept decline url set up on my Sage Account profile. Currently it is hikashop.mediax.co.za/accept-payment.html and hikashop.mediax.co.za/decline-payment.html. I would really appreciate your assistance or advice.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
10 years 1 month ago #174840

Hi,

As I said, you want to tell your payment gateway to go to the URL www.mysite.co.za/index.php?option=com_hi...t&lang=en&Itemid=XXX where XXX is the id of the menu item on the checkout.
That way, the onPaymentNotification function of your sagepay payment plugin will be called and if coded properly, it will confirm there the order status if the payment is valid.
Payment plugins cannot listen to other URLs.

The following user(s) said Thank You: mediax

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
10 years 1 month ago #174910

Hi, Sage Pay Now does not accept any special characters in the url string for decline or accept url. It has to be a clean url. How do you get pass that? :sick: }

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
10 years 1 month ago #174963

Hi Guys,

I have now added the Accept URL on SAGEPAY as mysite.co.za/accept-payment/checkout.html after creating a hidden menu link to the checkout page - ID116

I am also sending the Notify_url as a variable with the transaction in (M10 - SAGE PAY NOW Customfield) -> of the array going as post data, this is appended to the accept url on return. When returned my URL looks like this: mysite.co.za/accept-payment/checkout.htm...t&lang=en&Itemid=116

My Notification script executes and the transaction is logged as verified in admin. The Return page though is blank - > what have I missed here? onpaymentnotification -> do I have to redirect the page somewhere from here or do I use another class to redirect the user to a thank you page?

Any help here would be appreciated, thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
10 years 1 month ago #175033

Hi,

By default the payment notification URL will display a blank page since it has nothing to display to the payment gateway.
As I said previously, in your case, you want to redirect the user to the thank you URL at the end of the onPaymentNotification function with this URL : www.mysite.co.za/index.php?option=com_hi...er_id=YYY&Itemid=XXX
And then the system will take into account the return URL parameter of your payment plugin and do a second redirect to it.
This allows HikaShop to do some processing in the after_end controller like clearing some user session stuff which should be cleared.

The following user(s) said Thank You: mediax

Please Log in or Create an account to join the conversation.

  • Posts: 8
  • Thank you received: 0
10 years 1 month ago #175094

Thanks Nicolas for your assistance - I have now managed to complete the cycle on return and cancel url's and have a working sagepaynow payment plugin.

Please Log in or Create an account to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum