> ## Documentation Index
> Fetch the complete documentation index at: https://docs.archefusion.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors

> Learn how to troubleshoot errors you encounter when integrating the Archefusion API

If an API request fails, Archefusion returns a clear error response to help you identify the issue and debug faster. The error response follows a consistent structure:

| Field      | Type    | Description                                                          |
| ---------- | ------- | -------------------------------------------------------------------- |
| success    | Boolean | Indicates the status of the request.                                 |
| statusCode | Number  | Indicates the outcome of the request.                                |
| message    | String  | Indicates the reason why the request failed.                         |
| data       | Object  | Contains additional details about the reason why the request failed. |

**Example:**

```json theme={null}
{
    "success": false,
    "statusCode": 400,
    "message": "Bad Request Exception",
    "data": {
        "errors": [
            "currency must be longer than or equal to 3 characters",
            "currency must be a string"
        ]
    }
}
```

## Error types

<AccordionGroup>
  <Accordion title="Amount must be a number conforming to the specified constraints">
    **Meaning**: The `amount` field is missing.

    **Solution**: Ensure that you provide a valid amount in the `amount` field before sending a request to the initiate payment endpoint.
  </Accordion>

  <Accordion title="No matching smart routing rule. Using default provider order.">
    **Meaning**: The provided `paymentMethod` field or `currency` field does not match your configured smart routing rule or is missing.

    **Solution**: Ensure that you provide a valid `paymentMethod` and `currency` that matches your smart routing rule before sending a request to the initiate payment endpoint.
  </Accordion>

  <Accordion title="MerchantOrderId must be longer than or equal to 1 characters / merchantOrderId should not be empty / merchantOrderId must be a string">
    **Meaning**: The `merchantOrderId` field is missing.

    **Solution**: Ensure that you provide a `merchantOrderId` field before sending a request to the initiate payment endpoint.
  </Accordion>

  <Accordion title="Currency must be longer than or equal to 3 characters / currency must be a string">
    **Meaning**: The `currency` field is missing.

    **Solution**: Ensure that you provide a valid `currency` field before sending a request to the initiate payment endpoint.
  </Accordion>

  <Accordion title="Currency not supported by merchant">
    **Meaning**: The currency provided in the payment request is not supported by the gateway that Archefusion routed the payment to. This typically happens when no smart routing rule matches the transaction currency and the default gateway does not support it.

    **Solution**: Configure a smart routing rule for the currency you want to accept and ensure at least one active gateway supports it. Visit the [supported gateways and payment methods](https://docs.archefusion.com/pages/supported-gateways-and-payment-methods) page to see which currencies each gateway supports.
  </Accordion>

  <Accordion title="Payment not found">
    **Meaning**: The provided `paymentId` in the verify payment request is invalid.

    **Solution**: Provide a valid `paymentId`.
  </Accordion>

  <AccordionGroup>
    <Accordion title="No active payment gateways configured">
      **Meaning:** Your connected payment gateways are inactive.

      **Solution:** Navigate to **Payment Gateways** > **Gateway Providers** and select your connected gateway. Toggle the gateway status to active.
    </Accordion>

    <Accordion title="Korapay customer email is required">
      **Meaning**: The `customer.email` field is missing.

      **Solution**: Ensure you provide a valid customer email address in your initiate payment payload, especially when you have the Korapay gateway configured.
    </Accordion>
  </AccordionGroup>
</AccordionGroup>
