verifyOtp
Overview
verifyOtp submits the OTP code the cardholder typed. On success, the
FlowSession holds the new virtualCardId and the enrollment is complete.
If the wallet requires further verification, the result returns additional
verificationMethods instead of a virtualCardId.
Signature
const result = await fap.verifyOtp(session, code, options);
Parameters
-
session(FlowSession, required) — The session fromtriggerOtp. -
code(string, required) — The OTP code the cardholder entered. -
options(object) — OptionalCallOptions:apiTokenOverride,signal.
Returns
Promise<VerifyOtpResult>
-
session(FlowSession) — The advanced session. -
virtualCardId(string | null) — Set when verification completed enrollment.nullwhen more verification is required. -
verificationMethods(array | null) — Returned (instead ofvirtualCardId) when the wallet asks for additional verification.nullotherwise.
Example
// `session` here is the advanced session returned by triggerOtp.const {session: verifiedSession,virtualCardId,verificationMethods} = await fap.verifyOtp(session, codeTheUserEntered);if (virtualCardId) {// Enrollment complete — continue to createIntent with verifiedSession.} else if (verificationMethods) {// The wallet asked for another verification step — carry verifiedSession forward.}
Errors
- Wrong OTP code (
400 BadRequest). An incorrect code is treated as a failure: the call rejects with a REST400 BadRequesterror surfaced through the SDK — the network (VTS) reports a wrong OTP asBadRequest, not a distinctInvalidOtpliteral on this path. It does not resolve with anullvirtualCardId. Catch it and prompt the cardholder to re-enter the code (you may calltriggerOtpagain to resend). AnullvirtualCardIdon a resolved result means enrollment needs a further step (seeverificationMethods), not a bad code. - 503 / timeout / abort. As with the other calls, an unavailable service,
an exceeded
timeoutMs, or an abortedoptions.signalreject the promise.
Related
triggerOtp— send the codecreateIntent— next step- Verify Enrollment API