Here is how to implement a PayPal-like payment gateway.
The workflow for a payment gateway like this is:
To implement your own payment gateway (let's call it NewGateway), create in folder [Joomla dir]/administrator/components/com_mediamallfactory/payment/gateways the following directories and files:
In order to fully understand how to implement a new gateway, please check the code for the gateways that are already implemented.
In the template file you can use the $this→getOrder('variable_name') to get information regarding the order like:
This html form will be displayed to the user after selecting the membership he/she wants to purchase.
After submitting this form, the user will be redirected to the payment's page to actually make the payment.
Different options for the payment gateway can be configured using the settings file, which is an xml file.
The file should contain a regular and valid Joomla form.
It should contain only a class with the name format: FactoryPaymentGatewayNewGatewy and it should extend the FactoryPaymentGateway.
This class should contain a method named step1 that has one parameter that contains information about the membership the user wants to purchase.
Inside the method the order should be created using the $this→createOrder($data) call and then the template displayed using the $this→render() call.
To process the notification received from the payment gateway, the function processNotification() must be implemented.
This function should create a new payment notification using the $this→getNewPaymentNotification() and return it.
Depending if the payment was successful or not, you need to set the notification status and errors. If the payment has failed,
the order will be marked as failed and no credits will be added to the user's account. If the payment is successful,
then the credits will be added to the user's account.