Question

A client of us has developed a payment gateway, similar to PayPal. He wants a module for Prestashop, for making clients to be able to pay through it.

He wants to modify the original checkout process. For example, if the user introduces a concrete postal code, the only available way to pay must be his payment gateway. Is it possible? I don't know exactly if this is allowed by the Prestashop API or even if this can be done.

Thanks in advance!

Was it helpful?

Solution

Yes it is possible. You just have to create a specific payment module with the good Hook.

OTHER TIPS

The best solution maybe is to create your own payment module, You could easily extend the PaymentModule class and create your own with your own logic.

Make a custom module
see Creating a payment module official documentation

When you extend the PaymentModule you inherit all from the parent class, so you could add your new methods or override the inhereted ones.
Fortunally that abstract class doesn't have abstract methods, that means that just extending it you will have all the basic payment behaviour pre built in.

Source of the PaymentModule

Hooks
In the offical documentation about creating a payment module there is a mention for making some hooks:

  • payment: to display the payment method.
  • paymentReturn: to display the payment confirmation.

making that hooks is simple, just define inside your custom payment class methods named hookPayment and hookPaymentReturn.

Hooks in Prestashop

Others useful links
You could also have a look of some famous payment module like Paypal, to understand better how it works and having some thinking about your module.

Prestashop Paypal Module source

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top