SimplZeroClick 1.0.16

SimplZeroClick 1.0.16

许可证 NOASSERTION
发布上次发布2023年6月

由以下作者维护:DevarajanRahul.M.MohanSimpl Admin



  • 作者
  • Simpl

simpl-zeroclick-ios-sdk

如何安装

CocoaPods

CocoaPods 是 Cocoa 项目的依赖管理器。你可以使用以下命令安装它

$ gem install cocoapods

要在 Xcode 项目中使用 CocoaPods 集成 GetSimpl,请在 Podfile 中指定它

pod 'SimplZeroClick'

然后,运行以下命令

$ pod install

集成

  • 将以下内容添加到您的 Info.plist 文件中
<key>CFBundleURLTypes</key>
<array>
  <dict>
    <key>CFBundleURLSchemes</key>
    <array>
      <string>smpYourMerchantID</string>
    </array>
  </dict>
</array>

请注意,您必须在 smpYourMerchantID 中添加您的商户 ID,例如 smp55d72761ec60ytbnk97414182

  • 对于 iOS 9+,还需要将以下内容添加到您的 Info.plist 文件中
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
      <key>getsimpl.com</key>
      <dict>
        <key>NSExceptionAllowsInsecureHTTPLoads</key>
        <true/>
        <key>NSIncludesSubdomains</key>
        <true/>
        <key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
        <false/>
      </dict>
    </dict>  
</dict>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>simplApp</string>
</array>

初始化

  • 导入库

     import SimplZeroClick 
    
  • 使用您的商户 ID 初始化 SDK,通常在应用程序的 didFinishLaunchingOptions 方法中

     GSManager.initialize(withMerchantID: "Your merchant id")
    
  • 要在沙盒模式下运行 Simpl

    GSManager.enableSandBoxEnvironment(true)
    

Simpl 支付选项的实现

  • 检查用户是否已预先批准

      let user = GSUser(phoneNumber: phone , email: email )
      
      GSManager.shared().checkApproval(for: user) { (approved, firstTransaction, text, error) in
      } 
    
    approved : If GSUser is pre-approved or not
    
    isFirstTransactionOfUser : If user has already done transactions previously or not
    
    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.
    
    error : Error if any
    

    如果用户被批准,则向用户显示 Simpl 按钮。

  • 为了显示 Simpl 选项,商家可以使用他们自己的自定义按钮。然而,他们应该使用上面的批准调用中的 buttonText 值来显示按钮上的文本。

获取订阅令牌

let user = GSUser(phoneNumber: "user phonenumber", email: "user email")

GSManager.shared().generateToken(for: user) { (jsonResponse, error) in 

//On successful generation of token :

        { 
          status: 'success',
          data: {
            zero_click_token: 'xyz'
          }
        }

}

触发重定向URL(在到期付款/超限的情况下)

GSManager.shared().openRedirectionURL(paymentRedirectionUrl, onCompletion: { (response, error) in 
 
 //In case payment is done :
       {
           status: 'success',
           data: {
               message: 'Payment received'
           }
       }
       
 //In case the pending due flow is aborted :
 
       {
           status: 'error',
           errors: ['Payment Failed!']
       }      

}