> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://useroot.docs.buildwithfern.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://useroot.docs.buildwithfern.com/_mcp/server.

# Create a new payin

POST https://api.useroot.com/api/payins
Content-Type: application/json

Creates a new payin to collect funds from a payer using their payment method. A payin represents an ACH debit transaction that pulls money from the payer's bank account. Supports both regular payins and subaccount payins (test entities only).

**Request Body**

| Field                   | Type    | Required | Description                                                                                                                                                | Validation Rules                                                                                                                                       |
| ----------------------- | ------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `payer_id`              | UUID    | Yes      | ID of the payer from whom to collect funds.                                                                                                                | Must be a valid UUID for an existing payer                                                                                                             |
| `amount_in_minor_units` | Integer | Yes      | Amount in the smallest unit of the currency. For USD, this is cents (100 = \$1.00).                                                                        | Must be a positive whole number.                                                                                                                       |
| `currency_code`         | String  | No       | ISO 4217 currency code. Defaults to the source account's currency.                                                                                         | If supplied, must match a supported country and currency combination for debit.                                                                        |
| `rail`                  | String  | No       | Payment rail to use. Options: `standard_ach`, `same_day_ach`. Uses default if not provided.                                                                | Must be one of the supported ACH rails                                                                                                                 |
| `payment_method_id`     | UUID    | No       | ID of a specific payment method to use instead of the payer's default payment method.                                                                      | Must be a valid UUID for an existing payment method belonging to the payer                                                                             |
| `subaccount_id`         | UUID    | No       | ID of the subaccount to credit to (test entities only). When provided, the payin will be credited to the specified subaccount instead of the main account. | Must be a valid UUID for an existing subaccount belonging to the entity. Only available for sandbox/test entities.                                     |
| `auto_approve`          | Boolean | No       | If set to true, payin will automatically transition to approved and initiated state.                                                                       | default: `false`                                                                                                                                       |
| `metadata`              | Object  | No       | Arbitrary metadata as key-value pairs to store with the payin for your own reference.                                                                      | Must be an object with string keys and string values. Maximum 50 keys, each key max 40 characters, each value max 500 characters, total size max 16KB. |

**Examples:**

* For USD, `amount_in_minor_units: 2500` is 2500 cents = \$25.00
* For USD, `amount_in_minor_units: 10075` is 10075 cents = \$100.75

**Response Body**

| Field                   | Type     | Description                                                                                                  |
| ----------------------- | -------- | ------------------------------------------------------------------------------------------------------------ |
| `id`                    | UUID     | Unique identifier for the payin.                                                                             |
| `payer_id`              | UUID     | ID of the payer from whom funds are being collected.                                                         |
| `subaccount_id`         | UUID     | ID of the subaccount this payin is attributed to. Null if attributed to main account.                        |
| `status`                | String   | Current status of the payin (`created`, `canceled`, `approved`, `initiated`, `debited`, `settled`, `failed`) |
| `amount_in_minor_units` | Integer  | The payin amount in the smallest unit of the currency. For USD, cents (100 = \$1.00).                        |
| `amount_in_cents`       | Integer  | Deprecated alias for `amount_in_minor_units`.                                                                |
| `currency_code`         | String   | ISO 4217 currency code of the destination account.                                                           |
| `country_code`          | String   | ISO 3166-1 alpha-2 country code of the destination account.                                                  |
| `rail`                  | String   | Payment rail used (standard\_ach, same\_day\_ach)                                                            |
| `payin_metadata`        | Object   | Contains payment method details and payer information (sensitive data is masked)                             |
| `client_metadata`       | Object   | Arbitrary metadata as key-value pairs that were provided when creating the payin                             |
| `status_recorded_at`    | DateTime | Timestamp when the current status was recorded                                                               |
| `created_at`            | DateTime | Timestamp when the payin was created                                                                         |
| `updated_at`            | DateTime | Timestamp when the payin was last updated                                                                    |

**Note:** Use `amount_in_minor_units` in request bodies. The `amount_in_cents` field is deprecated and retained in responses for backward compatibility.

**Idempotency Key**

You can include an `Idempotency-Key` header to ensure that duplicate requests are handled safely. When you retry a request with the same idempotency key:

