# Codes de Réponse de l’API

#### Codes de réponse et statuts des transactions

Cette section fournit les **codes de réponse** retournés par le système ainsi que les **statuts possibles des transactions**, avec des explications détaillées pour le champ `result.statusReason`.

### **Response Codes**

<table data-header-hidden data-full-width="false"><thead><tr><th width="111.4000244140625"></th><th width="158.800048828125"></th><th></th></tr></thead><tbody><tr><td><strong>Code</strong></td><td><strong>Reason</strong></td><td><strong>Description</strong></td></tr><tr><td><code>200</code></td><td>OK</td><td>The request was successful.</td></tr><tr><td><code>204</code></td><td>No Content</td><td>The request was successful but has no content to return.</td></tr><tr><td><code>400</code></td><td>Bad Request</td><td>Some content in the request was invalid.</td></tr><tr><td><code>401</code></td><td>Unauthorized</td><td>Authentication is required before making the request.</td></tr><tr><td><code>403</code></td><td>Forbidden</td><td>The current user is not allowed to perform this operation.</td></tr></tbody></table>

### **Transaction Statuses**

<table data-header-hidden data-full-width="false"><thead><tr><th width="237.2000732421875"></th><th></th></tr></thead><tbody><tr><td><strong>Status</strong></td><td><strong>Description</strong></td></tr><tr><td><code>COMPLETED</code></td><td>The transaction was successful, and the funds have been transferred to the recipient.</td></tr><tr><td><code>FAILED</code></td><td>The transaction failed due to an error, such as insufficient funds or a technical issue.</td></tr><tr><td><code>CANCELED</code></td><td>The transaction was canceled by the user or merchant.</td></tr><tr><td><code>PENDING</code></td><td>The transaction is under review, pending verification of the payment source.</td></tr><tr><td><code>PROCESSING</code></td><td>The transaction is being processed and will be completed shortly.</td></tr><tr><td><code>REFUSED</code></td><td>The payment was refused by the payment processor or the recipient.</td></tr><tr><td><code>REVERSED</code></td><td>The transaction was reversed, either by the merchant or the system.</td></tr><tr><td><code>NEEDS_MERCHANT_VALIDATION</code></td><td>The transaction is awaiting validation from the merchant before it can proceed.</td></tr></tbody></table>

#### **`result.statusReason` Field**

The `result.statusReason` field provides additional context for the transaction's status, explaining why a particular status was assigned. Here are some examples of possible values and their meanings:

<table data-header-hidden data-full-width="false"><thead><tr><th width="233.2000732421875"></th><th></th></tr></thead><tbody><tr><td><strong>Status</strong></td><td><strong>Possible Reasons in <code>result.statusReason</code></strong></td></tr><tr><td><code>COMPLETED</code></td><td><code>"Funds successfully transferred"</code></td></tr><tr><td><code>FAILED</code></td><td><code>"Insufficient funds"</code>, <code>"Invalid account number"</code>, <code>"Payment method not supported"</code></td></tr><tr><td><code>CANCELED</code></td><td><code>"Canceled by user"</code>, <code>"Timeout expired before payment completion"</code></td></tr><tr><td><code>PENDING</code></td><td><code>"Verification required"</code>, <code>"Awaiting payment processor response"</code></td></tr><tr><td><code>PROCESSING</code></td><td><code>"Transaction in progress"</code>, <code>"Batch processing scheduled"</code></td></tr><tr><td><code>REFUSED</code></td><td><code>"Recipient refused the payment"</code>, <code>"Fraud detected by payment processor"</code></td></tr><tr><td><code>REVERSED</code></td><td><code>"Transaction reversed by merchant"</code>, <code>"Customer requested a chargeback"</code></td></tr><tr><td><code>NEEDS_MERCHANT_VALIDATION</code></td><td><code>"Awaiting merchant's manual approval"</code></td></tr></tbody></table>

### **Example Response**

Here’s an example of a response object with the `result.statusReason` field:

```json
{
  "id": "63a368858622d5ded108e4b3",
  "result": {
    "status": "FAILED",
    "statusReason": "Insufficient funds"
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.centralbill.app/centralbill-payment-api/codes-de-reponse-de-lapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
