PlexySDK DOCS

Error Codes

API error types and codes

Error Codes

Understand and handle errors returned by the Plexy API.

Error structure

{
  "error": {
    "type": "invalid_request_error",
    "code": "parameter_missing",
    "message": "Missing required parameter: amount",
    "param": "amount",
    "request_id": "req_abc123"
  }
}
FieldDescription
typeError category
codeSpecific error code
messageHuman-readable description
paramParameter that caused error (if applicable)
request_idUnique request identifier

Error types

api_error

Server-side errors. Usually temporary - retry with backoff.

CodeDescription
api_errorGeneral API error

invalid_request_error

Client-side request errors. Fix the request and retry.

CodeDescription
parameter_missingRequired parameter not provided
parameter_invalidParameter value is invalid
parameter_unknownUnrecognized parameter
resource_missingReferenced resource doesn't exist
idempotency_errorIdempotency key reused with different params

authentication_error

API key or authentication problems.

CodeDescription
api_key_invalidInvalid API key
api_key_expiredAPI key has expired
api_key_revokedAPI key was revoked

card_error

Payment card issues. Display message to customer.

CodeDescription
card_declinedCard was declined
expired_cardCard has expired
incorrect_cvcCVC is incorrect
incorrect_numberCard number is incorrect
insufficient_fundsCard has insufficient funds
processing_errorError processing card

Handling errors

The API always returns an error object in the response body for non-2xx responses. Check the HTTP status code first, then inspect error.type and error.code:

curl -X POST https://api.plexypay.com/v2/payments \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 5000, "currency": "USD", "payment_method": "pm_card_visa"}'

Example error response:

{
  "error": {
    "type": "card_error",
    "code": "card_declined",
    "message": "Your card was declined.",
    "request_id": "req_abc123"
  }
}
HTTP statuserror.typeAction
402card_errorShow error.message to the customer
400invalid_request_errorFix the request parameters
401authentication_errorCheck your API key configuration
500–503api_errorRetry with exponential backoff

Customer-facing messages

Map error codes to user-friendly messages:

CodeCustomer Message
card_declined"Your card was declined. Please try a different card."
expired_card"Your card has expired. Please use a valid card."
incorrect_cvc"The security code is incorrect. Please check and try again."
insufficient_funds"Your card has insufficient funds. Please try a different card."
processing_error"An error occurred processing your card. Please try again."

See also

On this page