How can i set a value for cardNumber,expirationMonth and expirationYear when the STPPaymentCardTextField is loaded instead of typing it manually? I tried
var paymentField = STPPaymentCardTextField()
override func viewDidLoad() {
super.viewDidLoad()
paymentField.frame = CGRectMake(15, 110, CGRectGetWidth(self.view.frame) - 30, 44)
paymentField.delegate = self
paymentField.cardNumber = "42424242424242424242"
self.view.addSubview(paymentField)
}
But this gives me an error "Cannot assign to the result of this expression" on this line paymentField.cardNumber = "42424242424242424242
This isn't currently supported, but something we'll look into in the future. I'm closing this as a duplicate of #219.
Hi,
is there any solution for set a value for cardNumber,expirationMonth and expirationYear with STPPaymentCardTextField when loaded?
paymentField.cardNumber = "42424242424242424242";
Hey @mobiwebshweta – you can do this by setting the field's cardParams:
let cardParams = STPCardParams()
cardParams.number = "4242424242424242"
self.paymentField.cardParams = cardParams
Doesn't seems to reload an UI properly =/
Doesn't seems to reload an UI properly =/
Hi @zykis
Could you make a new issue with repro steps for what you're seeing? Thanks!
Hey, @yuki-stripe !
Sure.
https://github.com/stripe/stripe-ios/issues/1451
Thanks for such beautiful framework!
Most helpful comment
Hey @mobiwebshweta – you can do this by setting the field's
cardParams:https://github.com/stripe/stripe-ios/blob/c6330c36800734b23f76fa016dc482fa0df637a1/Stripe/PublicHeaders/STPPaymentCardTextField.h#L259-L265