> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.useroot.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.useroot.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, the existing payin is returned. This allows you to recover the payin ID after transient errors (e.g., 500 Internal Server Error).
- **201 Created**: If no payin exists with the provided idempotency key, a new payin is created.

**Success Responses**

| Status Code | Description |
|-------------|-------------|
| 200 | OK - An existing payin with the provided idempotency key was found and returned (idempotency retry scenario) |
| 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 created but auto-approval encountered an error. The response includes the created payin data and a **`warning`** describing what failed (approval or initiation). |

**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 |
| 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 and continues approval and 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 a later step failed; read **`warning`** and **`status`**.
- **503**: Transient error while completing **`auto_approve`**—**retry** the create; use the response **`message`** (and **`error_code`**) for support and automation.

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

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: '[Code Generated] Root - Instant Account to Account Money Movement'
  version: 1.0.0
paths:
  /api/payins:
    post:
      operationId: create-payin
      summary: Create a new payin
      description: >-
        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,
        the existing payin is returned. This allows you to recover the payin ID
        after transient errors (e.g., 500 Internal Server Error).

        - **201 Created**: If no payin exists with the provided idempotency key,
        a new payin is created.


        **Success Responses**


        | Status Code | Description |

        |-------------|-------------|

        | 200 | OK - An existing payin with the provided idempotency key was
        found and returned (idempotency retry scenario) |

        | 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 created but auto-approval encountered an
        error. The response includes the created payin data and a **`warning`**
        describing what failed (approval or initiation). |


        **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 |

        | 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 and continues
        approval and 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 a later step failed; read
        **`warning`** and **`status`**.

        - **503**: Transient error while completing **`auto_approve`**—**retry**
        the create; use the response **`message`** (and **`error_code`**) for
        support and automation.
      tags:
        - payinsApi
      parameters:
        - name: x-api-key
          in: header
          description: >-
            RootPay API key sent in the x-api-key header. Keys are
            environment-scoped: live_* for production, test_* for sandbox.
          required: true
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          description: Unique key to prevent duplicate requests
          required: false
          schema:
            type:
              - string
              - 'null'
      responses:
        '200':
          description: Payin retrieved successfully (idempotency retry)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Payins API_createPayin_Response_200'
        '503':
          description: >-
            Payin created and approved, but bank initiation could not be
            started—retry later
          content:
            application/json:
              schema:
                description: Any type
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePayinRequest'
servers:
  - url: https://api.useroot.com
    description: Production
components:
  schemas:
    CurrencyCode:
      type: string
      enum:
        - USD
        - GBP
        - INR
      title: CurrencyCode
    CreatePayinRequest:
      type: object
      properties:
        payer_id:
          type: string
          format: uuid
          description: ID of the payer
        amount_in_cents:
          type:
            - integer
            - 'null'
          description: >-
            Deprecated. Use amount_in_minor_units instead. Still accepted and
            returned for backward compatibility.
        amount_in_minor_units:
          type:
            - integer
            - 'null'
          description: Amount in the currency's minor units (e.g. cents for USD).
        currency_code:
          $ref: '#/components/schemas/CurrencyCode'
          description: Currency code
        rail:
          type:
            - string
            - 'null'
          description: >-
            Payment rail (standard_ach, same_day_ach). Uses default if not
            provided.
        payment_method_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Specific payment method ID (uses default if not provided)
        auto_approve:
          type: boolean
          default: false
          description: Whether to automatically approve and initiate the payin
        metadata:
          type:
            - object
            - 'null'
          additionalProperties:
            description: Any type
          description: Client metadata
        subaccount_id:
          type:
            - string
            - 'null'
          format: uuid
          description: Subaccount to credit to (test entities only)
      required:
        - payer_id
      description: Request model for creating a payin.
      title: CreatePayinRequest
    Payins API_createPayin_Response_200:
      type: object
      properties: {}
      description: Empty response body
      title: Payins API_createPayin_Response_200
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        RootPay API key sent in the x-api-key header. Keys are
        environment-scoped: live_* for production, test_* for sandbox.

```

## 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()
```

### Auto-approve payin - initiation 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": "approved",
    "status_recorded_at": "2024-03-20T12:01: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 and approved successfully, but initiation encountered an error. The payin may require review."
}
```

**SDK Code**

```python Auto-approve payin - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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": "approved",
    "status_recorded_at": "2024-03-20T12:01: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 and approved successfully, but initiation encountered an error. The payin may require review."
}
```

**SDK Code**

```python Auto-approve payin - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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": "approved",
    "status_recorded_at": "2024-03-20T12:01: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 and approved successfully, but initiation encountered an error. The payin may require review."
}
```

**SDK Code**

```python Auto-approve payin - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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()
```

### Auto-approve payin - initiation 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": "approved",
    "status_recorded_at": "2024-03-20T12:01: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 and approved successfully, but initiation encountered an error. The payin may require review."
}
```

**SDK Code**

```python Auto-approve payin - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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 - initiation 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()
```