Skip to main content

Verify OTP API

Overview

Verify a One-Time Password (OTP) sent to the user's phone number or email.

API Details

Constants

  • OTP Types:
    • 1 = REGISTRATION
    • 2 = FORGOT LOGIN PIN
    • 3 = FORGOT TRANSACTION PIN
    • 4 = FORGOT PASSWORD
    • 5 = COMMON
    • 6 = EMAIL
    • 7 = LOGIN
    • 8 = OLD PHONE
    • 9 = NEW PHONE
    • 10 = PAYMENT LINK VERIFICATION
    • 11 = ADD CASH MANUALLY
    • 12 = MERCHANT SCAN CUSTOMER QR OR CARD

Endpoint

POST https://api.gafapay.com:8443/gafapay/v3/auth/verify_otp

Headers

Content-Type: application/json
companyId: 59388167894b4d10a04fe5da3b8a2104
ip_address: 127.0.0.1
request_id: b35d332f-131e-44c1-892f-8322e022da74

Request Body

{
"dial_code": "+221",
"phone_number": "968784549",
"user_type": 2,
"otp_type": 7,
"otp": 1234
}

Request Body Fields

  • dial_code (string, required): Country dial code (e.g., "+221")
  • phone_number (string, required): User's phone number
  • otp_type (integer, required): Type of OTP to verify (see Constants section)
  • user_type (integer, required): Type of user
    • 1 = ADMIN
    • 2 = USER
    • 3 = MERCHANT
    • 4 = STAFF
    • 5 = AGENT
  • otp (integer, required): The OTP code to verify

Response

{
"success": 1,
"error": [],
"data": {
"message": "AUTH_OTP_VERIFY_SUCCESSFULLY",
"user_id": "2c6267e21e164b34b63fa6213bc2aa6f",
"token": {
"type": "Token",
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyYzYyNjdlMjFlMTY0YjM0YjYzZmE2MjEzYmMyYWE2ZiIsInJvbGVzIjpbIlJPTEVfQ1VTVE9NRVIiXSwiZXhwIjoxNzU3MDk4MTQ3fQ.v1N4tm8m0kJK8E-bGRVz3D7KCu19z7-WDkbZE8qshDQ"
}
}
}

Response Fields

  • success (integer): Response status indicator
    • 1 = Success
    • 0 = Failure
  • error (array): Array of error messages (empty on success)
  • data (object): Response data object
    • message (string): Success message indicating OTP was verified successfully
    • user_id (string): Unique identifier of the authenticated user
    • token (object): Authentication token information
      • type (string): Token type identifier
      • token (string): JWT token for subsequent API calls

Example Usage

curl --location 'https://api.gafapay.com:8443/gafapay/v3/auth/verify_otp' \
--header 'Content-Type: application/json' \
--header 'companyId: 59388167894b4d10a04fe5da3b8a2104' \
--header 'ip_address: 127.0.0.1' \
--header 'request_id: b35d332f-131e-44c1-892f-8322e022da74' \
--data '{
"dial_code": "+221",
"phone_number": "968784549",
"user_type": 2,
"otp_type": 7,
"otp": 1234
}'