3

I am currently enountering a weird error with Stripe, on my iOS Xcode project.

I am attempting to set a Customer's default payment source (for a future payment), and everything was working, until recently when suddenly it stopped working.

@objc func savePayment() {
    
    print("what the vurky?")
    
    // Collect card details
    let cardParams = cardTextField.cardParams
    // Fill in any billing details...
    let billingDetails = STPPaymentMethodBillingDetails()

    // Create SetupIntent confirm parameters with the above
    let paymentMethodParams = STPPaymentMethodParams(card: cardParams, billingDetails: billingDetails, metadata: nil)
    let setupIntentParams = STPSetupIntentConfirmParams(clientSecret: setupIntentClientSecret!)
    setupIntentParams.paymentMethodParams = paymentMethodParams

    // ...continued in next step
    // Complete the setup
    let paymentHandler = STPPaymentHandler.shared()
    
    print(paymentMethodParams, "paymentHandler = STPPaymentHandler?", setupIntentClientSecret, "hcaca face", setupIntentParams)

    paymentHandler.confirmSetupIntent(setupIntentParams, with: self) { status, setupIntent, error in
        switch (status) {
        case .failed:
            // Setup failed
            print("Setup failed status?")

            break
        case .canceled:
            // Setup canceled
            print("Setup canceled status?")

            break
        case .succeeded:
            // Setup succeeded
            print("setup sucessex!")
            break
        @unknown default:
            fatalError()
            break
        }
    }

}

I have no idea why it suddenly stopped working, as I had not touched the code in a week essentially. Anyways, I checked if the Firebase Cloud Functions were relevant but they were not. I have tried reverting code to ones that had worked before, and they also have the error:

CredStore - performQuery - Error copying matching creds.  Error=-25300, query={
    class = inet;
    "m_Limit" = "m_LimitAll";
    ptcl = htps;
    "r_Attributes" = 1;
    sdmn = Stripe;
    srvr = "api.stripe.com";
    sync = syna;
}

which appears when I call the function. Note that in the switch status, it comes out as .failed.

I have looked at most of the existing SO questions, yet none of them have solved it, only 1 mentioned Stripe, and it did not fix it. CredStore Perform Query error

Kev Wats
  • 896
  • 1
  • 5
  • 13
  • That error does seem like it's mostly related to not setting an API key, so I would double check that part of the code and log out the exact values you set when you call `setDefaultPublishableKey` for the library. Maybe something changed in how your app is configured and the key isn't being loaded. Also, you should log the `setupIntentClientSecret` — I see you do that, does it look normal (si_xxx_secret_yyy) or is it nil? – karllekko May 25 '21 at 09:50
  • yes it is normal, and yes just now I tested inputting a PublishableKey (which i didn't have to before...), and it still gives me the error... it is so odd! – Kev Wats May 26 '21 at 03:21

0 Answers0