【发布时间】:2020-08-26 00:41:07
【问题描述】:
我正在使用STPPaymentCardTextField 从用户那里收集卡信息。
我可以使用STPPaymentCardTextFieldDelegate的委托方法来获取'cardNumber、expirationMonth等信息:
func paymentCardTextFieldDidChange(_ textField: STPPaymentCardTextField) {
print("NUMBER", textField.cardNumber)
print("EXP MONTH", textField.expirationMonth)
print("EXP YEAR", textField.expirationYear)
print("CVC", textField.cvc)
}
然而,这个 textField 似乎也显示卡片类型,基于用户输入的信息:
如何以编程方式访问此卡类型?我在另一个UIView 中使用它来生成卡片的预览,根据卡片类型设置其背景颜色和徽标等。
【问题讨论】:
标签: ios swift stripe-payments credit-card