Access of shipment options in payment plug-in

  • Posts: 45
  • Thank you received: 0
11 years 4 weeks ago #129561

I'm developing a payment plug in, in which the user authentication take place at the payment portal. There is no need for the user to log in to the webshop, just logging in to the payment portal is sufficient. The user credentials, such as address information, is returned by the payment portal.
I'm now about to implement the shipment selection options. The idea is to hand over all configured shipment options to the payment portal, the portal can then executes rules like zip-code to shipment cost calculations, and then the user may add his preferences as well (such as express shipments...).

For this to work, I would like to have acccess to the relevant shipment options. What is the neat way to get these in the payment plug-in code?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 4 weeks ago #129628

So I suppose that your code to send the parameters of the order to the payment gateway is in the onAfterOrderConfirm function right ?
In that function, you get the object $order in the first parameter. It contains all the details of the order, including the shipping method selected.
Simply do a var_dump on it to see which attribute you want to use.

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

  • Posts: 45
  • Thank you received: 0
11 years 4 weeks ago #129688

Hi Nicolas,

Thanks for the reply. Your advise is exactly what I've been doing. Unfortunately, until the customer logs on to the payment portal, there is no access to address information. Thus, any shipment rule that's dependent on address (or zip code) data, must be executed on the payment portal.
The payment portal is designed to do exactly that. You hand over your shipping options to the payment portal and off you go.

In the $order object, there is not a set of shipping rules accessible. Only after the selection of a shipping method, I can find the data about the selection.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 3 weeks ago #129905

Hi,

I'm not following you.
You say " Only after the selection of a shipping method, I can find the data about the selection." But isn't that logical ?
You would like to access the shipping method selected by the user before he selects it ? That's obviously not possible.

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

  • Posts: 45
  • Thank you received: 0
11 years 3 weeks ago #130658

Hi Nicolas,

The normal Hikashop flow is that the user supplies all sorts of details to the webshop, so that shipment methods can be selected. Thus, shipment address and billing address are known within the Hikashop context before the payment is initiated. The shipment method can then also be selected in this flow. You're right about that.

Now, I'm working with a payment portal (MultiSafePay Fast Checkout) that supports a different flow. The idea is to remove the need for the user to supply all sorts of details in the webshop, but instead keep this information in a profile at the payment portal. This is of course a completely different flow.

The idea is that after the cart is complete, the user is handed over to the check out counter at the payment portal. Different webshops may use the same payment portal and therefore the user may already have a profile at this portal. The user can then quickly pay for the cart and the payment portal will then share address details with the webshop.

This payment portal understands that shipment options are dependent on destination and so on. Therefore, the webshop needs to handover the potential shipping methods, plus the rules that go with these, to the payment portal so that the portal can execute the rules, select the appropriate shipping method and add the incurred costs to the bill. Also, the portal allows the user to select a shipping methods, when it comes to priority versus costs.

In order to make this all happen, I need to have access to the inventory of potential shipping methods. I hope that the above explains why such a thing would be advantageous to the webshop customer (fewer details to enter - reuse of his/her profile).

Thanks and regards, Paul

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 3 weeks ago #130674

Hi,

Ok, I see what you mean now. Thanks for the additional details.

So what you're saying is that you want to send to the payment gateway a list of all the manual shipping methods that you configured.
In that case, you can do that with this code:

$pluginClass = hikashop_get('class.plugins');
$rates = $pluginClass->getMethods('shipping');
$rates will be an array of all the shipping methods configured.

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

Time to create page: 0.076 seconds
Powered by Kunena Forum