Skip to main content

Create Vendor Referral

Create a new referral record linking a merchant to a vendor for commission tracking.

POSThttps://api.zenpayz.com/merchant/api/v1/vendors/:id/referrals
Bearer · API key

Request

Headers

HeaderDescription
Authorization
REQUIRED
Bearer {api_key}
X-Signature
REQUIRED
HMAC-SHA256 signature
X-Timestamp
REQUIRED
ISO 8601 timestamp
X-Secret-Salt
REQUIRED
Secret salt for HMAC validation
Content-Type
REQUIRED
application/json

Path Parameters

ParameterTypeDescription
id
REQUIRED
stringVendor ID (e.g., vnd_a1b2c3d4e5f6g7h8)

Body Parameters

ParameterTypeDescription
merchantId
REQUIRED
stringID of the referred merchant
referralCode
OPTIONAL
stringCustom referral tracking code
referralSource
OPTIONAL
stringSource of the referral (e.g., website, partner_portal, event)
commissionRate
OPTIONAL
numberOverride commission rate for this referral (0-100)
environment
OPTIONAL
stringEnvironment identifier
notes
OPTIONAL
stringAdditional notes about the referral

Response

Success (201 Created)

{
"success": true,
"data": {
"referralId": "ref_j0k1l2m3n4o5p6q7",
"vendorId": "vnd_a1b2c3d4e5f6g7h8",
"merchantId": "mer_m3n4o5p6q7r8s9t0",
"referralCode": "ACME-2024-003",
"referralSource": "partner_portal",
"status": "active",
"commissionRate": 15.0,
"totalTransactions": 0,
"totalRevenue": 0,
"totalCommission": 0,
"environment": "production",
"notes": "Enterprise client referred at FinTech Summit 2024",
"createdAt": "2024-03-21T11:00:00.000Z",
"updatedAt": "2024-03-21T11:00:00.000Z"
},
"message": "Vendor referral created successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-03-21T11:00:00.000Z",
"processing_time_ms": 130,
"api_version": "v1",
"endpoint": "POST /vendors/:id/referrals",
"user_type": "merchant"
}
}

Error Responses

CodeHTTPMessage
VALIDATION_ERROR400Invalid request parameters
UNAUTHORIZED401Invalid API key
VENDOR_NOT_FOUND404Vendor with specified ID does not exist
MERCHANT_NOT_FOUND404Merchant with specified ID does not exist
DUPLICATE_REFERRAL409Referral for this merchant already exists under this vendor

Examples

curl -X POST https://api.zenpayz.com/merchant/api/v1/vendors/vnd_a1b2c3d4e5f6g7h8/referrals \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-03-21T11:00:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt" \
-H "Content-Type: application/json" \
-d '{
"merchantId": "mer_m3n4o5p6q7r8s9t0",
"referralCode": "ACME-2024-003",
"referralSource": "partner_portal",
"commissionRate": 15.0,
"environment": "production",
"notes": "Enterprise client referred at FinTech Summit 2024"
}'