> ## Documentation Index
> Fetch the complete documentation index at: https://rain-sandbox-trial.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Payment Accounts

> Register an external bank account as a reusable payment account, the funding source Rain uses when you create a payment route.

A payment account is a record of an external funding source, like a bank
account, that Rain stores so you can reuse it across payment routes.
Registering a payment account doesn't move money. It only saves the account
details for later use.

## What a payment account is

When you register a payment account, Rain validates and stores the external
bank account details and returns an account `id`. You then reference that `id`
when you create a payment route, instead of resending the full bank details
each time.

<div className="wf-diagram">
  <div className="diagram-shell borderless">
    <svg id="payment-account-create" role="img" aria-label="Registering an external bank account: the partner POSTs bank details to /payment-accounts, Rain validates and stores the account, and returns the account with its id." viewBox="0 0 1080 200" width="1080" height="200" style={{width: "100%", height: "auto"}}><defs><marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0,0 L10,5 L0,10 z" className="marker-fill-default" /></marker></defs><path d="M 390 130 L 430 130" fill="none" className="conn-default" stroke-width="1.7" marker-end="url(#arrow)" opacity="0.92" /><path d="M 650 130 L 690 130" fill="none" className="conn-default" stroke-width="1.7" marker-end="url(#arrow)" opacity="0.92" /><foreignObject x="170" y="96" width="220" height="68"><div className="card action"><span className="bn">1</span><span className="ct"><span className="tag">Partner</span><span className="lab mono">POST /payment-accounts</span></span></div></foreignObject><foreignObject x="430" y="96" width="220" height="68"><div className="card action"><span className="bn">2</span><span className="ct"><span className="tag rain">Rain</span><span className="lab">Validates and stores the account</span></span></div></foreignObject><foreignObject x="690" y="96" width="220" height="68"><div className="card action"><span className="bn">3</span><span className="ct"><span className="tag">Response</span><span className="lab mono">Returns id</span></span></div></foreignObject></svg>
  </div>
</div>

* **POST /payment-accounts:** the partner submits the bank account details.
* **Validate and store:** Rain validates the details and stores the account.
* **Return `id`:** Rain returns the account with an `id` to reference later
  when creating a payment route.

Today, payment accounts support external fiat accounts, which are bank accounts
that receive fiat. Use a payment account as the destination when you create an
offramp payment route.

## Before you begin

Make sure you have:

* **API access** to the payment accounts endpoints.
* **Bank account details** for the destination account, including the account
  number, routing number, and beneficiary information.

## Register a bank account

To register a bank account, call `POST /payment-accounts`
with the `externalFiatAccount` type and the bank details.

```bash theme={null}
curl -X POST https://api.rain.xyz/v1/payment-accounts \
  -H "Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "externalFiatAccount",
    "userId": "11111111-1111-1111-1111-111111111111",
    "nickname": "John primary checking",
    "externalFiatAccount": {
      "currency": "usd",
      "rail": "ach",
      "thirdParty": false,
      "beneficiaryFirstName": "John",
      "beneficiaryLastName": "Doe",
      "beneficiaryType": "individual",
      "beneficiaryAddress": {
        "line1": "123 Main St",
        "city": "New York",
        "region": "NY",
        "postalCode": "10001",
        "countryCode": "US"
      },
      "bankName": "Acme Bank",
      "bankAddress": {
        "line1": "456 Finance St",
        "city": "New York",
        "region": "NY",
        "postalCode": "10005",
        "countryCode": "US"
      },
      "accountNumber": "123456789",
      "routingNumber": "000000000",
      "bankAccountType": "checking"
    }
  }'
```

The response includes the stored account and its `id`, which you reference when
you create a payment route.

```json theme={null}
{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "type": "externalFiatAccount",
  "nickname": "John primary checking",
  "userId": "11111111-1111-1111-1111-111111111111",
  "externalFiatAccount": {
    "currency": "usd",
    "rail": "ach",
    "thirdParty": false,
    "beneficiaryFirstName": "John",
    "beneficiaryLastName": "Doe",
    "beneficiaryType": "individual",
    "beneficiaryAddress": {
      "line1": "123 Main St",
      "city": "New York",
      "region": "NY",
      "postalCode": "10001",
      "countryCode": "US"
    },
    "bankName": "Acme Bank",
    "bankAddress": {
      "line1": "456 Finance St",
      "city": "New York",
      "region": "NY",
      "postalCode": "10005",
      "countryCode": "US"
    },
    "accountNumber": "123456789",
    "routingNumber": "000000000",
    "bankAccountType": "checking"
  },
  "createdAt": "2025-01-15T10:30:00Z"
}
```

### Bank account fields

Provide the following required bank account fields for both US rails, ACH (US)
and Wire (US):

* `accountNumber`
* `routingNumber`
* `beneficiaryType`
* `beneficiaryAddress`
* `bankName`
* `bankAddress`
* `bankAccountType`

### Beneficiary type and name fields

Set `beneficiaryType` to either `individual` or `business`. The name fields you
must provide depend on this value:

* **Individual**: provide `beneficiaryFirstName` and `beneficiaryLastName`.
* **Business**: provide `beneficiaryBusinessName`.

### Bank account type

Set `bankAccountType` to either `checking` or `savings`.

International rails used for quote-based
[transfers](/docs/transfers#step-1-create-a-payment-account) (`co_ach`,
`mx_spei`, `br_pix`, and others) require different fields, such as `clabeNumber` or
`pixCode`. See that page for the full field requirements by country.

<Info>
  Rain supports both first-party and third-party destinations. The party who
  receives the funds doesn't have to be the customer who owns the account.

  * **First-party** (`thirdParty: false`): the bank account belongs to the same
    user who set up the route.
  * **Third-party** (`thirdParty: true`): the bank account belongs to a different
    party, for example a vendor or another individual.
</Info>

## Manage payment accounts

After you register payment accounts, you can list them, retrieve a single
account, or delete an account you no longer need.

To retrieve all payment accounts for your team, call `GET /payment-accounts`.

```bash theme={null}
curl -X GET https://api.rain.xyz/v1/payment-accounts \
  -H "Api-Key: YOUR_API_KEY"
```

To retrieve a single payment account, call `GET /payment-accounts/{paymentAccountId}`.

```bash theme={null}
curl -X GET https://api.rain.xyz/v1/payment-accounts/f47ac10b-58cc-4372-a567-0e02b2c3d479 \
  -H "Api-Key: YOUR_API_KEY"
```

To remove a payment account, call `DELETE /payment-accounts/{paymentAccountId}`.

```bash theme={null}
curl -X DELETE https://api.rain.xyz/v1/payment-accounts/f47ac10b-58cc-4372-a567-0e02b2c3d479 \
  -H "Api-Key: YOUR_API_KEY"
```

<Warning>
  You cannot delete a payment account that an active payment route references.
  Delete the payment route first, then delete the payment account.
</Warning>

## How payment accounts are used in payment routes

Registering and managing accounts is only half the picture. A payment
account only becomes useful once you reference its `id` as the
destination of an offramp payment route. Creating the route still doesn't
move money: Rain returns an onchain deposit address, and funds convert only
after a sender sends stablecoin to it. See
[What a payment route is](/docs/payment-routes#what-a-payment-route-is) for
how Rain picks a direction and what each one returns.

## What's next

<Card title="Create a payment route" href="/docs/payment-routes">
  Reference this account's ID as the destination of an offramp payment route.
</Card>

<Card title="Onramps" href="/docs/onramps">
  Let users convert fiat to crypto through a payment route.
</Card>

<Card title="Offramps" href="/docs/offramps">
  Let users convert crypto to fiat into a registered payment account.
</Card>
