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 github.

Integration

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

cordova plugin add https://github.com/smallcase/gw-mob-sdk-cordova.git#release-2.2.0

📘

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}.

iOS setup

add these lines at the top of your Podfile

# private podspec for smallcase
source 'https://github.com/smallcase/cocoapodspecs.git'

# default source for all other pods
source 'https://cdn.cocoapods.org'

# update the ios version if it was previously below 11.0 
platform :ios, '11.0'

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

Parameters

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

scgateway.ENVIRONMENT = {
   PRODUCTION: 'production'
};

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"]);

📘

'brokers' key is optional: if not passed, the SDK will show all supported brokers.

Only pass the brokers key if you want to allow only selected brokers.

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.

Broker Account Opening

To trigger account opening 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.