1.2 How to use the library

NOTE: the transaction response will be sent to the call back url you provide. To process the call back data check on section 2
Assign the following variables with their corresponding values as shown below:

        String live             = "0";
        String vid              = "demo";
        String cbk              = "http://example.com/cbk.php";
        String security_key     = "demo";
        String amount           = "10";
        String p1               = "value1";
        String p2               = "value2";
        String p3               = "value3";
        String p4               = "value4";
        String curr             = "KES"; //or USD
        String phone_number     = "0700000000";
        String email            = "example@gmail.com";

     

Instantiate a Channels fragment and use it to pass the above parameters to your library in order to load the iPay Payment Interface.


        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        Channel fragment1 = new Channel();
        Bundle data = new Bundle();
        data.putString("live", live);
        data.putString("vid", vid);
        data.putString("cbk", cbk);
        data.putString("key", security_key);
        data.putString("amount", amount);
        data.putString("p1", p1);
        data.putString("p2", p2);
        data.putString("p3", p3);
        data.putString("p4", p4);
        data.putString("currency", curr);
        data.putString("phone", phone_number);
        data.putString("email", email);
        fragment1.setArguments(data);
        fragmentTransaction.add(R.id.layouta, fragment1, "fragment");
        fragmentTransaction.commit();

    
finally import the following:
        import com.libs.ipay.ipayLibrary.Channel;