j doe
j doe

Reputation: 1

Prestashop 1.7 Payment module

I am creating a credit card payment module for prestashop 1.7

I don't know how to send my post values on an external url and receive its response if the transaction is success or failed.

Upvotes: 0

Views: 2003

Answers (1)

Matt Loye
Matt Loye

Reputation: 1311

You have to make things like this :

  • Make a module (https://validator.prestashop.com/generator) and extend it with PaymentModule, not just Module.
  • Register interesting hooks (http://build.prestashop.com/news/module-development-changes-in-17/) and make a function like this in your module :

     public function hookHookName($params) {
       // Do things here
     }
    
  • Play with this Hook specially (first part is hook name and second are $params) :

    Hook::exec('actionValidateOrder', array(
       'cart' => $this->context->cart,
       'order' => $order,
       'customer' => $this->context->customer,
       'currency' => $this->context->currency,
       'orderStatus' => $order_status
    ));
    
  • Make calls (curl / file_get_contents for instance) on that moment before validating anything.
  • A good way to know how to do it could be to download Paypal Module (it's free) and see how they did it.

Upvotes: 3

Related Questions