SrPago-Ecommerce
示例
要运行示例项目,首先克隆仓库,然后从 Example 目录中运行 pod install
。在这里,你可以找到一个演示如何验证卡并获取此卡令牌的小示例
要求
在开始开发之前,你必须在我们的平台上注册以获取项目特定的凭据。你可以在这里查看任何问题 here
安装
SrPago-Ecommerce 通过 CocoaPods 提供。要安装
它,只需将以下行添加到 Podfile 中
pod 'SrPago-Ecommerce'
然后,打开一个终端并安装或更新 podfile 以下载此仓库
pod install
之后,请在文件中导入 SrPago.framework
import SrPago
创建 SrPago 的新实例,类似于单例类,并使用当前密钥设置此初始化
let srPago: SrPago = SrPago.sharedInstance()
srPago.publishableKey = <<YOUR_SRPAGO_PUBLISH_KEY>>
srPago.liveMode = false
为了验证信用卡,只需创建一个类型为 SPCard() 的文件即可
let card = SPCard()
card.name = "Your name"
card.number = "Your credit card number"
card.expMonth = "Expiration month from 1 to 12"
card.expYear = "The last two numbers of the expiration year"
card.cvv = "The card's CVV"
srPago.token.createToken(with: card, onSuccess: { (token) in
if let token = token?.token {
self.tokenLabel.text = "Token: \(token)"
}
}) { (error) in
if let error = error?.message {
self.tokenLabel.text = "Error: \(error)"
}
}
作者
[SrPago][https://devcenter.srpago.com]
许可证
SrPago-Ecommerce可根据MIT许可证使用。更多详情请参阅LICENSE文件。