* **200 OK**: If a payin with the same idempotency key already exists and no further work is needed for this request, the existing payin is returned.
* **201 Created**: If no payin exists with the provided idempotency key, a new payin is created.
* With **`auto_approve=true`**, an idempotency match that is still **`CREATED`** continues approve→initiate. A match in **`CANCELED`** or **`FAILED`** returns **409**.

**Success Responses**

| Status Code | Description                                                                                                                                                                                            |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| 200         | OK — An existing payin with the provided idempotency key was found and returned (idempotency recovery / already-advanced replay)                                                                       |
| 201         | Created — The payin was created; with **`auto_approve`**, processing finished within this response for your request (**`status`** reflects the result).                                                |
| 202         | Accepted — The payin was created (and approved when **`auto_approve`** is true). **`status`** in the body may still change; poll **`GET /api/payins/{id}`** until the payin reaches a terminal status. |
| 207         | Multi-Status — Payin was created (or already existed as **`CREATED`**) but **approval** failed. The response includes the payin data and a **`warning`**. The payin remains **`CREATED`**.             |

**Error Responses**

| Status Code | Error Code                  | Description                                                                                                                                                                                                      |
| ----------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | VALIDATION\_ERROR           | The provided data failed validation                                                                                                                                                                              |
| 401         | AUTHENTICATION\_ERROR       | Authentication credentials are invalid or missing                                                                                                                                                                |
| 403         | AUTHORIZATION\_ERROR        | You do not have permission to perform this action                                                                                                                                                                |
| 404         | PAYER\_NOT\_FOUND           | The payer was not found or doesn't belong to your entity                                                                                                                                                         |
| 404         | PAYMENT\_METHOD\_NOT\_FOUND | The specified payment method was not found                                                                                                                                                                       |
| 409         | IDEMPOTENCY\_KEY\_CONFLICT  | Idempotency key matches an existing payin in a terminal failed or canceled state; use a new key                                                                                                                  |
| 422         | INVALID\_PAYMENT\_DETAILS   | The payment details are invalid or incomplete                                                                                                                                                                    |
| 503         | (see response body)         | With **`auto_approve`**, the payin was created (and approved) but initiation hit a **transient error**. **Retry** the same create request after a short wait. The JSON body includes `error_code` and `message`. |

**Auto-approve behavior**

When **`auto_approve=true`**, the API creates the payin (or continues from an idempotent **`CREATED`** match) and continues approval and async initiation as far as this request allows. You may receive **201**, **202**, **207**, or **503** depending on outcome:

* **201** / **202**: The payin id is always in the response. If you receive **202**, poll **`GET /api/payins/{id}`** until **`status`** reaches a value you treat as final for your integration.
* **207**: Creation succeeded but **approval** failed; read **`warning`** and **`status`** (still **`CREATED`**). Standalone approve returns **4xx** for the same approval failure.
* **503**: Transient error while starting async initiation—**retry** the create; use the response **`message`** (and **`error_code`**) for support and automation.

Reference: https://useroot.docs.buildwithfern.com/api-reference/payins-api/create-payin

## Authentication

- `x-api-key` header (required) — RootPay API key sent in the x-api-key header. Keys are environment-scoped: live_* for production, test_* for sandbox.

## Request

### Headers

- `Idempotency-Key` (string, optional, nullable) — Unique key to prevent duplicate requests

### Body (application/json)

- `payer_id` (string, required) — ID of the payer
- `amount_in_minor_units` (integer, optional, nullable) — Amount in the currency's minor units (e.g. cents for USD).
- `currency_code` (enum, optional) — Currency code
  - Allowed values: `USD`, `GBP`, `INR`
- `rail` (string, optional, nullable) — Payment rail (standard_ach, same_day_ach). Uses default if not provided.
- `payment_method_id` (string, optional, nullable) — Specific payment method ID (uses default if not provided)
- `auto_approve` (boolean, optional, default: false) — Whether to automatically approve and initiate the payin
- `metadata` (map from string to any, optional, nullable) — Client metadata
- `subaccount_id` (string, optional, nullable) — Subaccount to credit to (test entities only)
- `scheduled_date` (date, optional, nullable) — Calendar day to release the transfer in its schedule timezone (currently America/New_York). Omitted for immediate. Not the beneficiary credit date. Resolved to 09:00 in that timezone.
- `amount_in_cents` (integer, optional, nullable, deprecated) — Deprecated. Use amount_in_minor_units instead. Still accepted and returned for backward compatibility.

