Payment process in Prestashop is all about security and effectiveness. This is what makes it so special. Information on delivery addresses and bank cards should be protected to prevent fraud – and payment modules act like security guards in this case. Numbers, calculations and orders are payment modules’ business as well. So how does it work? Let’s find out.
As you know, all modules are inherited from the class Module, except for the payment modules. They are inherited from the abstract class PаymentMоdule, which in turn is inherited from the class Modules (inherits the installation, removal, encapsulates module properties etc).
The class PаymentMоdule possesses configuration methods of certain current payment module properties, for example: the permitted currency, the format of addresses and the list of the countries for which this payment module can be applied.
The payment module can have one of two currency settings:
- Checkbox – the module has the ability to work with multiple currencies;
- Radio – the payment is available in one currency only (applicable for the modules, designed for specific countries).
The method install of the class PаymentMоdule:
public function install()
// Insert currencies availability
if ($this->currencies_mode == 'checkbox')
elseif ($this->currencies_mode == 'radio')
Tools::displayError('No currency mode for payment module');
// Insert countries availability
$return = $this->addCheckboxCountryRestrictionsForModule();
Also, using this class you can get the list of all installed payment modules. There is a special static method for this purpose:
PaymentModule:: getInstalledPaymentModules() – List all installed and active payment modules.
But the main method of this class is vаlidаteOrder:
* Validate an order in database
* Function called from a payment module
* @param integer $id_cart Value
* @param integer $id_order_state Value
* @param float $amount_paid Amount really paid by customer (in the default currency)
* @param string $payment_method Payment method (eg. 'Credit card')
* @param string $message Message to attach to order
public function validateOrder($id_cart, $id_order_state, $amount_paid, $payment_method = 'Unknown',
$message = null, $extra_vars = array(), $currency_special = null, $dont_touch_amount = false,
$secure_key = false, Shop $shop = null)
This method verifies all benchmark data that was entered by customer, such as delivery addresses, bank cards numbers, also makes the calculations and creates an order.
2. Standard payment modules
The list of the standard payment modules is available in back-office in the section Modules -> Payment:
Standard payment modules:
- Allied Wallet
- Bank Wire
- Moneybookers Skrills
- Authorize.net (SIM)
- Cash on delivery (COD)
- Payment by check