SwitchApp API
  • Introduction
  • Quick Start
  • Authentication
  • Errors
  • Metadata
  • Pagination
  • Versioning
  • No-code solutions
  • Webhooks
  • Payments
    • Transactions
      • Initialize a transaction
      • Verify transaction
      • List transactions
      • Retrieve Transaction
      • Transaction Webhooks
  • Payment Providers
    • Payment Providers
  • Countries & Currencies
    • Countries
    • Currencies
  • Products
    • Products
      • Create a product
      • Retrieve a product
      • Update a product
      • List all products
      • Delete a product
  • Customers
    • Customers
      • Create Customer
      • List Customers
      • Fetch Customer
      • Update Customer
      • Delete/Archive Customer
  • Payment Links
    • Payment Links
      • Create a payment link
      • Fetch payment link
      • Update a payment link
      • List all payment links
      • Delete a payment link
  • Payouts
    • Payouts
      • List Payouts
      • Fetch Payout
      • Retry Payout
  • BALANCES
    • Balances
      • Fetch all balances
      • Fetch a balance
      • Fetch currency balance
  • DISBURSEMENTS
    • Disbursements (Transfers)
      • Batch Disbursements
        • Initiate A Disbursement
        • List Batch Transfers
        • Fetch A Batch
        • Requeue All Failed Transfers
      • Single Disbursements
        • Fetch List By Batch Reference
        • Fetch All Singles By Page
        • Fetch A Single Disbursement
        • Fetch fee
        • Fetch rate
    • Beneficiaries
      • Create a beneficiary
      • List all beneficiaries
      • Fetch a beneficiary
      • Delete a beneficiary
    • Banks
      • Bank list
      • Bank slugs
      • Resolve account details
  • VIRTUAL ACCOUNTS
    • Virtual Accounts
      • Top-up virtual accounts
        • Fetch providers
        • Create top-up account
        • List accounts
        • Fetch account
        • Requery account
        • Deallocate account
      • Payment virtual accounts
        • Fetch providers
        • Create payment account
        • Update account details
        • List accounts
        • Fetch account
        • Requery account
        • Deallocate account
Powered by GitBook
On this page

Errors

Learn how to handle and display errors returned by our API.

SwitchApp returns a standardized response format for every request. This format indicates when a request completes successfully and when it fails. A standard SwitchApp response consists of a status, message, data and errors object. These are accompanied by a corresponding HTTP response code:

  • Codes in the 2xx range indicate success.

  • Codes in the 4xx range indicate an error. Usually, a failed request will indicate the reason for failure in its message (e.g., unauthorized access - API key absent, a required parameter was omitted, etc.).

  • Codes in the 5xx range indicate an error with SwitchApp's servers (these rarely occur, but should be reported to us when encountered).

Along with error codes, the errors object is helpful if the request fails initial validation. The object consists of properties whose names indicate the failed fields while their values are string arrays containing all the validation failures. This eases client-side form validation.

NOTE: Always structure your code to handle API errors and exceptions thrown from our library eg by checking the response status before attempting to consume the data, or by using a handled try-catch block. This will ensure your application does not crash when a validation error occurs or an exception is thrown.

PreviousAuthenticationNextMetadata

Last updated 2 years ago