Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
i application contain payment gatway how to connect it with fuelphp
  • my application contain payment gatway that is payzippy , they have provide with their API, I can install that api in normal php coding but i dont no how to connect it fuelphp,
    Is their any place in fuelphp where we can add third part API in t your system an use it in fuelphp,
    Just like package in we use .like mustache, oauth etc
  • The API is the interface of the service, so that is on the service provider side, in this case PayZippy. You application is the service client, that needs to talk to the API.

    To be able to do that, you often need libraries, like the PayZippy SDK. These are just plain and simple classes. To make it portable or reusable, create a package for it (let's call it payzippy):

    Put the SDK files (https://github.com/payzippy/php-sdk/tree/master/payzippy-sdk) in payzippy/classes/sdk, then give the package a bootloader.php, and in there define all classes, like so:

    Autoloader::add_classes(array(
        'ChargingRequest'  => __DIR__.DS.'classes'.DS.'sdk'.DS.'ChargingRequest.php',
        'ChargingResponse' => __DIR__.DS.'classes'.DS.'sdk'.DS.'ChargingResponse.php',
    ));

    and like so, add all classes to it that you need from the SDK.

    After that, load the package in your controller, and you can use any of these classes. How is probably in the payzippy docs.
  • i have uploaded the sdk and unzipping it i have save the classes in to folder as given below
    \fuel\core\classes\payzippy . i have save the file in this folder and mention the path as given below

            Autoloader::add_classes(array(
                                            'ChargingRequest'  => __DIR__.DS.'classes'.DS.'payzippy'.DS.'ChargingRequest.php',
                                            'ChargingResponse' => __DIR__.DS.'classes'.DS.'payzippy'.DS.'ChargingResponse.php',
                                           ));

    in the file bootstrap.php in core/classes folder :
    can u tell me how to call in the fuelphp controller or how it is invoke i have no idea in that..
    Please Help me out in this..
    my app is in final stage of impletation.
  • NOOOOO....

    I wrote: create a package (and lets call it payzippy). You should NEVER put anything in a fuel supplied folder, or change any of the fuel supplied files.

    Check the docs on what a package is and how you use it: http://docs.fuelphp.com/general/packages.html

    There are plenty of ready-made packages at https://github.com/fuel-packages, if you want to see what a package looks like.
  • ok fine i have undo my work and 
    created an package in package folder with of fuel 
    with that i alos created the bootstrap.php liek and include the file and added the code in to is 
     'ChargingRequest' => __DIR__ .'/classes/ChargingRequest.php',
            'ChargingResponse' => __DIR__ . '/classes/ChargingResponse.php',

    now will extend in controller i just have to extend the  ChargingRequest and invoke the function right

  • HarroHarro
    Accepted Answer
    Don't ask me how the PayZippy SDK works, I've never seen it before (today). Check the SDK manual to see how you should use it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion