Skip to main content

Create Customer

Create a new customer record for tracking payments and transactions.

POSThttps://api.zenpayz.com/merchant/api/v1/customers
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

Body Parameters

ParameterTypeDescription
email
REQUIRED
stringCustomer email address
phone
OPTIONAL
stringPhone number (10-15 characters)
firstName
OPTIONAL
stringCustomer first name (1-100 characters)
lastName
OPTIONAL
stringCustomer last name (1-100 characters)
dateOfBirth
OPTIONAL
stringDate of birth (YYYY-MM-DD)
country
REQUIRED
stringISO country code
ipAddress
REQUIRED
stringCustomer IPv4 address
deviceFingerprint
OPTIONAL
stringDevice fingerprint for fraud detection (10-255 characters)
userAgent
OPTIONAL
stringBrowser user agent string (1-500 characters)
metadata
OPTIONAL
objectCustom key-value pairs

Response

Success (201 Created)

{
"success": true,
"data": {
"customerId": "cust_a1b2c3d4e5f6g7h8",
"email": "john@example.com",
"phone": "+1234567890",
"firstName": "John",
"lastName": "Doe",
"country": "US",
"status": "active",
"riskLevel": "low",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
},
"message": "Customer created successfully",
"error": null,
"meta": {
"request_id": "req_xxxxx",
"timestamp": "2024-01-15T10:30:00.000Z",
"processing_time_ms": 120,
"api_version": "v1",
"endpoint": "POST /customers",
"user_type": "merchant"
}
}

Error Responses

CodeHTTPMessage
VALIDATION_ERROR400Invalid request parameters
UNAUTHORIZED401Invalid API key
DUPLICATE_CUSTOMER409Customer with email already exists

Examples

curl -X POST https://api.zenpayz.com/merchant/api/v1/customers \
-H "Authorization: Bearer zp_test_xxxxx" \
-H "X-Timestamp: 2024-01-15T10:30:00.000Z" \
-H "X-Signature: a1b2c3d4e5f6..." \
-H "X-Secret-Salt: your_secret_salt" \
-H "Content-Type: application/json" \
-d '{
"email": "john@example.com",
"firstName": "John",
"lastName": "Doe",
"phone": "+1234567890",
"country": "US",
"ipAddress": "203.0.113.42"
}'