简体   繁体   English

Prestashop 1.7付款模块

[英]Prestashop 1.7 Payment module

I am creating a credit card payment module for prestashop 1.7 我正在为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. 制作一个模块( https://validator.prestashop.com/generator )并使用PaymentModule扩展它,而不仅仅是Module。
  • Register interesting hooks ( http://build.prestashop.com/news/module-development-changes-in-17/ ) and make a function like this in your module : 注册有趣的钩子( http://build.prestashop.com/news/module-development-changes-in-17/ ),然后在您的模块中创建如下函数:

      public function hookHookName($params) { // Do things here } 
  • Play with this Hook specially (first part is hook name and second are $params) : 专门使用此挂钩(第一部分是挂钩名称,第二部分是$ 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. 在验证任何内容之前,先拨打电话(例如,curl / file_get_contents)。
  • A good way to know how to do it could be to download Paypal Module (it's free) and see how they did it. 知道如何做的一个好方法是下载Paypal模块(它是免费的)并查看他们是如何做到的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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