Skip to main content

Create Settlement

Create a settlement request to withdraw funds to your bank account.

POSThttps://api.zenpayz.com/merchant/api/v1/settlements/create
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
amount
REQUIRED
numberSettlement amount
bankAccountId
REQUIRED
stringBank account ID to settle to
description
OPTIONAL
stringDescription for the settlement
priority
OPTIONAL
stringSettlement priority
type
OPTIONAL
stringSettlement type
scheduledDate
OPTIONAL
stringISO 8601 date for scheduled settlement

Response

Success (201 Created)

{
"success": true,
"data": {
"settlementId": "stl_xxxxx",
"merchantId": "mer_xxxxx",
"amount": 100000,
"settlementFee": 500,
"netAmount": 99500,
"currency": "USD",
"type": "standard",
"priority": "normal",
"status": "PENDING",
"description": "Monthly settlement",
"bankAccountId": "ba_xxxxx",
"scheduledDate": null,
"createdAt": "2024-01-15T10:30:00.000Z"
}
}

Response Fields

ParameterTypeDescription
settlementId
OPTIONAL
stringUnique settlement identifier
merchantId
OPTIONAL
stringMerchant identifier
amount
OPTIONAL
numberRequested settlement amount
settlementFee
OPTIONAL
numberFee charged for the settlement
netAmount
OPTIONAL
numberAmount after fees
currency
OPTIONAL
stringISO 4217 currency code
type
OPTIONAL
stringSettlement type
priority
OPTIONAL
stringSettlement priority
status
OPTIONAL
stringSettlement status
description
OPTIONAL
stringSettlement description
bankAccountId
OPTIONAL
stringTarget bank account
scheduledDate
OPTIONAL
stringScheduled settlement date, if any
createdAt
OPTIONAL
stringISO 8601 creation timestamp

Error Responses

CodeHTTPMessage
INVALID_AMOUNT400Amount below minimum
UNAUTHORIZED401Invalid API key
INSUFFICIENT_BALANCE402Wallet balance too low
BANK_ACCOUNT_NOT_FOUND404Bank account doesn't exist

Examples

curl -X POST https://api.zenpayz.com/merchant/api/v1/settlements/create \
-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 '{
"amount": 100000,
"bankAccountId": "ba_xxxxx",
"description": "Monthly settlement",
"priority": "normal",
"type": "standard"
}'

Settlement Status

StatusDescription
PENDINGSettlement created, awaiting processing
PROCESSINGBeing processed
COMPLETEDFunds transferred to bank
FAILEDSettlement failed
CANCELLEDSettlement was cancelled