Integration Docs

Comprehensive guide and documentation to help you start working with smallcase Gateway

Get Started

Android Integration

Smallcase gateway android sdk is available as private gradle dependency.

Integration

step 1 - Include dependency in app level gradle file.

dependencies {
    implementation 'com.smallcase.gateway:sdk:$version'
}

Replace $version with the latest version available.
Eg - Current version is 2.0.9

Step 2 - Include maven repository url and authentication details in app level gradle file.

repositories {
    maven {
        url "http://artifactory.smallcase.com/artifactory/gradle-dev-local"
        credentials {
            username "${artifactory_user}"
            password "${artifactory_password}"
        }
    }
}

Replace "${artifactory_user}" and "${artifactory_password}" with user name and password which is given to all integration partners.

Step 3 - Include intent filter in android manifest file.

<activity android:name="com.smallcase.gateway.screens.transaction.activity.TransactionProcessActivity">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data
                    android:host="{YOUR_HOST_NAME}"
                    android:scheme="scgateway" />
            </intent-filter>
</activity>

Replace "{YOUR_HOST_NAME}" with unique host name which is given to every integration partners.

Setting up sdk for a transaction.

To start using gateway setup the gateway with the desired configuration by calling setConfigEnvironment method which is available as a static method of SmallcaseGatewaySdk class.

SmallcaseGatewaySdk.setConfigEnvironment(environment,object : SmallcaseGatewayListeners {
  override fun onGatewaySetupSuccessfull() {
    //Initialise user
  }

  override fun onGatewaySetupFailed(error: String) {
    //Retry 
  }
})
SmallcaseGatewaySdk.INSTANCE.setConfigEnvironment(environment,
                                                  new SmallcaseGatewayListeners()
{
  @Override
  public void onGatewaySetupSuccessfull() {
    //Initialise user
  }
  
  @Override
  public void onGatewaySetupFailed(String error) {
     //Retry 
  }   
});

To setup, create a config object conforming to Environment object. Configuration defines the settings to be used by the gateway.

class Environment(
    val buildType: Environment.PROTOCOL,
    val gateway: String,
    val isLeprachaunActive: Boolean,
    val preProvidedBrokers: List<String>
) {
    enum class PROTOCOL {
        PRODUCTION,
        DEVELOPMENT,
        STAGING,
    }
}

Params :

buildType - (Required) This defines the Url environment to which all the gateway apis would point to Possible values
gateway - (Required) This is a unique name given to every gateway consumer
Eg : moneycontrol
preProvidedBrokers - (Required) If you want to support only certain brokers, default all brokers are shown if empty list is passed
Values - [fivepaisa, aliceblue, edelweiss, hdfc,iifl, trustline, kite]
isLeprachaunActive - (Required) For Testing purpose only. Default value is false

📘

Note

Call setConfigEnvironment every time there is any change in the setup.
setConfigEnvironment must be the first method to be fired.If setup is not called all other methods will not work.
Init sdk onGatewaySetupSuccessfull callback.
Retry setConfigEnvironment onGatewaySetupFailed.

User Initialisation

User initialization starts a session between the distributor and the gateway. Whenever there is a change in user session, This method needs to be triggered . In case, the value of

SmallcaseGatewaySdk.init(InitRequest("YOUR SMALLCASE AUTH TOKEN"),
                                        object :DataListener<InitialisationResponse> {
    override fun onSuccess(authData: InitialisationResponse) {
      
    }
                                          
    override fun onFailure(errorCode: Int, errorMessage: String) {
    }
})
SmallcaseGatewaySdk.INSTANCE.init(new InitRequest("YOUR SMALLCASE AUTH TOKEN"),
                                  new DataListener<InitialisationResponse>() 
{
     @Override
     public void onSuccess(InitialisationResponse response) {
     }
  
     @Override
     public void onFailure(int errorCode, String errorMessage) {
     }
});

Params :
sdkToken : (Required) JWT with the information of user signed using a shared secret between smallcase API and gateway backend.
gatewayInitialisationListener - (Required) After onSuccess any transaction can be triggered.
After onFailure sdk should be reinitialised.

\* Guest User *\
 { 
      "guest": true
 }
           
\* Connected User *\
{ 
    smallcaseAuthId :"5c4f0b6a0cbd7d332bae9c92"
}

Data encoded in sdkToken can be of the above structure.

Trigger Transaction

To start a transaction call triggerTransaction method which is available as a static method of SmallcaseGatewaySdk class.

SmallcaseGatewaySdk.triggerTransaction(activity
                                       ,transactionId,
                                       object : TransactionResponseListener
{
  override fun onSuccess(transactionResult: TransactionResult) {
  }
    override fun onError(errorCode: Int, errorMessage: String) {
  }
})
SmallcaseGatewaySdk.INSTANCE.triggerTransaction(this,
                                                transactionId,
                                                new TransactionResponseListener()
{
            @Override
            public void onSuccess(TransactionResult transactionResult) { 
            }
 
            @Override
            public void onError(int errorCode, String errorMessage) {
            }
});

Params :

activity - (Required) Current activity reference.
transactionId - Transaction id to create a the transaction.

📘

Note

TransactionId creation process remains same using Gateway backend APIs.
Read more about transaction Id at Creating Transactions

Lead Gen

To trigger lead gen flow call triggerLeadGen method which is available as a static method of SmallcaseGatewaySdk class.

SmallcaseGatewaySdk.triggerLeadGen(requireActivity(),params)
SmallcaseGatewaySdk.INSTANCE.triggerLeadGen(requireActivity(),params);

Params :

activity - (Required) Current activity reference.

val params =  HashMap<String,String>()
params.put("name","NAME OF USER") 
params.put("email","EMAIL OF USER")
params.put("contact","CONTACT NUMBER OF USER")
params.put("pinCode","PIN CODE OF USER")
HashMap<String,String> params = new HashMap<String,String>();
params.put("name","NAME OF USER"); 
params.put("email","EMAIL OF USER");
params.put("contact","CONTACT NUMBER OF USER");
params.put("pinCode","PIN CODE OF USER");

params - (Optional) pass user information in a hashmap or null if no user information is passed.

Updated 17 days ago

Android Integration


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.