Sagar V. Sagar V. - 6 months ago 454
Android Question

Citrus Payment Gateway Android integration

I have to integrate Citrus Payment gateway into my android app, Any help will be appreciated.
website here
Thank you in advance.

Answer

Citrus has provided with some really simplified developer's guide for efficient technical integration. Lets walk through the sample Net banking integration.Remaining steps can be found over The Citrus Developer's Guide.

  1. Secret Key
  2. Access Key
  3. SignIn Key
  4. SignIn Secret
  5. SignUp Key
  6. SignUp Secret
  • Download the kit from - Example and Citruslibrary. Add Citruslibrary as a dependency to Example. From Github.

    git clone https://github.com/citruspay/open-android-v2.git

  • Have a look at the init function. You can set the keys with citrus config.

    private void init() 
     {
          Config citrus = new Config();
          citrus.setEnv("sandbox"); //replace it with production when you are ready
          citrus.setupSignupId("merchant-signup");
          citrus.setupSignupSecret("3e2288d3a1a3f59ef6f93373884d2ca1");
          citrus.setSigninId("merchant-wallet");
          citrus.setSigninSecret("c40798d3c12114b5bb19f2051d9ed181");
     }
    
  • Get the bill from your server.Collect user details.Call the charge API.

       private void cardpay(String bill_string) 
      {
          Bill bill = new Bill(bill_string);
          Card card = new Card("4111111111111111", "11", "21", "000", "Tony Stark", "debit");
          UserDetails userDetails = new UserDetails(customer);
          PG paymentgateway = new PG(card, bill, userDetails);
          paymentgateway.charge(new Callback() 
              {
                     @Override
                     public void onTaskexecuted(String success, String error) 
                     {
                           processresponse(success, error);
                     }
              }
          });
       }
    
  • Calling charge with Netbanking

     private void bankpay(String bill_string)
    {
      Bill bill = new Bill(bill_string);
      Bank netbank = new Bank("CID002");
      UserDetails userDetails = new UserDetails(customer);
      PG paymentgateway = new PG(netbank, bill, userDetails);
      paymentgateway.charge(new Callback()
          {
               @Override
               public void onTaskexecuted(String success, String error) 
                   {
                        processresponse(success, error);
                   }
          });
       }
    
Comments