When interacting with the Fapshi Payment API, it’s important to understand how the system responds to different types of requests. This helps in properly handling errors and managing successful transactions within your application.
✅ Successful Requests
Any successful request made to the API will return an HTTP status code of200, indicating that the operation was processed correctly.The content of the response body will vary depending on the endpoint you called, but you can always expect structured data in a JSON format. Example response for a successful request:
❌ Failed Requests
If something goes wrong, Fapshi will return a 4XX HTTP error code, depending on the nature of the issue:- 400 – Bad Request (e.g., missing or malformed parameters)
- 403 – Forbidden (e.g., invalid credentials)
- 404 – Not Found (e.g., resource doesn’t exist)
- 429 – Too Many Requests (e.g., rate limit exceeded)
message field that gives a clear explanation of the failure reason.
Example error response:
IP Whitelisting
If one or more IP addresses are whitelisted on the Fapshi dashboard, only servers using those IPs can make transaction creation requests: When one or more IP addresses are whitelisted, a transaction creation request from a server whose IP is not on the whitelist receives a 403 response—even if your API credentials are valid. This applies only to the transaction creation endpoints listed above; other API requests are not subject to IP whitelisting. If your server’s IP address changes frequently, it is preferable not to whitelist any specific IP address. IP whitelisting is a security measure that prevents unrecognized servers from creating transactions using your API credentials.🔁 Request Formatting Guidelines
To avoid unexpected failures, keep in mind the following formatting rules:- All request bodies must be JSON encoded.
- GET requests must not contain a body. If you include a body in a GET request, the API will immediately return an error.
You can find SDK implementations of all API endpoints in different programming languages in our GitHub SDK repository.
Need help? Contact us at support@fapshi.com or visit our Help & Support Center.