Skip to main content

Validate Referral Code API

Overview

Validate a referral code to check if it exists, is active, and is valid for the specified user type. This API performs comprehensive validation including code existence, user type compatibility, and company scoping. It's typically used during user registration or before applying a referral code to ensure the code is valid and can be used.

API Details

Endpoint

POST https://api.gafapay.com:8443/gafapay/v3/reward_promotion/validate_referral_code

Headers

companyid: 59388167894b4d10a04fe5da3b8a2104
content-type: application/json
requestid: 5bb30135-1815-41d5-827f-baed3daba4ae

Request Body

Required Parameters

  • company_id (String): Company identifier (passed in header)

Request Body Fields

  • referral_code (String): Referral code to validate
    • Example: "C273551489XA"
    • Description: The referral code that needs to be validated
  • user_type (Integer): User type for validation
    • 2 = Customer
    • 3 = Merchant
    • 5 = Agent
    • Example: 2
    • Description: The type of user who wants to use the referral code

Request Body Example

{
"referral_code": "C273551489XA",
"user_type": 2
}

Response

Success Response

{
"success": 1,
"error": [],
"data": {
"message": "Reward promotion referal code validate"
}
}

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 referral code is valid

Error Responses

Bad Request

{
"success": 0,
"error": ["BAD_REQUEST"],
"data": {}
}

Invalid Referral Code

{
"success": 0,
"error": ["REWARD_PROMOTION_REFERRAL_CODE_INVALIDATED"],
"data": {}
}

Example Usage

Basic Validation Request

curl 'https://api.gafapay.com:8443/gafapay/v3/reward_promotion/validate_referral_code' \
-H 'accept: application/json, text/plain, */*' \
-H 'companyid: YOUR_COMPANY_ID' \
-H 'content-type: application/json' \
-H 'requestid: YOUR_REQUEST_ID' \
-H 'signature: YOUR_SIGNATURE' \
--data-raw '{"referral_code":"C273551489XA","user_type":2}'

Customer User Validation

curl 'https://api.gafapay.com:8443/gafapay/v3/reward_promotion/validate_referral_code' \
-H 'accept: application/json' \
-H 'companyid: YOUR_COMPANY_ID' \
-H 'content-type: application/json' \
-H 'requestid: YOUR_REQUEST_ID' \
--data-raw '{
"referral_code": "C273551489XA",
"user_type": 2
}'

Merchant User Validation

curl 'https://api.gafapay.com:8443/gafapay/v3/reward_promotion/validate_referral_code' \
-H 'accept: application/json' \
-H 'companyid: YOUR_COMPANY_ID' \
-H 'content-type: application/json' \
-H 'requestid: YOUR_REQUEST_ID' \
--data-raw '{
"referral_code": "MERCHANT123ABC",
"user_type": 3
}'

Agent User Validation

curl 'https://api.gafapay.com:8443/gafapay/v3/reward_promotion/validate_referral_code' \
-H 'accept: application/json' \
-H 'companyid: YOUR_COMPANY_ID' \
-H 'content-type: application/json' \
-H 'requestid: YOUR_REQUEST_ID' \
--data-raw '{
"referral_code": "AGENT456DEF",
"user_type": 5
}'

Response Messages

  • Reward promotion referal code validate: Successful validation
  • BAD_REQUEST: Invalid or missing required parameters
  • REWARD_PROMOTION_REFERRAL_CODE_INVALIDATED: Referral code validation failed

Notes

  • Real-time Validation: Provides immediate feedback on code validity
  • Multi-tenant Support: All validations scoped to company_id
  • User Type Specific: Codes are validated against specific user types