Skip to content

LEMUBIT/PayantAndroid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

62 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PayantAndroid

Codacy Badge Maintainability CircleCI GitHub license

Payant Android can be used to access features on your Payant account dashboard.

For better understanding read the Payant API documentation before using this library.

Each of the major operations has a Manager Class in the PayantAndroid library, these managers are PayantClientManager, PayantInvoiceManager, PayantPaymentManager, PayantWalletmanager, PayantProductManager. These Manager Classes perform all needed operations that are performed on your dashboard, for instance the PayantClientManager Class can ADD, GET, EDIT, and DELETE a Client.

How to use

  1. Add JitPack to your build file.
allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}
  1. Add the Library dependency
dependencies {
     implementation 'com.github.LEMUBIT:PayantAndroid:1.1.0'
}
  1. Ensure that your app has internet permissions by making sure the uses-permission line below is present in the AndroidManifest.xml.
<uses-permission android:name="android.permission.INTERNET" />
  1. Initialize the SDK in onCreate.

The first argument is the Application Context while the second argument is a boolean value which is set to true when you are testing with a Live private key and set to false when you are using a Demo private key.

  Payant.init(getApplicationContext(),true);
  1. Set the private key.

Private key should be set after initializing the SDK.

   Payant.setPrivateKey("XXXXXXXXXXXX");
  1. Use Manager Classes

Use the manager Class of the operation you want to perform. For instance perhaps you want to get the information of a Client with ID 166, you would use the Client Manager's getPayantClient() method.

    PayantClientManager.getPayantClient(166, new PayantClientManager.OnGetPayantClientListener() {
           @Override
           public void onManagerResponse(PayantClientInfo payantClientInfo) {
               Toast.makeText(MainActivity.this, payantClientInfo.toString(), Toast.LENGTH_SHORT).show();
           }

           @Override
           public void onFailure(Throwable t) {
               Toast.makeText(MainActivity.this, t.getMessage(), Toast.LENGTH_SHORT).show();
           }
       });

In the sample above, the object PayantClientInfo contains the information of the Client whose info was requested.