orazz / CreditCardForm-iOS

CreditCardForm is iOS framework that allows developers to create the UI which replicates an actual Credit Card.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error sending STPCardParams to the STP Payment Card TextField

blinkuz opened this issue · comments

I am trying to send values from the cards.pay library when scanning the credit cards but when using the

  ` let params = STPCardParams()
    params.number = "4242424242424242"
    params.cvc = "123"
    params.expYear = 22
    params.expMonth = 06
    self.paymentTextField.cardParams = params`

This error marks me Thread 1: Fatal error: Unexpectedly found nil while unwrapping an Optional, on line 432 of the CreditCardFormView file.

I am new to swift and I would appreciate it if you can help me

commented

Update to 0.2.0

cardParams = STPPaymentMethodCardParams()
cardParams.number = "375987654320001"
cardParams.expMonth = 03
cardParams.expYear = 23
cardParams.cvc = "332"
self.paymentTextField.cardParams = cardParams

override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        // load saved card params
       creditCardForm.paymentCardTextFieldDidChange(cardNumber: cardParams.number, expirationYear: cardParams!.expYear as? UInt, expirationMonth: cardParams!.expMonth as? UInt, cvc: cardParams.cvc)
    }