I am not able to get Stripe payment Id after entering My card details

Viewed 87

I need to send payment if of carder enter which I will get in response by Stripe Dashboard, I have right Key, properly integrated Stripe too, still not working

1 Answers

Here in response you will get your stripe Id which will serve as your payment Id also

let cardParams = STPPaymentMethodCardParams()
                cardParams.number = popUpView.cardNumber.text
                cardParams.expMonth = NSNumber(value: UInt(String(self.popUpView.mmTF.text!.prefix(2)))!)
                cardParams.expYear = NSNumber(value: UInt(String(self.popUpView.yyTF.text!.suffix(4)))!)
                cardParams.cvc = popUpView.cvvTF.text
                let paymentMethodParams = STPPaymentMethodParams(
                    card: cardParams,
                    billingDetails: nil,
                    metadata: nil
                )
                STPAPIClient.shared.createPaymentMethod(with: paymentMethodParams) { (response, error) in
                    DispatchQueue.main.async { [self] in
                        SVProgressHUD.show()
                        let dict = User.init(dictionary: NSDictionary())
                        dict?.payment_id = response?.stripeId
                        addCardApi(userDict: dict!)
                        
                    }
                }
Related