{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars/sdk_sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["code-group"]},"type":"markdown"},"seo":{"title":"Completing OTP verification","description":"The specifications of Ratepay's APIs for easy payment transactions.","siteUrl":"https://docs.ratepay.com","keywords":"Ratepay developer portal, Ratepay api portal, Ratepay api reference docs","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"completing-otp-verification","__idx":0},"children":["Completing OTP verification"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Some payments require the buyer to complete one-time password (OTP) verification before the authorization can be confirmed."," ","When OTP verification is required, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client.authorize()"]}," returns ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AuthorizeOutcome.OtpRequired"]}," instead of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Accepted"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Declined"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"check-if-otp-verification-is-required","__idx":1},"children":["Check if OTP verification is required"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Check the authorization outcome to determine whether OTP verification is required."]},{"$$mdtype":"Tag","name":"CodeGroup","attributes":{"mode":"tabs"},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","data-title":"Java","header":{"title":"Java","controls":{"copy":{}}},"source":"switch (outcome.kind()) {\n    case OTP_REQUIRED -> {\n        var otp = (AuthorizeOutcome.OtpRequired) outcome;\n        System.out.println(otp.getOtpDetails().getMessage().getEn());\n    }\n    // ... ACCEPTED, DECLINED\n}\n","lang":"java"},"children":[]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","data-title":"Kotlin","header":{"title":"Kotlin","controls":{"copy":{}}},"source":"when (outcome) {\n    is AuthorizeOutcome.OtpRequired -> println(outcome.otpDetails.message.en)\n    // ... Accepted, Declined\n}\n","lang":"kotlin"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The returned ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["otpDetails"]}," object contains information needed to complete the verification process:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Field"},"children":["Field"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["links.verify"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Link to the API resource for verifying the OTP."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["links.regenerate"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Link to the API resource for requesting a new OTP."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message.en"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["message.de"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Localized message to display to the buyer."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["regenerationPossibleInSeconds"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional waiting period, in seconds, before a new OTP can be requested."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["timeToLiveInSeconds"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Optional validity period of the OTP, in seconds."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"verify-or-regenerate-an-otp","__idx":2},"children":["Verify or regenerate an OTP"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK provides the following methods for completing or restarting OTP verification:"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Method"},"children":["Method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Purpose"},"children":["Purpose"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Return type"},"children":["Return type"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["verifyOtp(String, String)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Submit an OTP for verification."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OtpVerificationOutcome"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["regenerateOtp(String)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Request a new OTP."]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OtpRegenerationOutcome"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Both methods return typed ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Accepted"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Declined"]}," outcomes. OTP-related errors may also throw ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RatepayOtpException"]},", which includes an ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["otpError"]}," property."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":3},"children":["Next steps"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/developer/sdk/guides/capturing-a-transaction"},"children":["Capture"]}," a payment once authorization is accepted."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Learn how to handle SDK and API ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/docs/developer/sdk/errors-and-resilience/exception-hierarchy"},"children":["errors"]},"."]}]}]},"headings":[{"value":"Completing OTP verification","id":"completing-otp-verification","depth":1},{"value":"Check if OTP verification is required","id":"check-if-otp-verification-is-required","depth":2},{"value":"Verify or regenerate an OTP","id":"verify-or-regenerate-an-otp","depth":2},{"value":"Next steps","id":"next-steps","depth":2}],"frontmatter":{"seo":{"title":"Completing OTP verification"}},"lastModified":"2026-11-03T16:26:45.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/developer/sdk/guides/completing-otp-verification","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}