【发布时间】:2023-03-22 03:28:01
【问题描述】:
我想在 Swift iOS 中的 App 委托字段中添加两个条带键。我有两个条纹帐户,根据条件我想做信用卡/借记卡付款。提前致谢。
我所做的不是在 App 委托中声明字符串键,而是在类本身中声明键,在该类中我为支付创建令牌,如下所示。我使用每个键的每个班级都有两个班级。
@IBAction func submitCard(_ sender: AnyObject) {
let cardParams = paymentTextField.cardParams
Stripe.setDefaultPublishableKey("pk_test_1234567899875gh")// example key
// It takes the card details and creates the token here.
STPAPIClient.shared().createToken(withCard: cardParams) { token, error in
guard token != nil else {
print("Error creating token: %@", error!.localizedDescription);
return
}
print(token)
}
}
这是写的吗?还是我需要更改代码?
注意:这与环境无关,而是两个不同的条带帐户。
【问题讨论】:
-
STPPaymentConfiguration.shared().publishableKey 仅接受单个密钥。如果您想要有条件的付款,最好在网上处理付款。您只需将付款页面加载到 WKWebView。
标签: ios swift stripe-payments