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

# simulatePayin

> Simulates a sandbox-only Noah fiat deposit for testing payin flows.

## Function Signature

```swift theme={null}
public func simulatePayin(request: NoahSimulatePayinRequest) async throws -> NoahSimulatePayinResponse
```

## Description

Simulates a fiat deposit against a Noah payment method so you can exercise the payin flow end to end without moving real money.

<Warning>
  This endpoint is **sandbox-only**. Calling it against a production environment fails with a `400` client error — `Simulate fiat deposit is only available in sandbox environments`. Guard the call behind your own environment check rather than shipping it in a production code path.
</Warning>

## Parameters

| Parameter                 | Type     | Required | Description                          |
| ------------------------- | -------- | -------- | ------------------------------------ |
| `request.paymentMethodId` | `String` | Yes      | Payment method identifier from Noah. |
| `request.fiatAmount`      | `String` | Yes      | Fiat amount as a decimal string.     |
| `request.fiatCurrency`    | `String` | Yes      | Fiat currency code.                  |

## Returns

**`NoahSimulatePayinResponse`** — an envelope containing:

| Property   | Type                    | Description                 |
| ---------- | ----------------------- | --------------------------- |
| `data`     | `NoahSimulatePayinData` | The response payload.       |
| `metadata` | `NoahResponseMetadata?` | Freeform response metadata. |

`NoahSimulatePayinData`:

| Property        | Type      | Description                                                 |
| --------------- | --------- | ----------------------------------------------------------- |
| `fiatDepositId` | `String`  | Identifier of the simulated fiat deposit.                   |
| `reference`     | `String?` | Reference for the simulated deposit, when returned by Noah. |

## Example

```swift theme={null}
import PortalSwift

#if DEBUG
do {
  let response = try await portal.ramps.noah.simulatePayin(
    request: NoahSimulatePayinRequest(
      paymentMethodId: "pm-1",
      fiatAmount: "10",
      fiatCurrency: "USD"
    )
  )

  print("Simulated deposit: \(response.data.fiatDepositId)")
} catch {
  print("simulatePayin failed: \(error)")
}
#endif
```

## Errors

| Error                                           | Description                                                                                                                                                            |
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `PortalRequestsError.clientError`               | Client error (4xx). A `400` is returned when the call is made against a production environment, or when `paymentMethodId`, `fiatAmount`, or `fiatCurrency` is invalid. |
| `PortalRequestsError.unauthorized`              | Authentication failed (401).                                                                                                                                           |
| `PortalRequestsError.internalServerError`       | Server error (5xx).                                                                                                                                                    |
| `PortalRequestsError.couldNotParseHttpResponse` | The response could not be parsed.                                                                                                                                      |
| `URLError.badURL`                               | The request URL could not be built.                                                                                                                                    |

## Related

* [Noah virtual accounts and payouts](../guide/noah)
* [initiatePayin](./noahinitiatepayin)
* [Noah payins workflow](/integrations/On-Off-Ramp/noah-payins)
