Payment Plugin for ogone.com

  • Posts: 33
  • Thank you received: 0
13 years 1 month ago #26244

Hi,

I'm trying to do a payment plugin for ogone.com. In the last step of the webshop we need to submit a form with some hidden form fields (among others things like "currency", "amount", "language", "address", ...) to a url provided by them. What's the best way to get this done?

I've already looked into the php code of some other payment plugins, but I didn't find anything similar to the things that we need.

Thanks in advance for your support!

Best regards,
Martin Kasika

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 1 month ago #26249

Hi,

Most of the payment plugins that are available with HikaShop use that exact same technic.
For example, in the plugins/hikashoppayment/paypal.php, in the function onAfterOrderConfirm the $vars variable is loaded with all the values that you want to pass in your form. Then, in plugins/hikashoppayment/paypal_end.php all the values of that variable are added to the form which is displayed on the last step of the checkout.

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

  • Posts: 33
  • Thank you received: 0
13 years 1 month ago #26644

Hi nicolas,

thanks for that tip! I took the paypal plugin as a template and tried to change the relevant code lines to make it work with ogone.com

I changed the configuration file, which is now working perfectly well.

In the ogone.php / onAfterOrderConfirm method I replaced the section where it compiles the "vars" (key-value-pairs to be sent to paypal) with the variables that ogone.com is expecting. Unfortunately if I try it out and use the new plugin to pay for an order it just shows a blank page as step-5. It doesn't redirect me to the URL I specified in the configuration.

As I'm not used to code in php, I have no idea what's wrong. I would really appreciate it, if you could help me out here and attached my files to this post. Thanks in advance!

Best regards,
Martin

File Attachment:

File Name: ogone.zip
File Size:7 KB

Attachments:

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 1 month ago #26690

Hi,

In the function onAfterOrderConfirm, the variable
$pspid

should be
$method->payment_params->pspid

and
"CN"=> @$order->cart->$address_type->address_firstname." ".@$order->cart->$address_type->address_lastname,

should be:
"CN"=> @$order->cart->billing_address->address_firstname." ".@$order->cart->billing_address->address_lastname,

That fixes the blank page on my end.
Note that you should activate the errors display of php in your php.ini when developing in order to see such errors.

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

  • Posts: 33
  • Thank you received: 0
13 years 1 month ago #26707

Hi,

thank you for the answer, works perfectly. The plugin now redirects perfectly to the payment service provider. We now have to finish the progress, but we are looking forward to be done end of this week.

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

  • Posts: 33
  • Thank you received: 0
13 years 1 month ago #26717

Hi nicolas,

sorry to bother you again, but I have another question: Where can I find the callback URL for the payment provider?

They offer to send a POST request to our system so that we can update the order with the correct status. I think I did the php correctly and wanted to test it out, but I have no idea what url I need to set in my ogone.com account.

Best regards,
Martin

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
13 years 1 month ago #26720

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

Time to create page: 0.066 seconds
Powered by Kunena Forum