Skip to main content
Version: 1.0.6


Initialize the SDK#


These methods must be executed first before any other methods from BharatX's SDK is executed.

To identify who you are, share your partner ID and your API key using the following methods (simply use the ID and key given in the code for testing):

Your Android App
public class MainActivity extends AppCompatActivity {  @Override  protected void onCreate(Bundle savedInstanceState) {    // ...    BharatXStartupTierManager.initialize(this, "testPartnerId", "testApiKey");    // if you want the SDK to use a custom 'primary color' for seamless UI    BharatXStartupTierManager.initialize(this, "testPartnerId", "testApiKey", Color.parseColor("#FF0000"));    // or with a color resource    BharatXStartupTierManager.initialize(this, "testPartnerId", "testApiKey", ContextCompat.getColor(this, R.color.colorAccent));    // ...  }}

Configure fields separately#

You can configure the Partner ID, Partner API Key or Theme Color of the SDK separately, you can use the following helper methods:

Click to open


You've to execute any one of the initialize() methods in the previous section before using these methods. It is not optional.

Your Android App
// for Partner IDSecurityStorageManager.storePartnerId(this, "bharatx");
// for Partner API KeySecurityStorageManager.storePartnerApiKey(this, "testKey");
// for Theme ColorSecurityStorageManager.storeThemeColorPreference(this, Color.parseColor("#FF0000"));// or with a color resourceSecurityStorageManager.storeThemeColorPreference(this, ContextCompat.getColor(this, R.color.colorAccent));

Theming (optional)#


These methods must be executed before using the privacy policy or progress dialog section if you want the theme to be applied.

Custom Primary Color#

View the Initialize the SDK or Configure fields separately section to know how to change the theme color of the SDK so that it appears seamless in your app.

Custom Progress Dialog#

To set a custom layout for the progress dialog that is displayed:

Your Android App
public class MainActivity extends AppCompatActivity {  @Override  protected void onCreate(Bundle savedInstanceState) {    // ...    BharatXCommonUtilManager.setProgressLayout(R.layout.my_awesome_layout);    // ...  }}

Credit Notifications#


This is crucial for the BharatX ecosystem, and must be omitted in no way.

We need to send users notifications for specific purposes like repaying their credit. To enable that, place this in your login/dashboard activity:

Your Android App
public class MainActivity extends AppCompatActivity {  @Override  protected void onCreate(Bundle savedInstanceState) {    // ...    CreditAccessManager.register(this);    // ...  }}

Registering your user identification#


This method should be called as early as possible, even before the user clicks on the BharatX button. It should be called only after the "Configure the SDK" step.

Why do it?

Say your servers identify a person as ABC, and BharatX's servers identify the same person as PQR. When you communicate with us about ABC, we don't know which person you're talking about. This method is to solve that exact problem.

To register your user ID with us, use the following method:

Your Android App
String userId = // the ID you use to identify the user in your serversBharatXCommonUtilManager.registerUserId(this, userId);

User Banking Information (optional)#


Call this API before starting the "Confirm Transaction" from the app.

If the user's banking details are provided via the API, it will appear pre-filled when the user tries to set up e-Mandate with us, improving the UX of the user journey. This is an option that is often leveraged by our partners who have such data available (mainly Social Commerce, Financial Apps etc).

Your Server - Request
Headers:X-Signature: base64-encoded sha256(requestBody + privateApiKey)X-Partnerid: partnerId
Body:{  "userId": string, // user identifier in perspective of you  "userName": string,  "userAccountNumber": string,  "userIfscCode": string}
BharatX Server - Response
Body:{  "message": string}
Status = 200; message = "ok"Status = 400; message = "INVALID_INPUT"Status = 401; message = "AUTHORIZATION_FAILED"Status = 500; message = "INTERNAL_SERVER_ERROR"