FlutterwaveSDK
Flutterwave iOS SDK 允许您在 iOS 应用中构建快速、简单且卓越的支付体验。我们提供了强大且可定制的 UI 屏幕 和元素,可以直接使用以收集用户的支付详细信息。
示例
要运行示例项目,克隆仓库,并使用 Xcode 在示例目录中打开 FlutterwaveSDK.xcworkspace
,运行并构建即可!
- 如果您还没有账户,请先注册一个 Flutterwave 账户。
- 在
Viewcontroller.swift
中填写以下config details
以配置您的支付类型
config.paymentOptionsToExclude = []
config.currencyCode = "[NGN,USD,KES,RWF,ZAR,GBP,GHS,ZMF,XAF,XOF, e.t.c ]" // This is the specified currency to charge in.
config.email = "[email protected]" // This is the email address of the customer
config.isStaging = false // Toggle this for staging and live environment
config.phoneNumber = "077883***1" //Phone number
config.transcationRef = "IOS TEXT" // This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction.
config.firstName = "Yemi" // This is the customers first name.
config.lastName = "Desola" //This is the customers last name.
config.meta = [["metaname":"sdk", "metavalue":"ios"]] //This is used to include additional payment information
config.narration = "simplifying payments for endless possibilities"
config.publicKey = "[PUB_KEY]" //Public key
config.encryptionKey = "[ENCRYPTION_KEY]" //Encryption key
config.isPreAuth = false // This should be set to true to preauthoize card transactions
let controller = FlutterwavePayViewController()
let nav = UINavigationController(rootViewController: controller)
controller.amount = "[]" // This is the amount to be charged.
controller.delegate = self
self.present(nav, animated: true)
完成以上步骤后,您可以进行测试支付,请确保 config.isStaging = true
,切换到测试模式并使用在仪表板上切换到测试模式时所获得的密钥。
请注意,测试卡将无法与生产 API 密钥一起使用,它们只能在测试环境中工作。
请访问 https://developer.flutterwave.com/docs/test-cards 获取测试卡号列表。
要求
Flutterwave SDK 与运行 iOS 11.0 及以上版本的 iOS 应用兼容。它需要 Xcode 10.0+ 来构建源代码。
安装
FlutterwaveSDK可通过CocoaPods获取。要安装,只需将以下行添加到您的Podfile中,然后运行pod install
。
pod 'FlutterwaveSDK'
使用
import FlutterwaveSDK
class ViewController: UIViewController, FlutterwavePayProtocol {
func tranasctionSuccessful(flwRef: String?, responseData: FlutterwaveDataResponse?) {
print("Successful with \(responseData?.flwRef ?? "Failed to return data")")
}
func tranasctionFailed(flwRef: String?, responseData: FlutterwaveDataResponse?) {
print( "Failed transaction with FlwRef \(flwRef.orEmpty())")
}
let flutterLabel = UILabel()
let exampleLabel = UILabel()
let underLineView = UIView()
let launchButton = UIButton(type: .system)
@objc func showExample(){
let config = FlutterwaveConfig.sharedConfig()
config.paymentOptionsToExclude = []
config.currencyCode = "NGN" // This is the specified currency to charge in.
config.email = "[email protected]" // This is the email address of the customer
config.isStaging = false // Toggle this for staging and live environment
config.phoneNumber = "077883***1" //Phone number
config.transcationRef = "IOS TEXT" // This is a unique reference, unique to the particular transaction being carried out. It is generated when it is not provided by the merchant for every transaction.
config.firstName = "Yemi" // This is the customers first name.
config.lastName = "Desola" //This is the customers last name.
config.meta = [["metaname":"sdk", "metavalue":"ios"]] //This is used to include additional payment information
config.narration = "simplifying payments for endless possibilities"
config.publicKey = "[PUB_KEY]" //Public key
config.encryptionKey = "[ENCRYPTION_KEY]" //Encryption key
config.isPreAuth = false // This should be set to true for preauthorize card transactions
let controller = FlutterwavePayViewController()
let nav = UINavigationController(rootViewController: controller)
controller.amount = "[]" // This is the amount to be charged.
controller.delegate = self
self.present(nav, animated: true)
}
❗️ 卡支付方式需要符合PCI-DSS规定!
请注意,只有获得所需PCI-DSS合规证书,您才能使用此集成选项。
贡献
欢迎任何形式的贡献,包括修复错误、新功能和文档改进。首先,请打开一个问题描述您想构建的内容,我们将讨论如何继续。否则,您可以打开一个对拉请求进行微小修改,如拼写修正和单行代码。
作者
Flutterwave 开发者
许可协议
FlutterwaveSDK采用MIT许可协议。有关更多信息,请参阅LICENSE文件。