## Response

### 200

Payin retrieved successfully (idempotency retry)

### 201

Payin created successfully

- `data` (object, required) — Response model for payin operations.
  - `id` (string, required)
  - `payer_id` (string, required)
  - `amount_in_minor_units` (integer, required) — Amount in the currency's minor units (e.g. cents for USD).
  - `currency_code` (string, required)
  - `rail` (string, required)
  - `status` (enum, required) — Current status of the payin. One of: created, approved, initiated, debited, settled, failed, canceled.
    - Allowed values: `created`, `approved`, `initiated`, `debited`, `settled`, `failed`, `canceled`
  - `status_recorded_at` (datetime, required)
  - `payin_metadata` (map from string to any, required)
  - `created_at` (datetime, required)
  - `updated_at` (datetime, required)
  - `amount_in_cents` (integer, required, deprecated) — Deprecated. Use amount_in_minor_units instead. Still accepted and returned for backward compatibility.
  - `client_metadata` (map from string to any, optional)
  - `scheduled_date` (date, optional, nullable) — Caller-chosen send day in the schedule timezone (currently America/New_York), or null when immediate.
- `warning` (string, optional, nullable)

### 202

Payin created and approved; response includes current state—poll GET for updates if status may change

### 207

Payin created but auto-approval failed; payin remains CREATED

## Examples

### Standard payin

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  }
}
```

**SDK Code**

```python Standard payin
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "auto_approve": False
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Standard payin
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"standard_ach","auto_approve":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Standard payin
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Standard payin
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}"

response = http.request(request)
puts response.read_body
```

```java Standard payin
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}")
  .asString();
```

```php Standard payin
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Standard payin
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Standard payin
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Same day ACH payin

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "initiated",
    "status_recorded_at": "2024-03-20T12:01:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021",
        "end_to_end_id": "ACH20240320123456789"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z",
    "transfer_details": {
      "rail": "standard_ach",
      "end_to_end_id": "ACH20240320123456789",
      "response": {
        "transaction_id": "JPM87654321",
        "status": "ACCEPTED",
        "timestamp": "2024-03-20T12:01:00Z"
      }
    }
  }
}
```

**SDK Code**

```python Same day ACH payin
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "auto_approve": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Same day ACH payin
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"same_day_ach","auto_approve":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Same day ACH payin
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Same day ACH payin
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Same day ACH payin
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")
  .asString();
```

```php Same day ACH payin
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Same day ACH payin
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Same day ACH payin
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Auto-approve payin - approval failed

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  },
  "warning": "Payin created successfully, but approval failed. The payin remains in CREATED status."
}
```

**SDK Code**

```python Auto-approve payin - approval failed
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "auto_approve": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Auto-approve payin - approval failed
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"same_day_ach","auto_approve":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Auto-approve payin - approval failed
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Auto-approve payin - approval failed
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Auto-approve payin - approval failed
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")
  .asString();
```

```php Auto-approve payin - approval failed
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Auto-approve payin - approval failed
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Auto-approve payin - approval failed
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Standard payin

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  }
}
```

**SDK Code**

```python Standard payin
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "auto_approve": False
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Standard payin
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"standard_ach","auto_approve":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Standard payin
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Standard payin
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}"

response = http.request(request)
puts response.read_body
```

```java Standard payin
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}")
  .asString();
```

```php Standard payin
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Standard payin
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Standard payin
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Same day ACH payin

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "initiated",
    "status_recorded_at": "2024-03-20T12:01:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021",
        "end_to_end_id": "ACH20240320123456789"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z",
    "transfer_details": {
      "rail": "standard_ach",
      "end_to_end_id": "ACH20240320123456789",
      "response": {
        "transaction_id": "JPM87654321",
        "status": "ACCEPTED",
        "timestamp": "2024-03-20T12:01:00Z"
      }
    }
  }
}
```

**SDK Code**

```python Same day ACH payin
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "auto_approve": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Same day ACH payin
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"same_day_ach","auto_approve":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Same day ACH payin
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Same day ACH payin
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Same day ACH payin
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")
  .asString();
```

```php Same day ACH payin
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Same day ACH payin
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Same day ACH payin
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Auto-approve payin - approval failed

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  },
  "warning": "Payin created successfully, but approval failed. The payin remains in CREATED status."
}
```

**SDK Code**

```python Auto-approve payin - approval failed
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "auto_approve": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Auto-approve payin - approval failed
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"same_day_ach","auto_approve":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Auto-approve payin - approval failed
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Auto-approve payin - approval failed
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Auto-approve payin - approval failed
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")
  .asString();
