The integration of FedaPay’s payment solution relies on sending HTTPS requests to its servers. To ensure that your platform functions correctly in both test and production mode, it’s essential to understand how these requests should be structured, and what responses you can expect.

HTTPS request structure

When you interact with the FedaPay API, your HTTPS requests must follow a specific structure to be processed correctly. FedaPay provides two environments: a test environment and a live environment. Each environment has its own set of API keys (test and live), and each API key must be used according to the environment in which you are operating.

HTTPS methods supported

The FedaPay API supports several HTTP methods, the main ones being :

  • POST : To send data and create new resources (e.g. a new transaction).

  • GET : To retrieve existing information or resources (e.g. transaction details).

  • PUT : Used to update an existing resource with new information (for example, to update transaction details).

  • DELETE : Used to delete an existing resource (e.g. cancel a transaction).

Server URLs

Used to perform tests with no real impact on your account.

 https://sandbox-api.fedapay.com

Authentication

You must include your API key in the HTTP header of each request. Depending on whether you’re in test or live mode, you’ll use one of two keys:

Authorization: Bearer YOUR_API_KEY

Test Mode vs Live Mode

Test mode

Before switching to Live mode, we recommend that you test your integration in test mode. This mode allows you to simulate various payment operations without carrying out any real transactions. You need to create a test account, and use the test API keys to address your requests to the test environment.

  • Test API keys: These keys can only be used on the test server.

  • Test transactions: Simulate transactions with fictitious cards and phone numbers to see how your system reacts.

Live mode

Once you’ve validated your tests, you can go live with your API keys. This mode enables you to carry out real transactions with your customers.

Test numbers for cards and mobile money

To test your integration, FedaPay provides you with card numbers and telephone numbers to simulate successful and failed payments. You should use these numbers in test mode only.

NuméroType de carteScénario
4111111111111111VisaSuccès
4242424242424241VisaÉchecs
5555555555554444MastercardSuccès
4242424242424242VisaEchecs

API responses

Every request you send to the FedaPay API receives a response, whether you’re in test or live mode. These responses are formatted in JSON and contain important information about the result of your request.

Successful response (200)

A successful response is usually an HTTP 200 code, and includes details of the resource created or consulted.

Response in case of error

If an error occurs (wrong API key, ill-formed request, etc.), the API returns a specific error code (for example, 400, 401, 404, 500).

Error management

For optimum management of your transactions, here are a few recommended practices in the event of errors:

  • 400 Bad Request: Check that your parameters are properly formatted and comply with API specifications.

  • 401 Unauthorized: Make sure you’re using the correct API key (test or live) and that it’s valid.

  • 404 Not Found: Check that the URL you are using is correct and that the resource exists.

  • 500 Internal Server Error: These errors originate from the FedaPay API. If they persist, please contact support.

Rigorously testing your integration with FedaPay before going live is essential to ensure smooth operation. Use the appropriate API keys, follow the request structure and take into account API responses to ensure successful integration.