Skip to main content

General Error Model & Codes

Description

All payment services (

  • /pws/paymentSet,
  • /pws/payment,
  • /pws/paymentOptions,
  • /pws/payment/commit,
  • /pws/payment/transaction,
  • /pws/payment/cancel,
  • /pws/payment/refund

share a common error model.

All responses returned from the services are provided in a standard JSON structure, along with an HTTP status code and an operation message, depending on the result of the transaction.

For failed operations, isSuccess = false is returned, and the errorCode and errorMessage fields specify the error details.

Some errors may appear both at the transaction level (data.errorCode) and at the service level (errors[]).

Response Structure

The basic response structure for all services is as follows:

{`  
`"message": "Açıklama metni",`
`"statusCode": 400,`
`"exceptions": null,`
`"data": null,`
`"oldData": null,`
`"errors": [`
`{`
`"code": "P001",`
`"message": "Geçersiz istek parametresi"`
`}`
`]`
`}`
Field NameTypeDescription
messagestringGeneral information or error message
statusCodeintHTTP status code (e.g. 200, 400, 401, 404, 500)
exceptionsobjectApplication-level captured exception (optional)
dataobjectSuccessful operation response data
oldDataobjectPrevious record information in update scenarios
errorsarrayMay contain multiple error objects (with code and message fields)

Error Codes

CodeHTTP StatusDescriptionExample Scenario
P001400Invalid request parameterRequired fields are missing or sent in an invalid format
P002401Unauthorized accessInvalid or expired AccessToken
P003403Permission deniedUser is not authorized to perform the operation
P004404Record not foundThe reference code to be canceled/refunded does not exist
P005409Transaction conflictDuplicate request sent for the same operation (e.g. double refund)
P006422Transaction validation errorCard number, BIN, or amount is invalid
P007429Too many requestsToo many requests sent in a short time
P008500System errorAn unexpected server-side error occurred
P009503Bank service unavailableProvisioning system or bank API is temporarily unavailable
P010504TimeoutBank or payment gateway response timed out
P011600Payment failedBank declined the transaction (e.g. insufficient limit, 3D failure)
P012601OTP errorUser authentication failed during the 3D Secure step
P013602Cancellation failedThe transaction to be canceled was not approved by the bank
P014603Refund failedRefund request was rejected by the bank
P015604Partial refund limit exceededTotal refund amount exceeds the original transaction amount
P016605Unsupported transaction typeInvalid transaction type specified in request parameters
P017606Transaction already completedA transaction was resent with the same reference
P018607BIN undefinedThe provided BIN number is not defined in the system
P019608POS not foundNo valid POS definition exists in the relevant payment set
P020609Exchange rate errorCurrency is not supported or exchange rate not found

Notes & Best Practices

  • Operations returning StatusCode 200 are considered systemically successful. However, the transaction result received from the bank may have data.isSuccess=false.

  • errorMessage is a short description that can be shown to the user. The exceptions field is intended only for error tracking/logging.

  • For bank-related errors (P011–P015), detailed explanations are provided in the errorMessage field.

  • For operations performed using referenceCode, invalid codes return a 404 - P004 error.

  • During error handling, the client side should evaluate both statusCode and errorCode together.

  • All error codes must remain fixed to ensure backward compatibility.