```

```php Auto-approve payin - approval failed
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Auto-approve payin - approval failed
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Auto-approve payin - approval failed
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Standard payin

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  }
}
```

**SDK Code**

```python Standard payin
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "auto_approve": False
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Standard payin
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"standard_ach","auto_approve":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Standard payin
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Standard payin
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}"

response = http.request(request)
puts response.read_body
```

```java Standard payin
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}")
  .asString();
```

```php Standard payin
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Standard payin
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Standard payin
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Same day ACH payin

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "initiated",
    "status_recorded_at": "2024-03-20T12:01:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021",
        "end_to_end_id": "ACH20240320123456789"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z",
    "transfer_details": {
      "rail": "standard_ach",
      "end_to_end_id": "ACH20240320123456789",
      "response": {
        "transaction_id": "JPM87654321",
        "status": "ACCEPTED",
        "timestamp": "2024-03-20T12:01:00Z"
      }
    }
  }
}
```

**SDK Code**

```python Same day ACH payin
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "auto_approve": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Same day ACH payin
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"same_day_ach","auto_approve":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Same day ACH payin
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Same day ACH payin
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Same day ACH payin
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")
  .asString();
```

```php Same day ACH payin
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Same day ACH payin
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Same day ACH payin
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Auto-approve payin - approval failed

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  },
  "warning": "Payin created successfully, but approval failed. The payin remains in CREATED status."
}
```

**SDK Code**

```python Auto-approve payin - approval failed
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "auto_approve": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Auto-approve payin - approval failed
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"same_day_ach","auto_approve":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Auto-approve payin - approval failed
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Auto-approve payin - approval failed
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Auto-approve payin - approval failed
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")
  .asString();
```

```php Auto-approve payin - approval failed
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Auto-approve payin - approval failed
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Auto-approve payin - approval failed
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Auto-approve payin - approval failed

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  },
  "warning": "Payin created successfully, but approval failed. The payin remains in CREATED status."
}
```

**SDK Code**

```python Auto-approve payin - approval failed
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "same_day_ach",
    "auto_approve": True
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Auto-approve payin - approval failed
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"same_day_ach","auto_approve":true}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Auto-approve payin - approval failed
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Auto-approve payin - approval failed
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}"

response = http.request(request)
puts response.read_body
```

```java Auto-approve payin - approval failed
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}")
  .asString();
```

```php Auto-approve payin - approval failed
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Auto-approve payin - approval failed
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"same_day_ach\",\n  \"auto_approve\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Auto-approve payin - approval failed
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "same_day_ach",
  "auto_approve": true
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Specific payment method

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "payment_method_id": "654e3210-e89b-12d3-a456-426614174001",
  "auto_approve": false
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  }
}
```

**SDK Code**

```python Specific payment method
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "payment_method_id": "654e3210-e89b-12d3-a456-426614174001",
    "auto_approve": False
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Specific payment method
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"standard_ach","payment_method_id":"654e3210-e89b-12d3-a456-426614174001","auto_approve":false}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Specific payment method
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"payment_method_id\": \"654e3210-e89b-12d3-a456-426614174001\",\n  \"auto_approve\": false\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Specific payment method
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"payment_method_id\": \"654e3210-e89b-12d3-a456-426614174001\",\n  \"auto_approve\": false\n}"

response = http.request(request)
puts response.read_body
```

```java Specific payment method
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"payment_method_id\": \"654e3210-e89b-12d3-a456-426614174001\",\n  \"auto_approve\": false\n}")
  .asString();
