Menu Close
    Hire us Request quote Reading list Switch to dark mode

    How to use payment api in Opencart

    In our previous blog : http://webkul.com/blog/use-cart-api-opencart/ , we learnt how to use cart api in opencart . Today we will learn , how use payment api in opencart  .

    Opencart uses the payment api in the payment details section while adding or editing the order from the admin end . After adding the product from the  sales->orders when we click the continue button , then it goes to the payment details section .

    After selecting or adding the payment address from the payment details section when we click the continue button . Two methods of payment api will be called : address and methods .

    The address method is used to set the payment address of order . The method validates the address values and if all values are following the norms then , it sets the address values into the session . Code of the address method is given below :


    If address is successfully saved in the session then , it returns the success message as the response .

    The second method is “methods” . The method is used to get the list of payment methods that can be applied to the particular order based on the payment address . The code of the method is given below:


    If method successfully fetch the available payment methods then it returns the list of available payment methods .

    In the payment api , there is one more method named “method” . The method is used to set the payment method that will be applied to the current order . Opencart uses this method in the last step of order creation from the admin end as shown below . The method is called when we click the apply button(placed at right side of payment method) .

    The code of the method is given below :


    If payment method is successfully applied , then it returns the success message as given below :

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just received your message and our expert will get back to you shortly.
    Send Again
    Close