Skip to content

Response Envelope & Errors

Every SecPaid API response follows a consistent JSON envelope structure.

Standard Response Envelope

All successful and error responses share this format:

{
  "ResponseCode": 1,
  "ResponseMsg": "Human-readable message",
  "Result": "True",
  "ServerTime": "CEST"
}
Field Type Description
ResponseCode integer 1 = success, 0 = error
ResponseMsg string Human-readable status message (may be localized)
Result string "True" on success, "False" on error
ServerTime string Server timezone abbreviation (e.g., CEST, CET)

Success Response

Successful responses include additional data fields depending on the endpoint:

{
  "ResponseCode": 1,
  "ResponseMsg": "Link created successfully",
  "Result": "True",
  "ServerTime": "CEST",
  "data": {
    "linktopay_id": 12345,
    "pay_link": "https://app.secpaid.com/payment?link_id=MTIzNDU=",
    "amount": "49.99"
  }
}

For list endpoints, you may also see:

{
  "ResponseCode": 1,
  "ResponseMsg": "List retrieved successfully",
  "Result": "True",
  "ServerTime": "CEST",
  "data": [...]
}

Error Response

{
  "ResponseCode": 0,
  "ResponseMsg": "Amount is required",
  "Result": "False",
  "ServerTime": "CEST"
}

Common Error Messages

ResponseMsg Cause Fix
Incorrect token or missing token Auth header missing or invalid Check your token header value
Please enter token No token header in request Add the token header
Amount is required Missing amount field Include amount in request body
Invalid recipient token at index N Recipient token not found in system Verify recipient tokens exist
Link not found Invalid link_id Use a valid link ID from createLink
This link is already used Attempting to delete a paid link Only unused links can be deleted
Refund amount is required Missing refund_amount in v2 Always provide refund_amount

How to Check for Success

const response = await fetch(url, options);
const json = await response.json();

if (json.ResponseCode === 1 && json.Result === "True") {
  // Success — process json.data
} else {
  // Error — handle json.ResponseMsg
  console.error(json.ResponseMsg);
}

Always check ResponseCode

The HTTP status code is always 200 regardless of business logic success or failure. Use ResponseCode to determine the actual outcome.