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

# Development

> Set up your local development environment and test your Orafi integration safely.

## Base URL

All API requests — both test and live — use a single base URL:

```
https://api.orafi.app
```

Your API key determines whether you're operating on testnet or mainnet. There are no separate environment URLs to manage.

***

## Test vs live mode

|                         | Test mode          | Live mode          |
| ----------------------- | ------------------ | ------------------ |
| **Blockchain**          | Testnet            | Mainnet            |
| **Real funds**          | No                 | Yes                |
| **API key prefix**      | `ora_test_`        | `ora_live_`        |
| **Onboarding required** | No                 | Yes                |
| **Webhooks**            | Delivered normally | Delivered normally |

<Warning>
  Always use **test mode** during development. Switch to live mode only after your integration is fully tested and your onboarding is complete.
</Warning>

***

## Switching modes

You can switch between test and live mode in two ways:

1. **Dashboard** — Toggle the mode switch in your [Orafi Dashboard](https://dashboard.orafi.app).
2. **API** — Call the [Mode endpoint](/api-reference/endpoint/mode) programmatically.

<Note>
  Switching to live mode requires completed onboarding and business verification.
</Note>

***

## Local webhook testing

Webhooks are delivered to publicly accessible HTTPS URLs. For local development, use a tunneling tool to expose your local server:

<Steps>
  <Step title="Start a tunnel">
    Use a tool like [ngrok](https://ngrok.com) or [localtunnel](https://theboroer.github.io/localtunnel-www/) to create a public URL that forwards to your local server.

    ```bash theme={null}
    ngrok http 3000
    ```
  </Step>

  <Step title="Register the webhook URL">
    Use the tunnel URL as your webhook endpoint.

    ```bash theme={null}
    curl -X POST https://api.orafi.app/v1/webhook/register \
      -H "Content-Type: application/json" \
      -H "x-api-key: ora_test_your_api_key" \
      -d '{ "url": "https://abc123.ngrok.io/webhooks/orafi" }'
    ```
  </Step>

  <Step title="Trigger a test payment">
    Create a payment with your test API key. Once confirmed, the webhook will be delivered to your local server via the tunnel.
  </Step>
</Steps>

***

## Testing best practices

<AccordionGroup>
  <Accordion title="Use idempotent transaction references">
    Always generate a unique `txRef` for each payment. If you retry with the same `txRef`, Orafi returns the original payment instead of creating a duplicate.
  </Accordion>

  <Accordion title="Simulate different scenarios">
    Create payments, trigger refunds, and initiate payouts in test mode to cover your integration's happy and error paths.
  </Accordion>

  <Accordion title="Verify webhook signatures">
    Every webhook payload is signed with your webhook secret. Always verify the signature before processing events — even in test mode.
  </Accordion>

  <Accordion title="Test webhook retries">
    If your endpoint returns a non-2xx status, Orafi retries delivery automatically. Make sure your handler is idempotent so duplicate deliveries don't cause issues.
  </Accordion>
</AccordionGroup>
