Overview
Theotp.failed event is triggered when an OTP delivery attempt fails. This event always has rejected: true and includes error details along with a resend endpoint for retrying the OTP delivery.
Example Payload
Base Fields
All OTP failed events include these common fields:| Field | Type | Required | Description |
|---|---|---|---|
eventType | string | Yes | Always "otp.failed" |
issuerId | string | Yes | Organization/issuer identifier |
requestId | string | Yes | Request identifier |
subjectId | string | Yes | Subject (user) identifier |
subjectInternalId | string | No | Internal subject identifier |
rejected | boolean | Yes | Always true for OTP failed events |
decisionDate | Date | Yes | Timestamp when the OTP failure was recorded |
OTP Failure Metadata
Themetadata field is required and contains OTP failure details:
| Field | Type | Required | Description |
|---|---|---|---|
contact | string | Yes | Contact information (phone number or email) |
errorCode | string | Yes | Specific error code indicating the failure reason |
errorMessage | string | Yes | Human-readable error message |
resendEndpoint | string | Yes | API endpoint to resend the OTP |
Handling OTP Failures
When you receive anotp.failed event:
- Log the error - Record the
errorCodeanderrorMessagefor debugging - Notify the user - Inform the user about the delivery failure
- Retry if needed - Use the
resendEndpointto attempt OTP delivery again
resendEndpoint provides a direct API path to retry the OTP delivery without requiring the original request details.