Coder Social home page Coder Social logo

Comments (4)

harry-brown-cko avatar harry-brown-cko commented on July 24, 2024

Hi Kevin,

We're sorry to hear that you're experiencing issues with our SDK. We can see from our end that for your app you are using our SDK in headless mode and which errors are being raised, those being phone_number_invalid, phone_number_length_invalid and cvv_invalid.

Frames.NetworkError error 0 is a validation error returned from our backend. Note that in headless mode we currently do not validate input data before making the token request. We recommend these steps to avoid these errors in future:

Phone number validation

The tokens API has strict limits on phone number lengths. Please see here

We use PhoneNumberKit to validate phone numbers on our prebuilt UI, but only basic validation is required.

CVV Validation

We recommend using Frames.CardUtils.isValid(cvv: String, cardType: CardType) to validate CVVs before making calls to Frames.CheckoutAPIClient.createCardToken().

Reading errors after token request

It is also possible to react to errors returned from our SDK and prompt the user to fix invalid fields. Please see below:

checkoutApiClient.createCardToken(card: card) { result in
  if case .failure(.checkout(_, _, let errorCodes)) = result {
    for errorCode in errorCodes {
      switch errorCode {
      case "card_number_invalid":
        // handle error
      case "cvv_invalid":
        // handle error
      case "card_expired":
        // handle error
      case "payment_method_invalid":
        // handle error
      case "card_expiry_year_invalid":
        // handle error
      case "request_json_invalid":
        // handle error
      case "card_expiry_year_required":
        // handle error
      case "card_expiry_month_invalid":
        // handle error
      case "phone_number_invalid":
        // handle error
      case "phone_number_length_invalid":
        // handle error
      default:
        continue
      }
    }
  }
}

from frames-ios.

kevinpalser avatar kevinpalser commented on July 24, 2024

Thank you for your prompt response Harry. We'll update our implementation based on your response and extend our error logging.

from frames-ios.

ehab-al-cko avatar ehab-al-cko commented on July 24, 2024

Hi @kevinpalser, please let us know if you need more support. Thanks

from frames-ios.

patrick-hoban-cko avatar patrick-hoban-cko commented on July 24, 2024

Hi @kevinpalser - closing this now, but please do let us know if there's anything else we can do to help.

from frames-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.