stripe / stripe-terminal-ios

Stripe Terminal iOS SDK
https://stripe.com/docs/terminal/sdk/ios
Other
104 stars 65 forks source link

Type of expression is ambiguous without more context in Terminal.shared.retrievePaymentIntent #241

Closed Roniy08 closed 1 year ago

Roniy08 commented 1 year ago
    Terminal.shared.retrievePaymentIntent(clientSecret: MembershipAPIRouter.stripe_Client_Secret!) { retrieveResult, retrieveError in
        if let error = retrieveError {
            print("retrievePaymentIntent failed: \(error)")
        }
        else if let paymentIntent = retrieveResult {
            print("retrievePaymentIntent succeeded: \(paymentIntent)")

            Terminal.shared.collectPaymentMethod(paymentIntent) { collectResult, collectError in
                if let error = collectError {
                    print("collectPaymentMethod failed: \(error)")
                } else if let paymentIntent = collectResult {
                    print("collectPaymentMethod succeeded")

                    if let paymentMethod = paymentIntent.paymentMethod,
                       let card = paymentMethod.cardPresent {
                        // Perform business logic on the card
                    }

                    // Confirm the payment intent to complete the payment
                    Terminal.shared.confirmPaymentIntent(paymentIntent) { confirmResult, confirmError in
                        if let error = confirmError {
                            print("confirmPaymentIntent failed: \(error)")
                        } else if let confirmedPaymentIntent = confirmResult {
                            print("confirmPaymentIntent succeeded: \(confirmedPaymentIntent)")
                            // Process the payment
                        }
                    }
                }
            }
        }
    }

Summary

Getting error - Type of expression is ambiguous without more context

iOS version

16.0

SDK version

pod 'StripeTerminal', '2.0'

Other information

I cannot get the terminal function working as the there is error and I followed the documentation https://stripe.com/docs/terminal/payments/collect-payment?terminal-sdk-platform=ios

bric-stripe commented 1 year ago

not sure if this is the root of the error (unable to reproduce it) but Terminal.shared.confirmPaymentIntent should currently be Terminal.shared.processPayment. Note this is naming we do want to fix up since the API method that is called is actually /confirm but the SDK currently doesn't have a confirmPaymentIntent method.

For integration issues like this you can also get help in the developer discord: https://stripe.com/go/developer-chat to talk to support staff that can help debug better.