GetSimpl-iOS7 1.3.1

GetSimpl-iOS7 1.3.1

测试已测试
Lang语言 Obj-CObjective C
许可证 商业
发行最后发行2016年5月

Alok Jha 维护。



  • Alok Jha

simpl-ios-sdk-dist-ios7

如何安装

iOS 集成

  • 目标 -> 构建设置 -> ENABLE_BITCODE -> 将其标记为 NO。
  • 将以下内容添加到您的 Info.plist 文件中
    <key>CFBundleURLTypes</key>
    <array>
     <dict>
        <key>CFBundleURLSchemes</key>
        <array>
        // smp + YourMerchantID, like; smp55d72761ec60ytbnk97414182
        <string>smpYourMerchantID</string>
       </array>
     </dict>
    </array>
  • 对于 iOS 9,也将在您的 Info.plist 文件中添加以下内容
    <key>NSAppTransportSecurity</key>
    <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
    </dict>
    <key>LSApplicationQueriesSchemes</key>
     <array>
      <string>simplApp</string>
     </array>
  • 在您的 AppDelegate 中添加以下行
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication     annotation: (id)annotation
    { if ([[GSCallBackHandler sharedInstance] canHandleURL:url]) {
      return [[GSCallBackHandler sharedInstance] application:application openURL:url sourceApplication:sourceApplication      annotation:annotation] ;
    }

  return YES;
   }
  • 开发者可以根据以下方式在托管环境或生产环境之间切换
[GSManager enableSandBoxEnvironment:YES]

如何使用

  • 导入库
#import "GetSimpl-iOS7/GetSimpl.h"
  • 使用您的商户 ID 初始化 SDK,通常在您的应用的 didFinishLaunchingOptions 方法中
[GSManager initializeWithMerchantID@:@"Your merchant id"];
  • 检查用户是否已预批准
GSUser *user = [[GSUser alloc] initWithPhoneNumber:@"user mobile number" email:@"user email"];
[[GSManager sharedManager] checkApprovalForUser:user onCompletion:^(BOOL approved, BOOL isFirstTransactionOfUser,  NSString *buttonText ,NSError *error) {
 }]
  Bool approved : If GSUser is pre-approved or not
  Bool isFirstTransactionOfUser : If user has already done transactions previously or not
  String/NSString buttonText : The text to display on Simpl button. If GSUser is pre-approved,this will contain a value specific to merchant with default value of "Buy Now, Pay Later". Will be nil if GSUser is not pre-approved.
  NSError error : Error if any

如果用户已批准并且商家应显示 Simpl 按钮,如果用户不是批准的用户,则不显示 Simpl 按钮。

  • 实时批准:对于一些不希望事先共享数据但愿意在交易前通过共享数据实时批准用户的商家,可以使用以下批准调用
GSUser *user = [[GSUser alloc] initWithHashedPhoneNumber:@"hashed value of user phone number"];
user.extraParams = @{@"wallet_balance_in_paise" : @30000,@"transaction_amount_in_paise" : @20000};
[[GSManager sharedManager] checkApprovalForUser:user onCompletion:^(BOOL approved, BOOL isFirstTransactionOfUser,  NSString *buttonText ,NSError *error) {
 }]
extraParams ->  Extra properties of GSUser to be set as Key-Value pairs.Example of some keys are transaction_amount_in_paise, wallet_balance_in_paise,failed_transaction_bank_name,user_location,theatre_location,member_since, signed_in , etc.
This property has been provided so that merchants can provide additional parameters for real-time approval without upgrading the SDK.

如果商家使用 hashedPhoneNumber 检查预批准,则上述密钥将用于用户的实时批准,前提是商家已在服务器端启用了实时配置。

  • 对于 Simpl 按钮,商家可以使用 SDK 提供的 GSButton 类,可以通过以下属性进行自定义

/// Button background color. Defaults to Simpl branding color
@property (nonatomic, strong) UIColor *buttonColor;

/// Button border color. Defaults to Black Color with 10% alpha
@property (nonatomic, strong) UIColor *buttonBorderColor;

/// Title text of button. Defaults to "Buy Now, Pay Later"
@property (nonatomic, copy) NSString *titleText;

/// Title Color of Button. Defaults to White color
@property (nonatomic, strong) UIColor *titleColor;

/// Font of button
@property (nonatomic, strong) UIFont *titleFont;

/// Text color of "Powered by Simpl" text. Defaults to R94 G107 B125 A1
@property (nonatomic, strong) UIColor *poweredByTextColor;

/// Separator line color. Defaults to Black Color with 8% alpha
@property (nonatomic, strong) UIColor *separatorColor;

  • 点击 Simpl 按钮时,调用以下方法以启动交易。这将打开一个 OTP 视图供用户进入。在完成块中,transaction_token 将被返回。
   GSUser *user = [[GSUser alloc] initWithPhoneNumber:@"user mobile number" email:@"user email"];
   GSTransaction *transaction = [[GSTransaction alloc] initWithUser:user amountInPaise:500];
[ [GSManager sharedManager]  authorizeTransaction:transaction onCompletion:^(NSDictionary * jsonResponse, NSError *  error) {
  }];

在调用 authorizeTransaction 之前,必须设置 GSUser 的电话号码。一旦您获得了 transaction_token,将其传递到您的服务器,然后再将其传递到 Simpl。