简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM