#papiwablo
1 messages ยท Page 1 of 1 (latest)
When you say "save", what do you mean? Are you able to create a Payment Method on Stripe already? If so, are you not seeing he expiration month and year in the object's attributes?
// Collect card details
let paymentMethodParams = self.cardTextField.paymentMethodParams
//store month so you can find it against new payment token
guard let month = paymentMethodParams.card?.expMonth as? String else {
print("uh oh unable to get the month from user input")
return
}
month comes back is nil
as does .card?.expYear
.card?.last4 works
i just need to store expYear and expMonth from a card as the user is entering it on the device
What's the context of your ask? Like where are the comments coming from? Which exact docs are you following? How are you integrating?
this is ios swift
lazy var cardTextField: STPPaymentCardTextField = {
let cardTextField = STPPaymentCardTextField()
cardTextField.translatesAutoresizingMaskIntoConstraints = false
cardTextField.font = UIFont(name: "AvenirNext-Regular", size: DesignModel.font12)!
return cardTextField
}()
this is your drop in card textfield
when the user enters their new cc info, i need the property to get the exp month and exp year
What's the context though? Sorry to keep asking but you haven't given me much
are you using PaymentIntent and confirming it? Creating a PaymentMethod on your own? Something else?
Please try to give me detailed information all in one message if possible insead of really small bits
you say "before setupintent" what does that mean? At which exact step are you trying to access this information? Is this before the PaymentMethod is created? after? what's the exact context of this code running
like does self.cardTextField.expirationMonth work for example?
this code should explain it all
No the code doesn't explain it all, hence why I'm asking. I'm a bit confused why you're accessing .paymentMethodParams for example
`one second
so I'm trying to figure out at which exact step you're doing this
please share real text/code, not a picture
thanks looking
the instance of
lazy var cardTextField: STPPaymentCardTextField = {
let cardTextField = STPPaymentCardTextField()
cardTextField.translatesAutoresizingMaskIntoConstraints = false
cardTextField.font = UIFont(name: "AvenirNext-Regular", size: DesignModel.font12)!
return cardTextField
}()
seems to have a property to access the expMonth and the expYear
but the guard statements for year and month are returning nil
Hello! In your screenshot there are warnings for your cast to a String, what are those warnings saying?
And why are you trying to cast these to a String in the first place?
their data type should be a string
The data type is NSNumber though. What do the warnings say?
NSNumber to String fails
Yeah... so don't do that. ๐
yeah or how about i do that
I think it's the cast that's failing and returning nil, not that the values are actually nil.
What if you tack on .stringValue instead of trying to use as?
Does that give you what you want?
Pretty sure NSNumber has a .stringValue.
That work?
i think it will
Cool beans.
but i just was glossing over the NSNumber
so youve been the most succinct support ive ever encountered here
You can't really gloss over that kind of thing on iOS with Swift. ๐
you're bold and to the point
you stare long enough at something when you're mad -- you miss it lol
how can i get you every time myself or back end folks have an issue
ehhh ignore the back end comment
You can ask in #dev-help and if I'm online at the time I'll grab the question, or someone else on my team will.
thank you -- u da bomb