```

```php Specific payment method
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "payment_method_id": "654e3210-e89b-12d3-a456-426614174001",
  "auto_approve": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Specific payment method
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"payment_method_id\": \"654e3210-e89b-12d3-a456-426614174001\",\n  \"auto_approve\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Specific payment method
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "payment_method_id": "654e3210-e89b-12d3-a456-426614174001",
  "auto_approve": false
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Payin with metadata

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false,
  "metadata": {
    "invoice_id": "INV-2024-001",
    "description": "Monthly subscription payment"
  }
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  }
}
```

**SDK Code**

```python Payin with metadata
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "auto_approve": False,
    "metadata": {
        "invoice_id": "INV-2024-001",
        "description": "Monthly subscription payment"
    }
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Payin with metadata
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":25000,"currency_code":"USD","rail":"standard_ach","auto_approve":false,"metadata":{"invoice_id":"INV-2024-001","description":"Monthly subscription payment"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Payin with metadata
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false,\n  \"metadata\": {\n    \"invoice_id\": \"INV-2024-001\",\n    \"description\": \"Monthly subscription payment\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Payin with metadata
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false,\n  \"metadata\": {\n    \"invoice_id\": \"INV-2024-001\",\n    \"description\": \"Monthly subscription payment\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java Payin with metadata
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false,\n  \"metadata\": {\n    \"invoice_id\": \"INV-2024-001\",\n    \"description\": \"Monthly subscription payment\"\n  }\n}")
  .asString();
```

```php Payin with metadata
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false,
  "metadata": {
    "invoice_id": "INV-2024-001",
    "description": "Monthly subscription payment"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Payin with metadata
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 25000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false,\n  \"metadata\": {\n    \"invoice_id\": \"INV-2024-001\",\n    \"description\": \"Monthly subscription payment\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Payin with metadata
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 25000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false,
  "metadata": [
    "invoice_id": "INV-2024-001",
    "description": "Monthly subscription payment"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

### Payin to subaccount

**Request**

```json
{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 15000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false,
  "subaccount_id": "123e4567-e89b-12d3-a456-426614174000"
}
```

**Response**

```json
{
  "data": {
    "id": "789e0123-e89b-12d3-a456-426614174000",
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_cents": 25000,
    "amount_in_minor_units": 25000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "status": "created",
    "status_recorded_at": "2024-03-20T12:00:00Z",
    "payin_metadata": {
      "payment_method": {
        "account_last_four": "1234",
        "routing_number": "021000021"
      },
      "payer": {
        "name": "John Smith",
        "email": "john.smith@example.com"
      }
    },
    "client_metadata": {},
    "created_at": "2024-03-20T12:00:00Z",
    "updated_at": "2024-03-20T12:00:00Z"
  }
}
```

**SDK Code**

```python Payin to subaccount
import requests

url = "https://api.useroot.com/api/payins"

payload = {
    "payer_id": "456e7890-e89b-12d3-a456-426614174001",
    "amount_in_minor_units": 15000,
    "currency_code": "USD",
    "rail": "standard_ach",
    "auto_approve": False,
    "subaccount_id": "123e4567-e89b-12d3-a456-426614174000"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Payin to subaccount
const url = 'https://api.useroot.com/api/payins';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"payer_id":"456e7890-e89b-12d3-a456-426614174001","amount_in_minor_units":15000,"currency_code":"USD","rail":"standard_ach","auto_approve":false,"subaccount_id":"123e4567-e89b-12d3-a456-426614174000"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Payin to subaccount
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.useroot.com/api/payins"

	payload := strings.NewReader("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 15000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false,\n  \"subaccount_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Payin to subaccount
require 'uri'
require 'net/http'

url = URI("https://api.useroot.com/api/payins")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 15000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false,\n  \"subaccount_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}"

response = http.request(request)
puts response.read_body
```

```java Payin to subaccount
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.useroot.com/api/payins")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 15000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false,\n  \"subaccount_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}")
  .asString();
```

```php Payin to subaccount
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.useroot.com/api/payins', [
  'body' => '{
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 15000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false,
  "subaccount_id": "123e4567-e89b-12d3-a456-426614174000"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Payin to subaccount
using RestSharp;

var client = new RestClient("https://api.useroot.com/api/payins");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"payer_id\": \"456e7890-e89b-12d3-a456-426614174001\",\n  \"amount_in_minor_units\": 15000,\n  \"currency_code\": \"USD\",\n  \"rail\": \"standard_ach\",\n  \"auto_approve\": false,\n  \"subaccount_id\": \"123e4567-e89b-12d3-a456-426614174000\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Payin to subaccount
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "payer_id": "456e7890-e89b-12d3-a456-426614174001",
  "amount_in_minor_units": 15000,
  "currency_code": "USD",
  "rail": "standard_ach",
  "auto_approve": false,
  "subaccount_id": "123e4567-e89b-12d3-a456-426614174000"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.useroot.com/api/payins")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```