Sample

Sample POST Form with (PHP)


    <php?
    /*
    This is a sample PHP script of how you would ideally integrate with  Payments Gateway

    ----------------------------------------------------------------------------------------------------
                ************(A.) INTEGRATING ***********************************************
    ----------------------------------------------------------------------------------------------------
    */
    //Data needed by  a fair share of it obtained from the user from a form e.g email, number etc...
    $fields = array("live"=> "0",
                    "oref"=> "87655",
                    "cn"=> "John Karis",
                    "amt"=> "900",
                    "tel"=> "256712375678",
                    "eml"=> "john@gmailo.com",
                    "curr"=> "KES",
                    "cb"=> $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"],
                    );
    /*
    ----------------------------------------------------------------------------------------------------
    ************(b.) GENERATING THE HASH PARAMETER FROM THE DATASTRING *********************************
    ----------------------------------------------------------------------------------------------------

    The datastring IS concatenated from the data above
    */
    $datastring =   $fields['live'].$fields['oref'].$fields['amt'].$fields['tel'].$fields['eml'].$fields['cc'];
    $hashkey ="XXXXXXXXXXXXXXXXX";//use provide secret key provide during registration

    /********************************************************************************************************
    * Generating the HashString sample
    */
    $generated_hash = hash_hmac('sha1',$datastring , $hashkey);

    ?>

       /*    Generate the form BELOW   */
           <form action="https://payments.pokeapay.com/">
            <?php
                 foreach ($fields as $key => $value) {
                     echo $key;
                     echo, \' :<input name="\'.$key.\'" type="text" value="\'.$value.\'"></br>';
                 }
                ?>


            <input name="hsh" type="text" value="<?php echo $generated_hash ?>">
            <button type="submit">  Pay  </button>

         </form>