Integration Docs

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

Get Started

Cordova Integration

Cordova plugin is available as a private npm package on gitlab.

Integration

step 1 - To integrate plugin run this command using cordova CLI.

cordova plugin add https://gitlab.com/smallcase/mobile/gateway/gateway-sdk-cordova.git#release-2.0.3

📘

Note

Version can be changed according to the latest available version.

step 2 - Add redirect params to config.xml

<config-file target="AndroidManifest.xml" parent="/manifest/application">
   <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="${GATEWAY_NAME}"
                   android:scheme="scgateway" />
           </intent-filter>
       </activity>
   </config-file>

Add this on your top level config.xml file.

📘

Note

Add your gateway name in place of ${GATEWAY_NAME}.

Setting up sdk for transaction

To start using the gateway setup the gateway with the desired configuration.

scgateway.setConfigEnvironment(
function(data){//Success callback required},
function(error){//Failure callback required},
ENVIRONMENT,//For selecting a particular environment.
GATEWAY_NAME,//Replace with your gateway name.
LEPRECHAUN_MODE,//Boolean for leprechaun mode.true for enabling
AMO_ENABLED,//Boolean for accepting amo orders.true for enabling
["broker name","broker name"]);//If selected brokers should be shown, pass broker name comma separated else ignore.
// Values - fivepaisa, aliceblue, edelweiss, hdfc,iifl, kotak, trustline, kite

Params :
ENVIRONMENT - (Required) This defines the Url environment to which all the gateway apis would point to.

scgateway.ENVIRONMENT = {
   PRODUCTION: 'production',
   DEVELOPMENT: 'development',
   STAGING: 'staging'
};

GATEWAY_NAME - (Required) This is a unique name given to every gateway consumer.
LEPRECHAUN_MODE -(Optional) For Testing purpose pass it as true else false.
Broker Config - (Optional) If you want to support only certain brokers use.

scgateway.setConfigEnvironment(
function(data){},
function(error){},
[scgateway.ENVIRONMENT.PRODUCTION,
'gatewaydemo',
true,
true,
["aliceblue","kotak"]);

Example usage.

User Initialisation

User initialization starts a session between the distributor and the gateway. Whenever there is a change in user session.Call initSCGateway method from scgateway global variable.

scgateway.initSCGateway(function(data){//Successcallback required},
function(error){//Failure callback required},
[authToken]);

Params :

authToken - (Required) JWT with the information of user signed using a shared secret between smallcase API and gateway backend.

completion - (Required) Get success or failure callback with JsonObject.

scgateway.initSCGateway(function(data){
       dialogAlert('Success','Init gateway success ' + data)
   },function(error){
       dialogAlert('Error','Init gateway failure' + error)
   },[authToken]);

Example usage.

Trigger Transaction

Method using which broker connect and order flows can be triggered

scgateway.triggerTransaction(function(data){//success callback required},
function(error){//failure callback required},
[transactionId]);
}

Params :

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

completion - (Required) Get JsonObject in success callback or failure callback.

📘

Note

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

Creating Transactions

scgateway.triggerTransaction(function(data){
   dialogAlert('Success','Init gateway success ' + data)
},function(error){
   dialogAlert('Error','Set Config Failure ' + error)
},[transactionId]);

Example usage.

Lead Gen

To trigger lead gen call triggerLeadGen method which is available as a exported method on scgateway variable.

scgateway.triggerLeadGen([params])
{
    'name':'NAME OF USER',
    'email': 'EMAIL OF USER',
    'contact': 'CONTACT OF USER',
    'pinCode': 'PIN CODE OF USER'
}

params -(Optional) pass user information as JSON.

Updated 2 months ago

Cordova Integration


Suggested Edits are limited on API Reference Pages

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