Integration Docs

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

Get Started

iOS Integration

iOS framework is available as a private cocoa pod dependency.


Copy pod url and version to Podfile .

source ''
target '${CLIENT_PROJECT_NAME}' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  pod 'SCGateway', '~> ${FRAMEWORK_VERSION}'

After these run ‘pod install’.



To integrate Framework through Cocoa pods copy the above lines to your pod file.
Replace ${FRAMEWORK_VERSION} with latest version code.
Eg - Current version is 2.2.0



For xcode 12 and above use xcframework with swift package manager.
Ref -

Setting up sdk for transaction

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

public func setup(config: GatewayConfig)
[SCGateway.shared setupWithConfig:config completion:^(BOOL success,
                                                      NSError * error){
        if (success) {
            //init sdk successfull
        } else {
                //retry init



Re-initialize the user every time there is any change in the setup configuration.
Setup method must be the first method to be fired. If the setup is not called all other methods will throw an error.

To set up, create a config object conforming to the Gateway Config protocol. The configuration defines the settings to be used by the gateway.

public protocol GatewayConfig {
     var gatewayName: String { get set }
     var brokerConfig: BrokerConfigType { get set }
     var apiEnvironment: Environment { get set }
     var isLeprechaunActive: Bool { get set}
@interface GatewayConfig : NSObject
@property (nonatomic, copy) NSString * _Null_unspecified gatewayName;
- (nonnull instancetype)initWithGatewayName:(NSString * _Nonnull)gatewayName brokerConfig:(NSArray<NSString *> * _Nullable)brokerConfig apiEnvironment:(enum Environment)apiEnvironment isLeprechaunActive:(BOOL)isLeprechaunActive OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");

Params :
Broker Config: If you want to support only certain brokers use BrokerConfigType.custom([])

If selected brokers should be shown, pass broker name comma separated else ignore.
Possible Values for brokers:

  1. fivepaisa
  2. aliceblue
  3. axis
  4. edelweiss
  5. hdfc
  6. iifl
  7. trustline
  8. kite
public enum BrokerConfigType {
    case defaultConfig
    case custom([String])

Gateway Name: Required This is a unique name given to every gateway consumer eg: gatewaydemo

Environment: Optional This defines the Url environment to which all the gateway apis would point to Possible values

@objc public enum Environment: Int {
    case development
    case production
    case staging
typedef SWIFT_ENUM(NSInteger, Environment, closed) {
  EnvironmentDevelopment = 0,
  EnvironmentProduction = 1,
  EnvironmentStaging = 2,
let config = Config(gatewayName: "moneycontrol",
                            brokerConfig: BrokerConfig.default ,
                            apiEnvironment: .production,
                            isLeprechaunActive: false)
 SCGateway.shared.setup(config: config)
GatewayConfig *config = [[GatewayConfig alloc] initWithGatewayName: @"moneycontrol" brokerConfig:NULL apiEnvironment:environment isLeprechaunActive:true];

isLeprechaunActive: Optional For Testing purpose only. The default value is false

User Initialisation

public func initializeGateway(sdkToken: String, completion: ((Result<Bool, Error>) -> Void)?)
- (void)initializeGatewayWithSdkToken:(NSString * _Nonnull)sdkToken completion:(void (^ _Nullable)(BOOL, NSError * _Nullable))completion;

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.

  • sdkToken: Required JWT with the information of the user signed using a shared secret between smallcase API and gateway backend.

    NOTE: Data in the payload of sdkToken can be of the following structure

\* Guest User *\
  guest: true

\* Connected User *\
    smallcaseAuthId :"5c4f0b6a0cbd7d332bae9c92"
  • completion: Optional Result type with success(bool) and error. Triggered after initialisation is completed.
SCGateway.shared.initializeGateway(sdkToken: "<Insert Auth Token>") {(result) in
                switch result {
                case .success(let response):
                case .failure(let error):
[SCGateway.shared initializeGatewayWithSdkToken:authToken completion:^( BOOL success, NSError * error) {
                    NSLog(@"Initialization triggered");
                    if (success) {
                        [self showAlert:@"Success" message:@"Init success"];
                    } else {
                        [self showAlert:@"Failure" message:@"Init Failure"];

Trigger Transaction

public func triggerTransactionFlow(transactionId: String, presentingController: UIViewController, completion: @escaping(Result<TransactionIntent, TransactionError>) -> Void) throws
- (void)triggerTransactionFlowWithTransactionId:(NSString * _Nonnull)transactionId presentingController:(UIViewController * _Nonnull)presentingController completion:(void (^ _Nonnull)(id _Nullable, ObjcTransactionError * _Nullable))completion;

Method using which broker connect and order flows can be triggered

  • transactionId: Required
  • presentingController: Required
  • completion: Required
func connectGateway(transactionId: String) {  
        do {
            try SCGateway.shared.triggerTransactionFlow(transactionId: transactionId , presentingController: self) { [weak self]  result in
                switch result {
                case .success(let response):
                    print("CONNECT: RESPONSE: \(response)")
                    switch response {
                    case let .connect(authToken, _, _):
                        self?.connect(authToken: authToken)
                        //TODO: - Handle Later
                case .failure(let error):
                    print("CONNECT: ERROR :\(error)")
        catch SCGatewayError.uninitialized {
            ///initialize gateway
        catch let err {
[SCGateway.shared triggerTransactionFlowWithTransactionId: transactionId presentingController:self completion:^(id response, NSError * error) {
              if (error != nil) {
                  NSLog(@"%@", error.domain);
                  [self showAlert:@"Failure" message:[NSString stringWithFormat:@"%@ %ld",error.domain,(long)error.code]];
                  return ;

              if ([response isKindOfClass: [ObjcTransactionIntentTransaction class]]) {

                  ObjcTransactionIntentTransaction *trxResponse = response ;
                  NSLog(@"response: %@", trxResponse.transaction);
                  // Decode Base64 encoded string response
                  NSData *decodedStringData = [[NSData alloc] initWithBase64EncodedString:trxResponse.transaction options: 0];
                  NSString *decodedResponse = [[NSString alloc] initWithData:decodedStringData encoding:1];
                  NSLog(@"%@", decodedResponse);
                  [self showAlert:@"Success" message:decodedResponse];
                 // NSLog(trxResponse.)




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

Broker Account Opening

To trigger account opening flow call triggerLeadGen method which is available in SCGateway class.

SCGateway.shared.triggerLeadGen(presentingController: self,params: params)
[SCGateway.shared triggerLeadGenWithPresentingController:[[[UIApplication sharedApplication] keyWindow] rootViewController] params:params];

Params :

presentingController - (Required) pass reference of the current controller.

var params:[String:String] = [:]
        params["name"] = "NAME OF USER"
        params["email"] = "EMAIL OF USER"
        params["contact"] = "CONTACT OF USER"
        params["pinCode"] = "PIN CODE OF USER"
NSMutableDictionary *params = [[NSMutableDictionary alloc] init];
[params setValue:@"NAME OF USER"  forKey:@"name"];
[params setValue:@"EMAIL OF USER"  forKey:@"email"];
[params setValue:@"CONTACT OF USER"  forKey:@"contact"];
[params setValue:@"PIN CODE OF USER"  forKey:@"pinCode"];

params - (Required) pass user information as a dictionary or pass *nil .

Updated 10 days ago

iOS Integration

Suggested Edits are limited on API Reference Pages

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