Error handling

A breakdown of our error handling to prevent your Gateway integration from breaking down

Understanding the response structure

A typical API response will follow the following structure unless explicitly mentioned in the API Reference:

{
    "code": 0,
    "data": {
        ...
    },
    "message": "SUCCESS"
}

Here, a code 0 means that the API returned a success response. We also added an explicit "SUCCESS" message to make it obvious.

Error codes and messages to expect

We have dedicates codes for different errors handled by us to enable our Gateway partners to write custom handling on top of them. All such errors are listed below:

TitleError CodeError MessageHTTP Status
InvalidRequest4000invalid_request400
PartnerInactive4001partner_inactive401
GuestNotAllowed4003guest_not_allowed401
InteractionExpired4004interaction_expired401
InvalidIntent4005invalid_intent400
InvalidInteraction4006invalid_interaction400
InvalidIntentConfig4007invalid_intent_config400
ApiSecretMismatch4008api_secret_mismatch401
InvalidAuthToken4009invalid_auth_token401
InvalidLender4010invalid_lender401
LIDValidationFailed4011intent_not_allowed400
InvalidReferrer4012invalid_referrer401
NoActiveStocksLoan4015no_active_stocks_loan400
WithdrawApplicationNotApproved4201intent_not_allowed400
WithdrawApplicationInactive4202intent_not_allowed400
WithdrawClosureUnderProcess4203intent_not_allowed400
WithdrawLoanClosed4204intent_not_allowed400
WithdrawMultipleDisbursementNotAllowed4205multiple_disbursement_not_allowed401
WithdrawNoCashAvailableForWithdrawal4206no_cash_available_for_withdrawal401
WithdrawAmountNotWithinLimit4207withdrawal_amount_not_within_limit401
WithdrawNotAllowedInCaseOfShortfall4208withdrawal_not_allowed_in_case_of_shortfall401
WithInvalidPAN4209Invalid PAN shared. Please share individual PAN401
LenderProductTypeMismatch4301lender_product_type_mismatch400
InvalidLenderProductTypeCombination4302invalid_lender_and_product_type_combination400
InvalidProductType4303invalid_product_type400
TopUpNotAllowed4308top_up_not_allowed400
InvalidAssetType4309invalid_asset_type400
PhoneAlreadyUsed3002Phone already used403
InternalServerError2000internal_server_error500
UserCancelled1012user_cancelled200
ContactSupport1031contact_support200

Smart context in client-side errors

It is infuriating when an API returns "Invalid request payload" without specifying exactly what was wrong with the payload. We are well-versed with this issue and figured out an ingenious solution.

We append the error message with a suffix to provide additional context on what was specifically wrong with the request when throwing a client-side error (i.e. HTTP 4xx).

This will save our Gateway partners from integrating with dozens of error codes even for simple integrations, and, at the same time, allow a more advanced error handling for Gateway partners who want to take things to the next level.

Note that the error codes will remain the same. The suffix will only be added to the error message to provide additional context on the error.

TitleSuffixResulting Error Message
InvalidPartnerpartnerinvalid_request:partner
InvalidIntentintentinvalid_request:intent
InvalidInteractioninteractioninvalid_request:interaction
InvalidUserIduserIdinvalid_request:userId
InvalidLIDlidinvalid_request:lid
InvalidFlowIdflowIdinvalid_request:flowId
InvalidIntentConfigintent_configinvalid_request:intent_config
InvalidSDKTypesdk_typeinvalid_request:sdk_type
InvalidSDKVersionsdk_versioninvalid_request:sdk_version
InvalidWebhookEventwebhookEventinvalid_request:webhookEvent
InvalidLenderlenderinvalid_request:lender
PhoneAlreadyUsedphone_already_usedinvalid_request:phone_already_used
AuthContactRequiredauth_contact_requiredinvalid_request:auth_contact_required
PartnerWebhook-partnerWebhook