> ## 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.

# initiatePayin

> Creates a Noah payin and returns bank deposit instructions.

## Function Signature

```swift theme={null}
public func initiatePayin(request: NoahInitiatePayinRequest) async throws -> NoahInitiatePayinResponse
```

## Description

Initiates a Noah payin (on-ramp) and returns a `payinId` plus the bank deposit instructions the customer should use to fund it. Once the fiat deposit settles, Noah sends crypto to `destinationAddress` on the specified network.

Payin lifecycle updates arrive asynchronously through Noah `FiatDeposit` and `Transaction` webhooks — do not poll this response.

## Parameters

| Parameter                    | Type                         | Required | Description                                                                                                   |
| ---------------------------- | ---------------------------- | -------- | ------------------------------------------------------------------------------------------------------------- |
| `request.fiatCurrency`       | `String`                     | Yes      | Fiat currency code, for example `USD`.                                                                        |
| `request.cryptoCurrency`     | `String`                     | Yes      | Noah crypto asset code, for example `USDC_TEST` in sandbox.                                                   |
| `request.network`            | `String`                     | Yes      | CAIP-2 chain identifier. Use a `NoahNetwork` constant.                                                        |
| `request.destinationAddress` | `String`                     | Yes      | Address that receives crypto after settlement.                                                                |
| `request.businessFees`       | `[String: NoahBusinessFee]?` | No       | Per-payment-method business fee overrides, keyed by payment method type. Forwarded to Noah as `BusinessFees`. |

## Returns

**`NoahInitiatePayinResponse`** — an envelope containing:

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

`NoahInitiatePayinData`:

| Property      | Type              | Description                            |
| ------------- | ----------------- | -------------------------------------- |
| `payinId`     | `String`          | Identifier for the created payin.      |
| `bankDetails` | `NoahBankDetails` | Deposit instructions for the customer. |

`NoahBankDetails`:

| Property                | Type                                       | Description                                                                               |
| ----------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------- |
| `paymentMethodId`       | `String`                                   | Payment method identifier.                                                                |
| `paymentMethodType`     | `String`                                   | Payment rail type, for example `BankSepa` or `IdentifierPix`.                             |
| `accountNumber`         | `String`                                   | Bank account number to deposit into.                                                      |
| `cryptoCurrency`        | `String`                                   | Crypto currency for this payin.                                                           |
| `network`               | `String`                                   | Network identifier.                                                                       |
| `fee`                   | `NoahFeeDetails`                           | Fee breakdown: `fiatCurrencyCode`, `totalFeePct`, `totalFeeBase`, `totalFeeMin`.          |
| `accountHolderName`     | `String?`                                  | Account holder name.                                                                      |
| `bankCode`              | `String?`                                  | Bank routing or sort code.                                                                |
| `bankName`              | `String?`                                  | Bank name.                                                                                |
| `bankAddress`           | `NoahBankAddress?`                         | Bank address: `street`, `street2`, `city`, `postCode`, `state`, `country` — all optional. |
| `reference`             | `String?`                                  | Payment reference the customer must include.                                              |
| `relatedPaymentMethods` | `[NoahBankToAddressRelatedPaymentMethod]?` | Related payment methods for this destination.                                             |

## Example

```swift theme={null}
import PortalSwift

do {
  let response = try await portal.ramps.noah.initiatePayin(
    request: NoahInitiatePayinRequest(
      fiatCurrency: "USD",
      cryptoCurrency: "USDC_TEST",
      network: NoahNetwork.solanaDevnet,
      destinationAddress: "SoLAddr1111111111111111111111111111111111111"
    )
  )

  print("Payin: \(response.data.payinId)")
  print("Deposit to: \(response.data.bankDetails.accountNumber)")
  print("Reference: \(response.data.bankDetails.reference ?? "none")")
} catch {
  print("initiatePayin failed: \(error)")
}
```

## Errors

| Error                                           | Description                                                                                |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------ |
| `PortalRequestsError.unauthorized`              | Authentication failed (401).                                                               |
| `PortalRequestsError.clientError`               | Client error (4xx). An unsupported `network` value, or the customer has not completed KYC. |
| `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)
* [Noah payins workflow](/integrations/On-Off-Ramp/noah-payins)
* [Noah webhooks](/integrations/On-Off-Ramp/noah-webhooks)
