Skip to main content

Verify OTP

Summary

Verifies the OTP received by the user via SMS after a successful call to Init Subscription. On success, the subscription is activated and the first charge is attempted.

Path

POST https://merchants.noju.io/subscriptions/verify

Headers

HeaderRequiredValue
API-KEYyesYour merchant API key.
Content-Typeyesapplication/json

Request body

FieldTypeRequiredDescription
verif_request_idstringyesUUID returned by init API call.
otpstringyesThe OTP the subscriber received via SMS.
languagestringnoBCP-47 / ISO-639-1 language for SMS communications (e.g. en, fr). Defaults to the service's default language.

Success payload

On status: "SUCCESS", payload contains:

FieldTypeDescription
subscription_idstringUUID of the activated subscription. Persist it to query /subscriptions/status.

Errors

HTTPmessageWhen
400BAD_REQUESTBody fails JSON schema validation.
401UNAUTHORIZEDAPI key missing, invalid, or merchant inactive.
403UNAUTHORIZEDSource IP not allowlisted.
403MERCHANT_SERVICE_NOT_CONFIGUREDNo integration for the provided service_code + country_code.
200INVALID_PIN / PIN_EXPIRED / MAX_PIN_RETRIESOTP invalid, expired, or too many attempts.
200INSUFFICIENT_FUNDS / BLACKLISTED / BARRED / NOT_ELIGIBLE / INVALID_USER / ALREADY_SUBSCRIBED / other CarrierErrorOTP was correct but the carrier refused to charge.
500ERRORUnexpected server error.

Examples

Request

{
"verif_request_id": "550e8400-e29b-41d4-a716-446655440000",
"otp": "1234"
}

Success response

{
"status": "SUCCESS",
"message": "",
"status_code": 200,
"payload": {
"subscription_id": "550e8400-e29b-41d4-a716-446655440000"
}
}

Failure response (invalid OTP)

{
"status": "FAIL",
"message": "INVALID_PIN",
"status_code": 200
}

Code samples

curl -X POST 'https://merchants.noju.io/subscriptions/verify' \
-H 'Content-Type: application/json' \
-H "API-KEY: $NOJU_API_KEY" \
-d '{"verif_request_id":"550e8400-e29b-41d4-a716-446655440000","otp":"1234"}'