Tuesday, April 8, 2014

The Payment module [Describing The Code of Extensions]

Payments.
Now you can also make the Payment module similar to the Shipping module. While making the Payment module, we have to work out in the Payment folder.
Before starting to write a payment module, you need to know the on-site payment and off-site payment, which are the broad categories of the payment methods.

Off-site payment

Off-site payment means making payment to the payment service by redirecting to the payment service website and making the transaction; upon success or failure, they are returned back to the relevant pages. If payment is successful, it shows the success page, else it will show the failure message.
Some of the off-site payment modules are: PayPal Standard, Moneybookers, LiqPay, PayPoint, and so on.
If you are using the off-site payment, choose one of the off-side payment modules of OpenCart and then clone your desired Payment modules.

On-site payment

Payments are made on the same site with on-site payment; it means the customer never leaves your site to make the payment. Some of the on-site OpenCart payment modules are: Authorize.net AIM, PayPal Pro, SagePay Direct, and so on.
If using on-site payment, it is suggested to have the SSL certificate and SSL enabled on the setting in OpenCart.
If you are using on-site payment, choose one of the on-site payment modules and clone it and make your desired module.
Most of the code will be the same, only the controller file, catalog and some time view template forms need to be changed while creating the Payment modules.

The Order Total module

Order totals are those modules which affect the total price of the order. You can find the list of order totals at Admin | Extensions | Order Totals. Some of them are:
        Coupon: This option allows the customer to apply the coupon discount
        Store Credit: If you have store credit, it automatically decreases the total purchase cost with the available credit


        Handling Fee: This option provides an additional fee for handling the product
        Low Order Fee: This option provides extra cost if the customer orders the minimum specified quantity
        Reward Points: Points are accumulated which can be used to buy reward points products
        Sub-Total: This option shows the subtotal separately
        Taxes: This option shows taxes separately
        Total: This option shows the total amount to be billed
        Gift Voucher: This option is used to gift credit to purchase the products
When they are applied, there is a change in the Total value, so they are placed on the Order Totals module. You will be able to see the Order totals module in the next chapter. We will show you how to create the Order totals modules. We will go in depth with the Tips Order Total module, as when someone likes to add Tips, there is an increase on the order total.

Summary

In this chapter, we explored most of the system level libraries that OpenCart provides. We explored most of the extra code used in the Featured Product module by which you are now able to know the code flow of the OpenCart module. Likewise, we created a new Shipping module, which shows the shipping cost according to the total cost purchased by cloning the weight-based shipping. Similarly, we discussed the payment module of OpenCart and the ways to clone it. With this, you are able to start coding with OpenCart Extensions (ModulesPayments, and Shipping).

No comments:

Post a Comment