简体   繁体   English

我如何使用Stripe获得卡号,CVV和到期日期的单独文本字段

[英]How can i get separate textfield for card number, cvv and expiration date with Stripe

I am using Stripe in my application for payment. 我在应用程序中使用Stripe付款。 For reference i have used https://github.com/stripe/stripe-ios . 作为参考,我使用了https://github.com/stripe/stripe-ios

Here is my code snippet 这是我的代码片段

let paymentCardTextField = STPPaymentCardTextField()

paymentCardTextField.frame = CGRect(x: 0, y: 0, width:cardDetailsView.frame.width, height: cardDetailsView.frame.height)

paymentCardTextField.font = FontBold15
paymentCardTextField.delegate = self

cardDetailsView.addSubview(paymentCardTextField)

i have added textfield of type STPPaymentCardTextField to my view. 我已将STPPaymentCardTextField类型的文本字段添加到我的视图中。 From this implementation, i only have one textfield which have all three card params ie Card Number, CVV and Expiry date in one. 从这个实现中,我只有一个文本字段,其中同时包含所有三个卡参数,即卡号,CVV和到期日期。 But i want all three fields to be separate. 但是我希望所有三个领域都分开。

Refer my application UI: 请参阅我的应用程序用户界面:

在此处输入图片说明

You can use BKMoneyKit library to create stripe like textField in your custom view, which already comes with validation methods. 您可以使用BKMoneyKit库在自定义视图中创建类似于textField的条纹,该条纹已经包含验证方法。 This approach will be better as you can make changes in your custom view whenever you want. 这种方法会更好,因为您可以随时在自定义视图中进行更改。 And then after you can use stripe methods to create token or add card etc. 然后,您可以使用条带方法创建令牌或添加卡等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM