# Completing OTP verification Some payments require the buyer to complete one-time password (OTP) verification before the authorization can be confirmed. When OTP verification is required, `client.authorize()` returns `AuthorizeOutcome.OtpRequired` instead of `Accepted` or `Declined`. ## Check if OTP verification is required Check the authorization outcome to determine whether OTP verification is required. ```java Java switch (outcome.kind()) { case OTP_REQUIRED -> { var otp = (AuthorizeOutcome.OtpRequired) outcome; System.out.println(otp.getOtpDetails().getMessage().getEn()); } // ... ACCEPTED, DECLINED } ``` ```kotlin Kotlin when (outcome) { is AuthorizeOutcome.OtpRequired -> println(outcome.otpDetails.message.en) // ... Accepted, Declined } ``` The returned `otpDetails` object contains information needed to complete the verification process: | Field | Description | | --- | --- | | `links.verify` | Link to the API resource for verifying the OTP. | | `links.regenerate` | Link to the API resource for requesting a new OTP. | | `message.en` / `message.de` | Localized message to display to the buyer. | | `regenerationPossibleInSeconds` | Optional waiting period, in seconds, before a new OTP can be requested. | | `timeToLiveInSeconds` | Optional validity period of the OTP, in seconds. | ## Verify or regenerate an OTP The SDK provides the following methods for completing or restarting OTP verification: | Method | Purpose | Return type | | --- | --- | --- | | `verifyOtp(String, String)` | Submit an OTP for verification. | `OtpVerificationOutcome` | | `regenerateOtp(String)` | Request a new OTP. | `OtpRegenerationOutcome` | Both methods return typed `Accepted` or `Declined` outcomes. OTP-related errors may also throw `RatepayOtpException`, which includes an `otpError` property. ## Next steps - [Capture](/docs/developer/sdk/guides/capturing-a-transaction) a payment once authorization is accepted. - Learn how to handle SDK and API [errors](/docs/developer/sdk/errors-and-resilience/exception-hierarchy).