#papiwablo

1 messages ยท Page 1 of 1 (latest)

devout orbitBOT
hazy portal
#

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?

weak swan
#
        // 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

grim grail
#

What's the context of your ask? Like where are the comments coming from? Which exact docs are you following? How are you integrating?

weak swan
#

this is ios swift

grim grail
#

sure but I need a lot more

#

there are many different ways to integrate our iOS SDK

weak swan
#
    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

grim grail
#

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?

weak swan
#

before setupintent

#

this should tell you everyting

grim grail
#

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?

weak swan
#

this code should explain it all

grim grail
#

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

weak swan
#

`one second

grim grail
#

so I'm trying to figure out at which exact step you're doing this

weak swan
#

im trying to paste it in discord and its not sending the text

#

there easy enough

grim grail
#

please share real text/code, not a picture

weak swan
grim grail
#

thanks looking

weak swan
#

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

dawn horizon
#

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?

weak swan
#

why do i need an NSNumber value

#

i not doing math on them

devout orbitBOT
weak swan
#

their data type should be a string

dawn horizon
#

The data type is NSNumber though. What do the warnings say?

weak swan
#

NSNumber to String fails

dawn horizon
#

Yeah... so don't do that. ๐Ÿ™‚

weak swan
#

yeah or how about i do that

dawn horizon
#

I think it's the cast that's failing and returning nil, not that the values are actually nil.

weak swan
#

because its not a computational value

#

yes you are correct5

dawn horizon
#

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.

weak swan
#

thats exactly what i was about to do

#

ty ty ty

dawn horizon
#

That work?

weak swan
#

i think it will

dawn horizon
#

Cool beans.

weak swan
#

but i just was glossing over the NSNumber

#

so youve been the most succinct support ive ever encountered here

dawn horizon
#

You can't really gloss over that kind of thing on iOS with Swift. ๐Ÿ˜…

weak swan
#

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

dawn horizon
#

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.

weak swan
#

thank you -- u da bomb