EShop supports multiple payment plugins. After being installed, the payment plugins are stored in the folder components/com_eshop/plugins/payment.
Following are steps to create a payment plugin for EShop:
Step 1: Create a .xml file to define the plugin package (example os_paypal.xml) with the structure as following:
Step 2: Create a .php file to put the code to process the payment (example os_paypal.php):
// Each payment plugin is defined as a class which is extended from parent class os_payment
class os_paypal extends os_payment
{
* Constructor functions, init some parameters which are used in the payment method
*
* @param object $config to include parameters are defined in the xml file
*/
public function __construct($params)
{
// Put the code here
}
/**
* This function to process payment
*
* @param array $data include all of information of processing order as an array
*/
public function processPayment($data)
{
// Put the code here
}
/**
* This function to verify payment
*
*/
public function verifyPayment()
{
// Put the code here
}
}
Step 3: Make a zip package include 2 above files, then login to the back-end of your site, go to EShop -> Plugins -> Payments to choose the zip package of payment plugin and install it from there.
To develop your own payment plugin easily, you should based on the source code of the default payment plugins in EShop.