# SquareMobilePayment SDK for iOS. Payment not going through

**URL:** <https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524>\
**Category:** Questions\
**Tags:** mobile-payments-sdk\
**Created:** [May 26, 2025, 12:43pm UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524 "2025-05-26T12:43:01Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![pariesh](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@pariesh](https://developer.squareup.com/forums/u/pariesh)\
**Post date:** [May 26, 2025, 12:43pm UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/1 "2025-05-26T12:43:01Z")

</div>

I am using 2.2.3 version for iOS using swift and UIKit. My oauth is working fine. Reader is getting connected. But as soon as I put on card of square contactless reader. Popup appears Payment Failed. The payment could not be completed. Please try again.

Also delegate method for payment failed is not getting called.  
Please help,  
**Payment Did Start: [“createdAt”: 2025-05-26 12:46:35 +0000, “totalMoney”: $1.00, “sourceType”: “UNKNOWN”, “amountMoney”: $1.00, “status”: INITIALIZED, “updatedAt”: 2025-05-26 12:46:35 +0000]**  
Here is my code

```auto
import UIKit
import CoreLocation
import SquareMobilePaymentsSDK
import CoreBluetooth
import SafariServices
import MockReaderUI

class ViewController: UIViewController {
    var availableCardInputMethods = MobilePaymentsSDK.shared.paymentManager.availableCardInputMethods
    private lazy var locationManager = CLLocationManager()
    private var centralManager: CBCentralManager?
    private var pairingHandle: PairingHandle?
    private var paymentHandle: PaymentHandle?
    
    private lazy var mockReaderUI: MockReaderUI? = {
        do {
            return try MockReaderUI(for: MobilePaymentsSDK.shared)
        } catch {
            assertionFailure("Could not instantiate a mock reader UI: \(error.localizedDescription)")
        }
        
        return nil
    }()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
// try? mockReaderUI?.present()
    }
    
    func requestLocationPermission() {
        switch CLLocationManager.authorizationStatus() {
        case .notDetermined:
            locationManager.requestWhenInUseAuthorization()
        case .restricted, .denied:
            print("Show UI directing the user to the iOS Settings app")
        case .authorizedAlways, .authorizedWhenInUse:
            print("Location services have already been authorized.")
        @unknown default:
            print("unknown error in location")
        }
    }
    
    func requestBluetoothPermissions() {
        guard CBManager.authorization == .notDetermined else {
            return
        }
        
        centralManager = CBCentralManager(
            delegate: self,
            queue: .main,
            options: nil
        )
    }
    
    @IBAction private func settingTapped() {
        MobilePaymentsSDK.shared.settingsManager.presentSettings(with: self) { _ in }
    }
    
    @IBAction private func oauthTapped() {
        guard MobilePaymentsSDK.shared.authorizationManager.state == .notAuthorized else {
            print("Already authorized")
            return
        }
        MobilePaymentsSDK.shared.authorizationManager.authorize(withAccessToken: "EAAAliWKEztjcLXm6YnmyBWNd6vEDwzn8-6fzRT5FHe0viY3bNfctL4th_TYlevo", locationID: "L2XH7G705DRMJ") { error in
            if let authError = error {
                // Handle auth error
                print("error: \(authError.localizedDescription)")
                return
            }
            
            print("Square Mobile Payments SDK successfully authorized.")
        }
    }
    
    @IBAction private func readerTapped() {
        requestLocationPermission()
        requestBluetoothPermissions()
        MobilePaymentsSDK.shared.readerManager.add(self)
        pairingHandle = MobilePaymentsSDK.shared.readerManager.startPairing(with: self)
    }
    
    @IBAction private func paymentTapped() {
        paymentHandle = MobilePaymentsSDK.shared.paymentManager.startPayment(
            makePaymentParameters(),
            promptParameters: PromptParameters(
                mode: .default,
                additionalMethods: .all
            ),
            from: self,
            delegate: self
        )
    }
    
    func makePaymentParameters() -> PaymentParameters {
        PaymentParameters(
            idempotencyKey: UUID().uuidString,
            amountMoney: Money(amount: 100, currency: .USD),
            processingMode: .autoDetect
        )
    }
    
}

extension ViewController: PaymentManagerDelegate {
    public func paymentManager(
        _ paymentManager: PaymentManager,
        didFinish payment: Payment
    ) {
        print("Payment Did Finish: \(payment)")
    }
    
    func paymentManager(_ paymentManager: any PaymentManager, didStart payment: any Payment) {
        print("Payment Did Start: \(payment)")
    }

    public func paymentManager(
        _ paymentManager: PaymentManager,
        didFail payment: Payment,
        withError error: Error
    ) {
        // Handle Payment Failed
        if let paymentError = PaymentError(rawValue: (error as NSError).code) {
          print(paymentError.rawValue)
        }
        print("error: \(error.localizedDescription)")
    }

    public func paymentManager(
        _ paymentManager: PaymentManager,
        didCancel payment: Payment
    ) {
        // Handle Payment Canceled
        print("payment cancelled: \(payment)")
    }
    
    func paymentManager(_ paymentManager: any PaymentManager, willFinish payment: any Payment) {
        print("Payment will finish \(payment)")
    }
    
    func paymentManager(_ paymentManager: any PaymentManager, willCancel payment: any Payment) {
        print("Payment will cancel \(payment)")
    }
}

extension ViewController: AvailableCardInputMethodsObserver {
    func availableCardInputMethodsDidChange(_ cardInputMethods: CardInputMethods) {
        print("available input methods \(cardInputMethods.description)")
    }
}

extension ViewController: ReaderPairingDelegate {
    func readerPairingDidBegin() {
        print("reader pairing begin")
    }
    
    func readerPairingDidSucceed() {
        print("reader pairing success")
    }
    
    func readerPairingDidFail(with error: any Error) {
        print("reader pairing fail \(error.localizedDescription)")
    }
}

extension ViewController: CBCentralManagerDelegate {
    func centralManagerDidUpdateState(_ central: CBCentralManager) {
        print("bluetooth status \(central.state)")
    }
}

extension ViewController: ReaderObserver {
    func readerWasAdded(_ readerInfo: any ReaderInfo) {
        
    }
    
    func readerWasRemoved(_ readerInfo: any ReaderInfo) {
        
    }
    
    func readerDidChange(_ readerInfo: any ReaderInfo, change: ReaderChange) {
        
    }
}

```

 ![IMG_5DC15C6AA226-1](https://global.discourse-cdn.com/square/original/2X/6/6c5df8fc7617ec35fe20f7a25323e03c636b423c.jpeg)

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [May 26, 2025, 12:43pm UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/2 "2025-05-26T12:43:15Z")

</div>

👋 I’m Square Dev AI, here to help answer your question!  
Based on the information you’ve provided, the following documentation will help answer your question:

> **[Build on iOS: In-App Payments SDK](https://developer.squareup.com/docs/in-app-payments-sdk/build-on-ios)**
>
> Build a secure payment client for iOS devices with the In-App Payments SDK.

> **[Build on iOS](https://developer.squareup.com/docs/reader-sdk/build-on-ios)**
>
> Build with the Reader SDK on iOS to process in-person payments with Square hardware.

> **Additional Documentation**
>
> [Enable Apple Pay](https://developer.squareup.com/docs/in-app-payments-sdk/add-digital-wallets/apple-pay)  
> [Take a Credit Card Payment](https://developer.squareup.com/docs/reader-sdk/quick-start/step-5)  
> [Enable Secure Remote Commerce - iOS](https://developer.squareup.com/docs/in-app-payments-sdk/add-digital-wallets/src/ios)

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.  
Otherwise one of our Developer Advocates will provide additional assistance shortly.

---

<div class="post-metadata">

**Author:** ![pariesh](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@pariesh](https://developer.squareup.com/forums/u/pariesh)\
**Post date:** [May 27, 2025, 11:49am UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/3 "2025-05-27T11:49:32Z")

</div>

> [@Square-Dev-AI](#):
>
> If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.

Nope this is not working for me. If someone from your dev team can help it will be better.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [May 27, 2025, 4:37pm UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/4 "2025-05-27T16:37:33Z")

</div>

If you try something like this do you still get the error?:

```auto
func makePaymentParameters() -> PaymentParameters {
    let params = PaymentParameters(
        idempotencyKey: UUID().uuidString,
        amountMoney: Money(amount: 100, currency: .USD),
        processingMode: .cardPresent // Change from autoDetect to cardPresent
    )
    params.note = "Test Payment" // Add a note for tracking
    params.referenceID = "REF_\(UUID().uuidString)" // Add a reference ID
    return params
}

```

🙂

---

<div class="post-metadata">

**Author:** ![pariesh](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@pariesh](https://developer.squareup.com/forums/u/pariesh)\
**Post date:** [May 28, 2025, 4:32am UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/5 "2025-05-28T04:32:09Z")

</div>

Still Not working.

Type ‘ProcessingMode’ has no member ‘cardPresent’

I am using [Authorize the Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk/ios/configure-authorize)  
This sdk for iOS. Please suggest accordingly

 ![Screenshot 2025-05-28 at 10.00.52 AM](https://global.discourse-cdn.com/square/original/2X/a/aa97e758713dc75ed9a5967abe4d79b5c70c2a49.jpeg)

---

<div class="post-metadata">

**Author:** ![pariesh](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@pariesh](https://developer.squareup.com/forums/u/pariesh)\
**Post date:** [May 28, 2025, 4:35am UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/6 "2025-05-28T04:35:58Z")

</div>

It has only 3 option

 ![Screenshot 2025-05-28 at 10.05.30 AM](https://global.discourse-cdn.com/square/original/2X/5/5e2bcb047a6a2c68cc90272bc764459ce95fc229.jpeg)

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [May 28, 2025, 3:23pm UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/7 "2025-05-28T15:23:50Z")

</div>

What’s your application ID and the location\_id your trying to take a payment with? 🙂

---

<div class="post-metadata">

**Author:** ![pariesh](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@pariesh](https://developer.squareup.com/forums/u/pariesh)\
**Post date:** [May 29, 2025, 4:41am UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/8 "2025-05-29T04:41:44Z")

</div>

Application id - sq0idp-zA-e5d8W3Sb7k19qCMV-eg  
Location id - “L2XH7G705DRMJ”

---

<div class="post-metadata">

**Author:** ![pariesh](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@pariesh](https://developer.squareup.com/forums/u/pariesh)\
**Post date:** [May 30, 2025, 4:42am UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/9 "2025-05-30T04:42:53Z")

</div>

Any update on this? we are stuck

---

<div class="post-metadata">

**Author:** ![pariesh](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@pariesh](https://developer.squareup.com/forums/u/pariesh)\
**Post date:** [June 4, 2025, 2:02pm UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/10 "2025-06-04T14:02:53Z")

</div>

Any update on this? We have been waiting for a long time. And our app is not working. I would request you to provide a solution here.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [June 4, 2025, 4:55pm UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/11 "2025-06-04T16:55:45Z")

</div>

Are you connected to the integration with OAuth? 🙂

---

<div class="post-metadata">

**Author:** ![pariesh](https://avatars.discourse-cdn.com/v4/letter/p/74df32/32.png) [@pariesh](https://developer.squareup.com/forums/u/pariesh)\
**Post date:** [June 5, 2025, 4:43am UTC](https://developer.squareup.com/forums/t/squaremobilepayment-sdk-for-ios-payment-not-going-through/22524/12 "2025-06-05T04:43:14Z")

</div>

Yes Oauth connected. Square sdk authorized. Reader connected. Payment screen presented but payment failed
