> For the complete documentation index, see [llms.txt](https://moonie.gitbook.io/mooniepay/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moonie.gitbook.io/mooniepay/introduction/testing.md).

# Testing

### Sandbox vs Live

MooniePay has two fully separate environments. Every resource — API keys, payments, payouts, and transactions — is **completely isolated** between them.

|                                 | Sandbox                                                 | Live                                    |
| ------------------------------- | ------------------------------------------------------- | --------------------------------------- |
| **Purpose**                     | Development & QA                                        | Real transactions                       |
| **Money moved**                 | ❌ No                                                    | ✅ Yes                                   |
| **Key prefix**                  | `pk_sandbox_...`                                        | `pk_live_...`                           |
| **`X-TTUM-Environment` header** | `sandbox`                                               | `live`                                  |
| **Data retention**              | Sandbox data is automatically deleted after **90 days** | Persistent                              |
| **Live mode required**          | ❌ No                                                    | ✅ Yes — must be approved from dashboard |

Switching between environments requires only two changes:

1. Swap your API key pair (sandbox ↔ live)
2. Update the `X-TTUM-Environment` header value accordingly

No other code changes are needed.

***

### Getting Your Sandbox Keys

Navigate to the **Developer** section of your MooniePay dashboard and select the **Sandbox** tab to find your sandbox key pairs.

As covered in the [Authentication](https://claude.ai/chat/authentication.md) guide, you will have two sandbox key pairs:

| Key Pair                     | Used for                  |
| ---------------------------- | ------------------------- |
| Sandbox Payment Key + Secret | Testing payment endpoints |
| Sandbox Payout Key + Secret  | Testing payout endpoints  |
|                              |                           |

<figure><img src="/files/X1B168ppyFW21ji5VBsi" alt=""><figcaption></figcaption></figure>

> ⚠️ Sandbox keys will be **rejected** if you send `X-TTUM-Environment: live`, and vice versa. The environment in your header must always match the key you are using.

***

### Sandbox Payment Screen

When a payment is initialized in sandbox mode and the customer is redirected to the MooniePay payment page, a **red sandbox badge** is displayed at the bottom of the page. This makes it immediately clear that no real money will be charged.

This badge only appears in sandbox mode. It will never appear in live mode.

<figure><img src="/files/4SAHDCYQrdiYMdVzEeZW" alt=""><figcaption></figcaption></figure>

***

### Testing with Postman

The fastest way to explore the API before writing any code is with Postman. Set up your environment variables as described in the [Authentication → Postman Pre-request Script](https://claude.ai/chat/authentication.md#postman--pre-request-script) section, then simply set:

```
X-TTUM-ENVIRONMENT = sandbox
X-TTUM-PAYMENT-KEY = pk_sandbox_payment_xxxxxxxxxxxx
X-TTUM-PAYMENT-SECRET = your_sandbox_payment_secret
X-TTUM-PAYOUT-KEY = sk_sandbox_payout_xxxxxxxxxxxx
X-TTUM-PAYOUT-SECRET = your_sandbox_payout_secret
```

The pre-request script will automatically sign every request with the correct key pair based on the endpoint you call.

> 💡 Open the **Postman Console** (`View → Show Postman Console`) while testing to see the full debug output from the pre-request script, including the canonical string and computed signature.

***

### Simulating Specific Outcomes

In sandbox mode you can trigger specific payment and payout outcomes to test how your integration handles each status. Refer to the dedicated testing guides for each resource:

* [Payments → Testing](https://moonie.gitbook.io/mooniepay/payments/testing)
* [Payouts → Testing](https://moonie.gitbook.io/mooniepay/payouts/testing)

***

### Going Live

Once you have validated your integration in sandbox mode, you can switch to live transactions:

1. Ensure your application has been **approved for live mode** in the dashboard. If live mode is not enabled, the API will return `LIVE_MODE_NOT_ENABLED`.
2. Replace your sandbox key pairs with your **live key pairs**.
3. Update `X-TTUM-ENVIRONMENT` to `live` in your Postman environment or `.env` file.
4. Verify your server uses **valid SSL** for all outbound HTTPS connections. Do not disable SSL verification.

<figure><img src="/files/8RSPXBu5Wh6O8avvlh5X" alt=""><figcaption></figcaption></figure>

> ⚠️ **Never mix sandbox and live keys in the same environment.** Keep them in separate `.env` files or Postman environments to avoid accidentally sending test transactions to production.

***

### Sandbox Behaviour Notes

| Behaviour          | Detail                                                                                                                                                      |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Data isolation** | Sandbox payments and payouts are never visible in your live dashboard and do not affect real balances.                                                      |
| **Data retention** | All sandbox resources are automatically purged after **90 days**.                                                                                           |
| **Rate limits**    | The same rate limits apply in sandbox as in live.                                                                                                           |
| **Webhooks**       | Webhooks fire in sandbox mode. Use a tool like [ngrok](https://ngrok.com/) or [Hookdeck](https://hookdeck.com/) to receive them locally during development. |
| **Live mode gate** | Sandbox does not require live mode approval. You can start testing immediately after creating your account.                                                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://moonie.gitbook.io/mooniepay/introduction/testing.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
