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

# Funding

To check that you have correctly coded your integration to our API specifications, complete our test cases for each API resource. Each API resource has a unique test endpoint and a unique set of test cases.

**If your tests are successful:**\
We send you an email to inform you that you can now send requests to the live endpoint.

**If your tests are unsuccessful:**\
Contact the project owner or email us for help at [integrationsupport@payroc.com](mailto:integrationsupport@payroc.com).

## Test environment

Run the following tests using our **test** environment with the credentials that we provided you.

**Test environment base URI:** [https://api.uat.payroc.com/v1](https://api.uat.payroc.com/v1)

## Testing Funding Recipients

Use our `/funding-recipients` endpoint to create and manage third-party recipients that receive funds from your transactions. To verify that your integration works with this endpoint,
run the following tests:

### Test 1: Create a Funding Recipient

You can create a Funding Recipient independently of any existing MIDs on your account.

* Use our `/funding-recipients` endpoint to create a new Funding Recipient.

### Request

POST [https://api.payroc.com/v1/funding-recipients](https://api.payroc.com/v1/funding-recipients)

```curl
curl -X POST https://api.payroc.com/v1/funding-recipients \
     -H "Idempotency-Key: 8e03978e-40d5-43e8-bc93-6894a57f9324" \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "recipientType": "privateCorporation",
  "taxId": "12-3456789",
  "doingBusinessAs": "Pizza Doe",
  "address": {
    "address1": "1 Example Ave.",
    "address2": "Example Address Line 2",
    "address3": "Example Address Line 3",
    "city": "Chicago",
    "state": "Illinois",
    "country": "US",
    "postalCode": "60056"
  },
  "contactMethods": [
    {
      "type": "email",
      "value": "jane.doe@example.com"
    },
    {
      "type": "phone",
      "value": "2025550164"
    }
  ],
  "owners": [
    {
      "firstName": "Jane",
      "lastName": "Doe",
      "dateOfBirth": "1964-03-22",
      "address": {
        "address1": "1 Example Ave.",
        "city": "Chicago",
        "state": "Illinois",
        "country": "US",
        "postalCode": "60056"
      },
      "identifiers": [
        {
          "type": "nationalId",
          "value": "000-00-4320"
        }
      ],
      "contactMethods": [
        {
          "type": "email",
          "value": "jane.doe@example.com"
        },
        {
          "type": "phone",
          "value": "2025550164"
        }
      ],
      "relationship": {
        "isControlProng": true,
        "equityPercentage": 48.5,
        "title": "CFO",
        "isAuthorizedSignatory": false
      },
      "middleName": "Helen"
    }
  ],
  "fundingAccounts": [
    {
      "type": "checking",
      "use": "credit",
      "nameOnAccount": "Jane Doe",
      "paymentMethods": [
        {
          "type": "ach",
          "value": {
            "routingNumber": "123456789",
            "accountNumber": "1234567890"
          }
        }
      ]
    }
  ],
  "metadata": {
    "yourCustomField": "abc123"
  }
}'
```

```typescript
import { PayrocClient } from "payroc";

async function main() {
    const client = new PayrocClient();
    await client.funding.fundingRecipients.create({
        idempotencyKey: "8e03978e-40d5-43e8-bc93-6894a57f9324",
        recipientType: "privateCorporation",
        taxId: "12-3456789",
        doingBusinessAs: "Pizza Doe",
        address: {
            address1: "1 Example Ave.",
            address2: "Example Address Line 2",
            address3: "Example Address Line 3",
            city: "Chicago",
            state: "Illinois",
            country: "US",
            postalCode: "60056",
        },
        contactMethods: [
            {
                type: "email",
                value: "jane.doe@example.com",
            },
            {
                type: "phone",
                value: "2025550164",
            },
        ],
        owners: [
            {
                firstName: "Jane",
                lastName: "Doe",
                dateOfBirth: "1964-03-22",
                address: {
                    address1: "1 Example Ave.",
                    city: "Chicago",
                    state: "Illinois",
                    country: "US",
                    postalCode: "60056",
                },
                identifiers: [
                    {
                        type: "nationalId",
                        value: "000-00-4320",
                    },
                ],
                contactMethods: [
                    {
                        type: "email",
                        value: "jane.doe@example.com",
                    },
                    {
                        type: "phone",
                        value: "2025550164",
                    },
                ],
                relationship: {
                    isControlProng: true,
                    equityPercentage: 48.5,
                    title: "CFO",
                    isAuthorizedSignatory: false,
                },
                middleName: "Helen",
            },
        ],
        fundingAccounts: [
            {
                type: "checking",
                use: "credit",
                nameOnAccount: "Jane Doe",
                paymentMethods: [
                    {
                        type: "ach",
                        value: {
                            routingNumber: "123456789",
                            accountNumber: "1234567890",
                        },
                    },
                ],
            },
        ],
        metadata: {
            "yourCustomField": "abc123",
        },
    });
}
main();

```

```python
from payroc import Payroc, Address, ContactMethod_Email, ContactMethod_Phone, Owner, Identifier, OwnerRelationship, FundingAccount, PaymentMethodsItem_Ach, PaymentMethodAchValue
import datetime

client = Payroc()

client.funding.funding_recipients.create(
    idempotency_key="8e03978e-40d5-43e8-bc93-6894a57f9324",
    recipient_type="privateCorporation",
    tax_id="12-3456789",
    doing_business_as="Pizza Doe",
    address=Address(
        address_1="1 Example Ave.",
        address_2="Example Address Line 2",
        address_3="Example Address Line 3",
        city="Chicago",
        state="Illinois",
        country="US",
        postal_code="60056",
    ),
    contact_methods=[
        ContactMethod_Email(
            value="jane.doe@example.com",
        ),
        ContactMethod_Phone(
            value="2025550164",
        )
    ],
    owners=[
        Owner(
            first_name="Jane",
            last_name="Doe",
            date_of_birth=datetime.date.fromisoformat("1964-03-22"),
            address=Address(
                address_1="1 Example Ave.",
                city="Chicago",
                state="Illinois",
                country="US",
                postal_code="60056",
            ),
            identifiers=[
                Identifier(
                    type="nationalId",
                    value="000-00-4320",
                )
            ],
            contact_methods=[
                ContactMethod_Email(
                    value="jane.doe@example.com",
                ),
                ContactMethod_Phone(
                    value="2025550164",
                )
            ],
            relationship=OwnerRelationship(
                is_control_prong=True,
                equity_percentage=48.5,
                title="CFO",
                is_authorized_signatory=False,
            ),
            middle_name="Helen",
        )
    ],
    funding_accounts=[
        FundingAccount(
            type="checking",
            use="credit",
            name_on_account="Jane Doe",
            payment_methods=[
                PaymentMethodsItem_Ach(
                    value=PaymentMethodAchValue(
                        routing_number="123456789",
                        account_number="1234567890",
                    ),
                )
            ],
        )
    ],
    metadata={
        "yourCustomField": "abc123"
    },
)

```

```java
package com.example.usage;

import com.payroc.api.PayrocApiClient;
import com.payroc.api.resources.funding.fundingrecipients.requests.CreateFundingRecipient;
import com.payroc.api.resources.funding.fundingrecipients.types.CreateFundingRecipientRecipientType;
import com.payroc.api.types.Address;
import com.payroc.api.types.ContactMethod;
import com.payroc.api.types.ContactMethodEmail;
import com.payroc.api.types.ContactMethodPhone;
import com.payroc.api.types.FundingAccount;
import com.payroc.api.types.FundingAccountType;
import com.payroc.api.types.FundingAccountUse;
import com.payroc.api.types.Identifier;
import com.payroc.api.types.IdentifierType;
import com.payroc.api.types.Owner;
import com.payroc.api.types.OwnerRelationship;
import com.payroc.api.types.PaymentMethodAch;
import com.payroc.api.types.PaymentMethodAchValue;
import com.payroc.api.types.PaymentMethodsItem;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.HashMap;

public class Example {
    public static void main(String[] args) {
        PayrocApiClient client = PayrocApiClient
            .builder()
            .build();

        client.funding().fundingRecipients().create(
            CreateFundingRecipient
                .builder()
                .idempotencyKey("8e03978e-40d5-43e8-bc93-6894a57f9324")
                .recipientType(CreateFundingRecipientRecipientType.PRIVATE_CORPORATION)
                .taxId("12-3456789")
                .doingBusinessAs("Pizza Doe")
                .address(
                    Address
                        .builder()
                        .address1("1 Example Ave.")
                        .city("Chicago")
                        .state("Illinois")
                        .country("US")
                        .postalCode("60056")
                        .address2("Example Address Line 2")
                        .address3("Example Address Line 3")
                        .build()
                )
                .contactMethods(
                    Arrays.asList(
                        ContactMethod.email(
                            ContactMethodEmail
                                .builder()
                                .value("jane.doe@example.com")
                                .build()
                        ),
                        ContactMethod.phone(
                            ContactMethodPhone
                                .builder()
                                .value("2025550164")
                                .build()
                        )
                    )
                )
                .owners(
                    Arrays.asList(
                        Owner
                            .builder()
                            .firstName("Jane")
                            .lastName("Doe")
                            .dateOfBirth(LocalDate.parse("1964-03-22"))
                            .address(
                                Address
                                    .builder()
                                    .address1("1 Example Ave.")
                                    .city("Chicago")
                                    .state("Illinois")
                                    .country("US")
                                    .postalCode("60056")
                                    .build()
                            )
                            .relationship(
                                OwnerRelationship
                                    .builder()
                                    .isControlProng(true)
                                    .equityPercentage(48.5f)
                                    .title("CFO")
                                    .isAuthorizedSignatory(false)
                                    .build()
                            )
                            .middleName("Helen")
                            .identifiers(
                                Arrays.asList(
                                    Identifier
                                        .builder()
                                        .type(IdentifierType.NATIONAL_ID)
                                        .value("000-00-4320")
                                        .build()
                                )
                            )
                            .contactMethods(
                                Arrays.asList(
                                    ContactMethod.email(
                                        ContactMethodEmail
                                            .builder()
                                            .value("jane.doe@example.com")
                                            .build()
                                    ),
                                    ContactMethod.phone(
                                        ContactMethodPhone
                                            .builder()
                                            .value("2025550164")
                                            .build()
                                    )
                                )
                            )
                            .build()
                    )
                )
                .fundingAccounts(
                    Arrays.asList(
                        FundingAccount
                            .builder()
                            .type(FundingAccountType.CHECKING)
                            .use(FundingAccountUse.CREDIT)
                            .nameOnAccount("Jane Doe")
                            .paymentMethods(
                                Arrays.asList(
                                    PaymentMethodsItem.ach(
                                        PaymentMethodAch
                                            .builder()
                                            .value(
                                                PaymentMethodAchValue
                                                    .builder()
                                                    .routingNumber("123456789")
                                                    .accountNumber("1234567890")
                                                    .build()
                                            )
                                            .build()
                                    )
                                )
                            )
                            .build()
                    )
                )
                .metadata(
                    new HashMap<String, String>() {{
                        put("yourCustomField", "abc123");
                    }}
                )
                .build()
        );
    }
}
```

```ruby
require "payroc"

client = Payroc::Client.new

client.funding.funding_recipients.create(
  idempotency_key: "8e03978e-40d5-43e8-bc93-6894a57f9324",
  recipient_type: "privateCorporation",
  tax_id: "12-3456789",
  doing_business_as: "Pizza Doe",
  address: {
    address_1: "1 Example Ave.",
    address_2: "Example Address Line 2",
    address_3: "Example Address Line 3",
    city: "Chicago",
    state: "Illinois",
    country: "US",
    postal_code: "60056"
  },
  contact_methods: [],
  owners: [{
    first_name: "Jane",
    last_name: "Doe",
    date_of_birth: "1964-03-22",
    address: {
      address_1: "1 Example Ave.",
      city: "Chicago",
      state: "Illinois",
      country: "US",
      postal_code: "60056"
    },
    identifiers: [{
      type: "nationalId",
      value: "000-00-4320"
    }],
    contact_methods: [],
    relationship: {
      is_control_prong: true,
      equity_percentage: 48.5,
      title: "CFO",
      is_authorized_signatory: false
    },
    middle_name: "Helen"
  }],
  funding_accounts: [{
    type: "checking",
    use: "credit",
    name_on_account: "Jane Doe",
    payment_methods: []
  }],
  metadata: {
    yourCustomField: "abc123"
  }
)

```

```csharp
using Payroc;
using System.Threading.Tasks;
using Payroc.Funding.FundingRecipients;
using System.Collections.Generic;
using System;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayrocClient();

        await client.Funding.FundingRecipients.CreateAsync(
            new CreateFundingRecipient {
                IdempotencyKey = "8e03978e-40d5-43e8-bc93-6894a57f9324",
                RecipientType = CreateFundingRecipientRecipientType.PrivateCorporation,
                TaxId = "12-3456789",
                DoingBusinessAs = "Pizza Doe",
                Address = new Address {
                    Address1 = "1 Example Ave.",
                    Address2 = "Example Address Line 2",
                    Address3 = "Example Address Line 3",
                    City = "Chicago",
                    State = "Illinois",
                    Country = "US",
                    PostalCode = "60056"
                },
                ContactMethods = new List<ContactMethod>(){
                    new ContactMethod(
                        new ContactMethodEmail {
                            Value = "jane.doe@example.com"
                        }
                    ),
                    new ContactMethod(
                        new ContactMethodPhone {
                            Value = "2025550164"
                        }
                    ),
                }
                ,
                Owners = new List<Owner>(){
                    new Owner {
                        FirstName = "Jane",
                        LastName = "Doe",
                        DateOfBirth = DateOnly.Parse("1964-03-22"),
                        Address = new Address {
                            Address1 = "1 Example Ave.",
                            City = "Chicago",
                            State = "Illinois",
                            Country = "US",
                            PostalCode = "60056"
                        },
                        Identifiers = new List<Identifier>(){
                            new Identifier {
                                Type = IdentifierType.NationalId,
                                Value = "000-00-4320"
                            },
                        }
                        ,
                        ContactMethods = new List<ContactMethod>(){
                            new ContactMethod(
                                new ContactMethodEmail {
                                    Value = "jane.doe@example.com"
                                }
                            ),
                            new ContactMethod(
                                new ContactMethodPhone {
                                    Value = "2025550164"
                                }
                            ),
                        }
                        ,
                        Relationship = new OwnerRelationship {
                            IsControlProng = true,
                            EquityPercentage = 48.5f,
                            Title = "CFO",
                            IsAuthorizedSignatory = false
                        },
                        MiddleName = "Helen"
                    },
                }
                ,
                FundingAccounts = new List<FundingAccount>(){
                    new FundingAccount {
                        Type = FundingAccountType.Checking,
                        Use = FundingAccountUse.Credit,
                        NameOnAccount = "Jane Doe",
                        PaymentMethods = new List<PaymentMethodsItem>(){
                            new PaymentMethodsItem(
                                new PaymentMethodAch {
                                    Value = new PaymentMethodAchValue {
                                        RoutingNumber = "123456789",
                                        AccountNumber = "1234567890"
                                    }
                                }
                            ),
                        }

                    },
                }
                ,
                Metadata = new Dictionary<string, string>(){
                    ["yourCustomField"] = "abc123",
                }

            }
        );
    }

}

```

```go
package main

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

func main() {

	url := "https://api.payroc.com/v1/funding-recipients"

	payload := strings.NewReader("{\n  \"recipientType\": \"privateCorporation\",\n  \"taxId\": \"12-3456789\",\n  \"doingBusinessAs\": \"Pizza Doe\",\n  \"address\": {\n    \"address1\": \"1 Example Ave.\",\n    \"address2\": \"Example Address Line 2\",\n    \"address3\": \"Example Address Line 3\",\n    \"city\": \"Chicago\",\n    \"state\": \"Illinois\",\n    \"country\": \"US\",\n    \"postalCode\": \"60056\"\n  },\n  \"contactMethods\": [\n    {\n      \"type\": \"email\",\n      \"value\": \"jane.doe@example.com\"\n    },\n    {\n      \"type\": \"phone\",\n      \"value\": \"2025550164\"\n    }\n  ],\n  \"owners\": [\n    {\n      \"firstName\": \"Jane\",\n      \"lastName\": \"Doe\",\n      \"dateOfBirth\": \"1964-03-22\",\n      \"address\": {\n        \"address1\": \"1 Example Ave.\",\n        \"city\": \"Chicago\",\n        \"state\": \"Illinois\",\n        \"country\": \"US\",\n        \"postalCode\": \"60056\"\n      },\n      \"identifiers\": [\n        {\n          \"type\": \"nationalId\",\n          \"value\": \"000-00-4320\"\n        }\n      ],\n      \"contactMethods\": [\n        {\n          \"type\": \"email\",\n          \"value\": \"jane.doe@example.com\"\n        },\n        {\n          \"type\": \"phone\",\n          \"value\": \"2025550164\"\n        }\n      ],\n      \"relationship\": {\n        \"isControlProng\": true,\n        \"equityPercentage\": 48.5,\n        \"title\": \"CFO\",\n        \"isAuthorizedSignatory\": false\n      },\n      \"middleName\": \"Helen\"\n    }\n  ],\n  \"fundingAccounts\": [\n    {\n      \"type\": \"checking\",\n      \"use\": \"credit\",\n      \"nameOnAccount\": \"Jane Doe\",\n      \"paymentMethods\": [\n        {\n          \"type\": \"ach\",\n          \"value\": {\n            \"routingNumber\": \"123456789\",\n            \"accountNumber\": \"1234567890\"\n          }\n        }\n      ]\n    }\n  ],\n  \"metadata\": {\n    \"yourCustomField\": \"abc123\"\n  }\n}")

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

	req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324")
	req.Header.Add("Authorization", "Bearer <token>")
	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))

}
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.payroc.com/v1/funding-recipients', [
  'body' => '{
  "recipientType": "privateCorporation",
  "taxId": "12-3456789",
  "doingBusinessAs": "Pizza Doe",
  "address": {
    "address1": "1 Example Ave.",
    "address2": "Example Address Line 2",
    "address3": "Example Address Line 3",
    "city": "Chicago",
    "state": "Illinois",
    "country": "US",
    "postalCode": "60056"
  },
  "contactMethods": [
    {
      "type": "email",
      "value": "jane.doe@example.com"
    },
    {
      "type": "phone",
      "value": "2025550164"
    }
  ],
  "owners": [
    {
      "firstName": "Jane",
      "lastName": "Doe",
      "dateOfBirth": "1964-03-22",
      "address": {
        "address1": "1 Example Ave.",
        "city": "Chicago",
        "state": "Illinois",
        "country": "US",
        "postalCode": "60056"
      },
      "identifiers": [
        {
          "type": "nationalId",
          "value": "000-00-4320"
        }
      ],
      "contactMethods": [
        {
          "type": "email",
          "value": "jane.doe@example.com"
        },
        {
          "type": "phone",
          "value": "2025550164"
        }
      ],
      "relationship": {
        "isControlProng": true,
        "equityPercentage": 48.5,
        "title": "CFO",
        "isAuthorizedSignatory": false
      },
      "middleName": "Helen"
    }
  ],
  "fundingAccounts": [
    {
      "type": "checking",
      "use": "credit",
      "nameOnAccount": "Jane Doe",
      "paymentMethods": [
        {
          "type": "ach",
          "value": {
            "routingNumber": "123456789",
            "accountNumber": "1234567890"
          }
        }
      ]
    }
  ],
  "metadata": {
    "yourCustomField": "abc123"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => '8e03978e-40d5-43e8-bc93-6894a57f9324',
  ],
]);

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

```swift
import Foundation

let headers = [
  "Idempotency-Key": "8e03978e-40d5-43e8-bc93-6894a57f9324",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "recipientType": "privateCorporation",
  "taxId": "12-3456789",
  "doingBusinessAs": "Pizza Doe",
  "address": [
    "address1": "1 Example Ave.",
    "address2": "Example Address Line 2",
    "address3": "Example Address Line 3",
    "city": "Chicago",
    "state": "Illinois",
    "country": "US",
    "postalCode": "60056"
  ],
  "contactMethods": [
    [
      "type": "email",
      "value": "jane.doe@example.com"
    ],
    [
      "type": "phone",
      "value": "2025550164"
    ]
  ],
  "owners": [
    [
      "firstName": "Jane",
      "lastName": "Doe",
      "dateOfBirth": "1964-03-22",
      "address": [
        "address1": "1 Example Ave.",
        "city": "Chicago",
        "state": "Illinois",
        "country": "US",
        "postalCode": "60056"
      ],
      "identifiers": [
        [
          "type": "nationalId",
          "value": "000-00-4320"
        ]
      ],
      "contactMethods": [
        [
          "type": "email",
          "value": "jane.doe@example.com"
        ],
        [
          "type": "phone",
          "value": "2025550164"
        ]
      ],
      "relationship": [
        "isControlProng": true,
        "equityPercentage": 48.5,
        "title": "CFO",
        "isAuthorizedSignatory": false
      ],
      "middleName": "Helen"
    ]
  ],
  "fundingAccounts": [
    [
      "type": "checking",
      "use": "credit",
      "nameOnAccount": "Jane Doe",
      "paymentMethods": [
        [
          "type": "ach",
          "value": [
            "routingNumber": "123456789",
            "accountNumber": "1234567890"
          ]
        ]
      ]
    ]
  ],
  "metadata": ["yourCustomField": "abc123"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-recipients")! 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()
```

**Successful response:**

### Response (201)

```json
{
  "recipientType": "privateCorporation",
  "taxId": "123456789",
  "doingBusinessAs": "string",
  "address": {
    "address1": "1 Example Ave.",
    "address2": "Example Address Line 2",
    "address3": "Example Address Line 3",
    "city": "Chicago",
    "state": "Illinois",
    "country": "US",
    "postalCode": "60056"
  },
  "contactMethods": [
    {
      "type": "email",
      "value": "jane.doe@example.com"
    }
  ],
  "owners": [
    {
      "ownerId": 4564,
      "link": {
        "rel": "owner",
        "href": "https://api.payroc.com/v1/owners/4564",
        "method": "get"
      }
    }
  ],
  "fundingAccounts": [
    {
      "fundingAccountId": 123,
      "status": "approved",
      "link": {
        "rel": "fundingAccount",
        "href": "https://api.payroc.com/v1/funding-accounts/123",
        "method": "get"
      }
    },
    {
      "fundingAccountId": 124,
      "status": "rejected",
      "link": {
        "rel": "fundingAccount",
        "href": "https://api.payroc.com/v1/funding-accounts/124",
        "method": "get"
      }
    }
  ],
  "recipientId": 234,
  "status": "approved",
  "createdDate": "2024-07-02T15:30:00Z",
  "lastModifiedDate": "2024-07-02T15:30:00Z",
  "charityId": "string",
  "metadata": {
    "yourCustomField": "abc123"
  }
}
```

### Test 2: Add a Funding Account to a Recipient

You can use our `/funding-recipients` endpoint to manage Funding Accounts associated with a Recipient.

* Use our `/funding-recipients` endpoint to add a new Funding Account to an existing Recipient.

### Request

POST [https://api.payroc.com/v1/funding-recipients/\{recipientId}/funding-accounts](https://api.payroc.com/v1/funding-recipients/\{recipientId}/funding-accounts)

```curl Funding account
curl -X POST https://api.payroc.com/v1/funding-recipients/234/funding-accounts \
     -H "Idempotency-Key: 8e03978e-40d5-43e8-bc93-6894a57f9324" \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json"
```

```typescript Funding account
import { PayrocClient } from "payroc";

async function main() {
    const client = new PayrocClient();
    await client.funding.fundingRecipients.createAccount(234, {
        idempotencyKey: "8e03978e-40d5-43e8-bc93-6894a57f9324",
    });
}
main();

```

```python Funding account
from payroc import Payroc

client = Payroc()

client.funding.funding_recipients.create_account(
    recipient_id=234,
    idempotency_key="8e03978e-40d5-43e8-bc93-6894a57f9324",
)

```

```java Funding account
package com.example.usage;

import com.payroc.api.PayrocApiClient;
import com.payroc.api.resources.funding.fundingrecipients.requests.CreateAccountFundingRecipientsRequest;

public class Example {
    public static void main(String[] args) {
        PayrocApiClient client = PayrocApiClient
            .builder()
            .build();

        client.funding().fundingRecipients().createAccount(
            234,
            CreateAccountFundingRecipientsRequest
                .builder()
                .idempotencyKey("8e03978e-40d5-43e8-bc93-6894a57f9324")
                .build()
        );
    }
}
```

```ruby Funding account
require "payroc"

client = Payroc::Client.new

client.funding.funding_recipients.create_account(
  recipient_id: 234,
  idempotency_key: "8e03978e-40d5-43e8-bc93-6894a57f9324"
)

```

```csharp Funding account
using Payroc;
using System.Threading.Tasks;
using Payroc.Funding.FundingRecipients;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayrocClient();

        await client.Funding.FundingRecipients.CreateAccountAsync(
            new CreateAccountFundingRecipientsRequest {
                RecipientId = 234,
                IdempotencyKey = "8e03978e-40d5-43e8-bc93-6894a57f9324",
                Body = new FundingAccount {
                    Type = FundingAccountType.Checking,
                    Use = FundingAccountUse.Credit,
                    NameOnAccount = ""
                }
            }
        );
    }

}

```

```go Funding account
package main

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

func main() {

	url := "https://api.payroc.com/v1/funding-recipients/234/funding-accounts"

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

	req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324")
	req.Header.Add("Authorization", "Bearer <token>")
	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))

}
```

```php Funding account
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.payroc.com/v1/funding-recipients/234/funding-accounts', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => '8e03978e-40d5-43e8-bc93-6894a57f9324',
  ],
]);

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

```swift Funding account
import Foundation

let headers = [
  "Idempotency-Key": "8e03978e-40d5-43e8-bc93-6894a57f9324",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-recipients/234/funding-accounts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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

**Successful response:**

### Response (201)

```json
{
  "type": "checking",
  "use": "credit",
  "nameOnAccount": "Jane Doe",
  "paymentMethods": [
    {
      "type": "ach",
      "value": {
        "routingNumber": "*****6789",
        "accountNumber": "******7890"
      }
    }
  ],
  "fundingAccountId": 123,
  "createdDate": "2024-07-02T15:30:00Z",
  "lastModifiedDate": "2024-07-02T15:30:00Z",
  "status": "approved",
  "metadata": {
    "yourCustomField": "abc123"
  },
  "links": [
    {
      "rel": "parent",
      "method": "get",
      "href": "https://api.payroc.com/v1/funding-recipients/234"
    }
  ]
}
```

### Test 3: Add a new Owner to a Recipient

You can use our `/funding-recipients` endpoint to create and manage Owner objects associated with the Funding Recipient.

* Use our `/funding-recipients` endpoint to create a new Owner.

### Request

POST [https://api.payroc.com/v1/funding-recipients/\{recipientId}/owners](https://api.payroc.com/v1/funding-recipients/\{recipientId}/owners)

```curl
curl -X POST https://api.payroc.com/v1/funding-recipients/234/owners \
     -H "Idempotency-Key: 8e03978e-40d5-43e8-bc93-6894a57f9324" \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "firstName": "Fred",
  "lastName": "Nerk",
  "dateOfBirth": "1980-01-19",
  "address": {
    "address1": "2 Example Ave.",
    "city": "Chicago",
    "state": "Illinois",
    "country": "US",
    "postalCode": "60056"
  },
  "identifiers": [
    {
      "type": "nationalId",
      "value": "000-00-9876"
    }
  ],
  "contactMethods": [
    {
      "type": "email",
      "value": "fred.nerk@example.com"
    },
    {
      "type": "phone",
      "value": "2025550110"
    }
  ],
  "relationship": {
    "isControlProng": false,
    "equityPercentage": 51.5,
    "title": "CEO",
    "isAuthorizedSignatory": true
  },
  "middleName": "Jim"
}'
```

```typescript
import { PayrocClient } from "payroc";

async function main() {
    const client = new PayrocClient();
    await client.funding.fundingRecipients.createOwner(234, {
        idempotencyKey: "8e03978e-40d5-43e8-bc93-6894a57f9324",
        body: {
            firstName: "Fred",
            lastName: "Nerk",
            dateOfBirth: "1980-01-19",
            address: {
                address1: "2 Example Ave.",
                city: "Chicago",
                state: "Illinois",
                country: "US",
                postalCode: "60056",
            },
            identifiers: [
                {
                    type: "nationalId",
                    value: "000-00-9876",
                },
            ],
            contactMethods: [
                {
                    type: "email",
                    value: "fred.nerk@example.com",
                },
                {
                    type: "phone",
                    value: "2025550110",
                },
            ],
            relationship: {
                isControlProng: false,
                equityPercentage: 51.5,
                title: "CEO",
                isAuthorizedSignatory: true,
            },
            middleName: "Jim",
        },
    });
}
main();

```

```python
from payroc import Payroc, Address, Identifier, ContactMethod_Email, ContactMethod_Phone, OwnerRelationship
import datetime

client = Payroc()

client.funding.funding_recipients.create_owner(
    recipient_id=234,
    idempotency_key="8e03978e-40d5-43e8-bc93-6894a57f9324",
    first_name="Fred",
    last_name="Nerk",
    date_of_birth=datetime.date.fromisoformat("1980-01-19"),
    address=Address(
        address_1="2 Example Ave.",
        city="Chicago",
        state="Illinois",
        country="US",
        postal_code="60056",
    ),
    identifiers=[
        Identifier(
            type="nationalId",
            value="000-00-9876",
        )
    ],
    contact_methods=[
        ContactMethod_Email(
            value="fred.nerk@example.com",
        ),
        ContactMethod_Phone(
            value="2025550110",
        )
    ],
    relationship=OwnerRelationship(
        is_control_prong=False,
        equity_percentage=51.5,
        title="CEO",
        is_authorized_signatory=True,
    ),
    middle_name="Jim",
)

```

```java
package com.example.usage;

import com.payroc.api.PayrocApiClient;
import com.payroc.api.resources.funding.fundingrecipients.requests.CreateOwnerFundingRecipientsRequest;
import com.payroc.api.types.Address;
import com.payroc.api.types.ContactMethod;
import com.payroc.api.types.ContactMethodEmail;
import com.payroc.api.types.ContactMethodPhone;
import com.payroc.api.types.Identifier;
import com.payroc.api.types.IdentifierType;
import com.payroc.api.types.Owner;
import com.payroc.api.types.OwnerRelationship;
import java.time.LocalDate;
import java.util.Arrays;

public class Example {
    public static void main(String[] args) {
        PayrocApiClient client = PayrocApiClient
            .builder()
            .build();

        client.funding().fundingRecipients().createOwner(
            234,
            CreateOwnerFundingRecipientsRequest
                .builder()
                .idempotencyKey("8e03978e-40d5-43e8-bc93-6894a57f9324")
                .body(
                    Owner
                        .builder()
                        .firstName("Fred")
                        .lastName("Nerk")
                        .dateOfBirth(LocalDate.parse("1980-01-19"))
                        .address(
                            Address
                                .builder()
                                .address1("2 Example Ave.")
                                .city("Chicago")
                                .state("Illinois")
                                .country("US")
                                .postalCode("60056")
                                .build()
                        )
                        .relationship(
                            OwnerRelationship
                                .builder()
                                .isControlProng(false)
                                .equityPercentage(51.5f)
                                .title("CEO")
                                .isAuthorizedSignatory(true)
                                .build()
                        )
                        .middleName("Jim")
                        .identifiers(
                            Arrays.asList(
                                Identifier
                                    .builder()
                                    .type(IdentifierType.NATIONAL_ID)
                                    .value("000-00-9876")
                                    .build()
                            )
                        )
                        .contactMethods(
                            Arrays.asList(
                                ContactMethod.email(
                                    ContactMethodEmail
                                        .builder()
                                        .value("fred.nerk@example.com")
                                        .build()
                                ),
                                ContactMethod.phone(
                                    ContactMethodPhone
                                        .builder()
                                        .value("2025550110")
                                        .build()
                                )
                            )
                        )
                        .build()
                )
                .build()
        );
    }
}
```

```ruby
require "payroc"

client = Payroc::Client.new

client.funding.funding_recipients.create_owner(
  recipient_id: 234,
  idempotency_key: "8e03978e-40d5-43e8-bc93-6894a57f9324",
  first_name: "Fred",
  middle_name: "Jim",
  last_name: "Nerk",
  date_of_birth: "1980-01-19",
  address: {
    address_1: "2 Example Ave.",
    city: "Chicago",
    state: "Illinois",
    country: "US",
    postal_code: "60056"
  },
  identifiers: [{
    type: "nationalId",
    value: "000-00-9876"
  }],
  contact_methods: [],
  relationship: {
    is_control_prong: false,
    equity_percentage: 51.5,
    title: "CEO",
    is_authorized_signatory: true
  }
)

```

```csharp
using Payroc;
using System.Threading.Tasks;
using Payroc.Funding.FundingRecipients;
using System;
using System.Collections.Generic;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayrocClient();

        await client.Funding.FundingRecipients.CreateOwnerAsync(
            new CreateOwnerFundingRecipientsRequest {
                RecipientId = 234,
                IdempotencyKey = "8e03978e-40d5-43e8-bc93-6894a57f9324",
                Body = new Owner {
                    FirstName = "Fred",
                    LastName = "Nerk",
                    DateOfBirth = DateOnly.Parse("1980-01-19"),
                    Address = new Address {
                        Address1 = "2 Example Ave.",
                        City = "Chicago",
                        State = "Illinois",
                        Country = "US",
                        PostalCode = "60056"
                    },
                    Identifiers = new List<Identifier>(){
                        new Identifier {
                            Type = IdentifierType.NationalId,
                            Value = "000-00-9876"
                        },
                    }
                    ,
                    ContactMethods = new List<ContactMethod>(){
                        new ContactMethod(
                            new ContactMethodEmail {
                                Value = "fred.nerk@example.com"
                            }
                        ),
                        new ContactMethod(
                            new ContactMethodPhone {
                                Value = "2025550110"
                            }
                        ),
                    }
                    ,
                    Relationship = new OwnerRelationship {
                        IsControlProng = false,
                        EquityPercentage = 51.5f,
                        Title = "CEO",
                        IsAuthorizedSignatory = true
                    },
                    MiddleName = "Jim"
                }
            }
        );
    }

}

```

```go
package main

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

func main() {

	url := "https://api.payroc.com/v1/funding-recipients/234/owners"

	payload := strings.NewReader("{\n  \"firstName\": \"Fred\",\n  \"lastName\": \"Nerk\",\n  \"dateOfBirth\": \"1980-01-19\",\n  \"address\": {\n    \"address1\": \"2 Example Ave.\",\n    \"city\": \"Chicago\",\n    \"state\": \"Illinois\",\n    \"country\": \"US\",\n    \"postalCode\": \"60056\"\n  },\n  \"identifiers\": [\n    {\n      \"type\": \"nationalId\",\n      \"value\": \"000-00-9876\"\n    }\n  ],\n  \"contactMethods\": [\n    {\n      \"type\": \"email\",\n      \"value\": \"fred.nerk@example.com\"\n    },\n    {\n      \"type\": \"phone\",\n      \"value\": \"2025550110\"\n    }\n  ],\n  \"relationship\": {\n    \"isControlProng\": false,\n    \"equityPercentage\": 51.5,\n    \"title\": \"CEO\",\n    \"isAuthorizedSignatory\": true\n  },\n  \"middleName\": \"Jim\"\n}")

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

	req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324")
	req.Header.Add("Authorization", "Bearer <token>")
	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))

}
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.payroc.com/v1/funding-recipients/234/owners', [
  'body' => '{
  "firstName": "Fred",
  "lastName": "Nerk",
  "dateOfBirth": "1980-01-19",
  "address": {
    "address1": "2 Example Ave.",
    "city": "Chicago",
    "state": "Illinois",
    "country": "US",
    "postalCode": "60056"
  },
  "identifiers": [
    {
      "type": "nationalId",
      "value": "000-00-9876"
    }
  ],
  "contactMethods": [
    {
      "type": "email",
      "value": "fred.nerk@example.com"
    },
    {
      "type": "phone",
      "value": "2025550110"
    }
  ],
  "relationship": {
    "isControlProng": false,
    "equityPercentage": 51.5,
    "title": "CEO",
    "isAuthorizedSignatory": true
  },
  "middleName": "Jim"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => '8e03978e-40d5-43e8-bc93-6894a57f9324',
  ],
]);

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

```swift
import Foundation

let headers = [
  "Idempotency-Key": "8e03978e-40d5-43e8-bc93-6894a57f9324",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "firstName": "Fred",
  "lastName": "Nerk",
  "dateOfBirth": "1980-01-19",
  "address": [
    "address1": "2 Example Ave.",
    "city": "Chicago",
    "state": "Illinois",
    "country": "US",
    "postalCode": "60056"
  ],
  "identifiers": [
    [
      "type": "nationalId",
      "value": "000-00-9876"
    ]
  ],
  "contactMethods": [
    [
      "type": "email",
      "value": "fred.nerk@example.com"
    ],
    [
      "type": "phone",
      "value": "2025550110"
    ]
  ],
  "relationship": [
    "isControlProng": false,
    "equityPercentage": 51.5,
    "title": "CEO",
    "isAuthorizedSignatory": true
  ],
  "middleName": "Jim"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-recipients/234/owners")! 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()
```

**Successful response:**

### Response (201)

```json
{
  "firstName": "Jane",
  "lastName": "Doe",
  "dateOfBirth": "1964-03-22",
  "address": {
    "address1": "1 Example Ave.",
    "city": "Chicago",
    "state": "Illinois",
    "country": "US",
    "postalCode": "60056",
    "address2": "Example Address Line 2",
    "address3": "Example Address Line 3"
  },
  "identifiers": [
    {
      "type": "nationalId",
      "value": "xxxxx4320"
    }
  ],
  "contactMethods": [
    {
      "type": "email",
      "value": "jane.doe@example.com"
    }
  ],
  "relationship": {
    "isControlProng": true,
    "equityPercentage": 48.5,
    "title": "CFO",
    "isAuthorizedSignatory": false
  },
  "ownerId": 4564,
  "middleName": "Helen"
}
```

### Test 4: Retrieve the Funding Accounts for a Recipient

To create accurate Funding Instructions, it's important to make sure that you can retrieve a list of Funding Accounts for any Funding Recipients that you create.

* Use our `/funding-accounts` endpoint to retrieve a list of Funding Accounts for a Funding Recipient.

### Request

GET [https://api.payroc.com/v1/funding-recipients/\{recipientId}/funding-accounts](https://api.payroc.com/v1/funding-recipients/\{recipientId}/funding-accounts)

```curl List of funding accounts
curl https://api.payroc.com/v1/funding-recipients/234/funding-accounts \
     -H "Authorization: Bearer <token>"
```

```typescript List of funding accounts
import { PayrocClient } from "payroc";

async function main() {
    const client = new PayrocClient();
    await client.funding.fundingRecipients.listAccounts(234);
}
main();

```

```python List of funding accounts
from payroc import Payroc

client = Payroc()

client.funding.funding_recipients.list_accounts(
    recipient_id=234,
)

```

```java List of funding accounts
package com.example.usage;

import com.payroc.api.PayrocApiClient;
import com.payroc.api.resources.funding.fundingrecipients.requests.ListFundingRecipientFundingAccountsRequest;

public class Example {
    public static void main(String[] args) {
        PayrocApiClient client = PayrocApiClient
            .builder()
            .build();

        client.funding().fundingRecipients().listAccounts(
            234,
            ListFundingRecipientFundingAccountsRequest
                .builder()
                .build()
        );
    }
}
```

```ruby List of funding accounts
require "payroc"

client = Payroc::Client.new

client.funding.funding_recipients.list_accounts(recipient_id: 234)

```

```csharp List of funding accounts
using Payroc;
using System.Threading.Tasks;
using Payroc.Funding.FundingRecipients;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayrocClient();

        await client.Funding.FundingRecipients.ListAccountsAsync(
            new ListFundingRecipientFundingAccountsRequest {
                RecipientId = 234
            }
        );
    }

}

```

```go List of funding accounts
package main

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

func main() {

	url := "https://api.payroc.com/v1/funding-recipients/234/funding-accounts"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```php List of funding accounts
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.payroc.com/v1/funding-recipients/234/funding-accounts', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```swift List of funding accounts
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-recipients/234/funding-accounts")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

**Successful response:**

### Response (200)

```json
[
  {
    "type": "checking",
    "use": "credit",
    "nameOnAccount": "Jane Doe",
    "paymentMethods": [
      {
        "type": "ach",
        "value": {
          "routingNumber": "*****6789",
          "accountNumber": "******7890"
        }
      }
    ],
    "fundingAccountId": 123,
    "createdDate": "2024-07-02T15:30:00Z",
    "lastModifiedDate": "2024-07-02T15:30:00Z",
    "status": "approved",
    "metadata": {
      "yourCustomField": "abc123"
    },
    "links": [
      {
        "rel": "parent",
        "method": "get",
        "href": "https://api.payroc.com/v1/funding-recipients/234"
      }
    ]
  },
  {
    "type": "checking",
    "use": "debit",
    "nameOnAccount": "Jane Doe",
    "paymentMethods": [
      {
        "type": "ach",
        "value": {
          "routingNumber": "*****8725",
          "accountNumber": "******3491"
        }
      }
    ],
    "fundingAccountId": 124,
    "createdDate": "2024-07-02T15:30:00Z",
    "lastModifiedDate": "2024-07-02T15:30:00Z",
    "status": "pending",
    "metadata": {
      "yourCustomField": "abc123"
    },
    "links": [
      {
        "rel": "parent",
        "method": "get",
        "href": "https://api.payroc.com/v1/funding-recipients/235"
      }
    ]
  }
]
```

## Testing Funding Instructions

You can use our `/funding-instructions` endpoint to tell us how to split your available funds across multiple Funding Accounts. For example, Funding Accounts that belong to your sales office, your merchants, or any Funding Recipients.
To verify that your integration works with this endpoint, run the following tests:

### Test 5: Create a new Funding Instruction

A Funding Instruction tells us how to split funds across multiple accounts.

* Use our `/funding-accounts` endpoint to retrieve a list of Funding Accounts.
* Use our `/funding-instructions` endpoint to create a new Funding Instruction.

### Request

POST [https://api.payroc.com/v1/funding-instructions](https://api.payroc.com/v1/funding-instructions)

```curl New instruction accepted.
curl -X POST https://api.payroc.com/v1/funding-instructions \
     -H "Idempotency-Key: 8e03978e-40d5-43e8-bc93-6894a57f9324" \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json"
```

```typescript New instruction accepted.
import { PayrocClient } from "payroc";

async function main() {
    const client = new PayrocClient();
    await client.funding.fundingInstructions.create({
        idempotencyKey: "8e03978e-40d5-43e8-bc93-6894a57f9324",
    });
}
main();

```

```python New instruction accepted.
from payroc import Payroc

client = Payroc()

client.funding.funding_instructions.create(
    idempotency_key="8e03978e-40d5-43e8-bc93-6894a57f9324",
)

```

```java New instruction accepted.
package com.example.usage;

import com.payroc.api.PayrocApiClient;
import com.payroc.api.resources.funding.fundinginstructions.requests.CreateFundingInstructionsRequest;

public class Example {
    public static void main(String[] args) {
        PayrocApiClient client = PayrocApiClient
            .builder()
            .build();

        client.funding().fundingInstructions().create(
            CreateFundingInstructionsRequest
                .builder()
                .idempotencyKey("8e03978e-40d5-43e8-bc93-6894a57f9324")
                .build()
        );
    }
}
```

```ruby New instruction accepted.
require "payroc"

client = Payroc::Client.new

client.funding.funding_instructions.create(idempotency_key: "8e03978e-40d5-43e8-bc93-6894a57f9324")

```

```csharp New instruction accepted.
using Payroc;
using System.Threading.Tasks;
using Payroc.Funding.FundingInstructions;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayrocClient();

        await client.Funding.FundingInstructions.CreateAsync(
            new CreateFundingInstructionsRequest {
                IdempotencyKey = "8e03978e-40d5-43e8-bc93-6894a57f9324",
                Body = new Instruction()
            }
        );
    }

}

```

```go New instruction accepted.
package main

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

func main() {

	url := "https://api.payroc.com/v1/funding-instructions"

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

	req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324")
	req.Header.Add("Authorization", "Bearer <token>")
	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))

}
```

```php New instruction accepted.
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.payroc.com/v1/funding-instructions', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
    'Idempotency-Key' => '8e03978e-40d5-43e8-bc93-6894a57f9324',
  ],
]);

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

```swift New instruction accepted.
import Foundation

let headers = [
  "Idempotency-Key": "8e03978e-40d5-43e8-bc93-6894a57f9324",
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-instructions")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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

**Successful response:**

### Response (201)

```json
{
  "instructionId": 64643131,
  "createdDate": "2024-07-02T15:30:00Z",
  "lastModifiedDate": "2024-07-02T15:30:00Z",
  "status": "accepted",
  "merchants": [
    {
      "merchantId": "4525644354",
      "recipients": [
        {
          "fundingAccountId": 123,
          "paymentMethod": "ACH",
          "amount": {
            "value": 120000,
            "currency": "USD"
          },
          "status": "accepted",
          "metadata": {
            "yourCustomField": "abc123"
          },
          "link": {
            "rel": "fundingAccount",
            "method": "get",
            "href": "https://api.payroc.com/v1/funding-accounts/123"
          }
        }
      ],
      "link": {
        "rel": "merchant",
        "method": "get",
        "href": "https://api.payroc.com/v1/processing-accounts/4525644354"
      }
    }
  ],
  "metadata": {
    "instructionRef": "abc123"
  }
}
```

### Test 6: Update a Funding Instruction

While a Funding Instruction has a status of `accepted`, you can continue to edit and update the instruction. To update a Funding Instruction, you must send a `PUT` request to the correct Funding Instruction id.

* Use our `/funding-instructions` endpoint to update a Funding Instruction.

**Successful response:**

### Test 7: List Funding Activity

You can use our `/funding-activity` endpoint to retrieve a list of all funding activity so far.

* Use our `/funding-activity` endpoint to retrieve a list of all funding activity.

### Request

GET [https://api.payroc.com/v1/funding-activity](https://api.payroc.com/v1/funding-activity)

```curl Paginated activity records
curl -G https://api.payroc.com/v1/funding-activity \
     -H "Authorization: Bearer <token>" \
     -d before=2571 \
     -d after=8516 \
     -d limit=25 \
     -d dateFrom=2024-07-02 \
     -d dateTo=2024-07-03 \
     -d merchantId=4525644354
```

```typescript Paginated activity records
import { PayrocClient } from "payroc";

async function main() {
    const client = new PayrocClient();
    await client.funding.fundingActivity.list({
        before: "2571",
        after: "8516",
        limit: 25,
        dateFrom: "2024-07-02",
        dateTo: "2024-07-03",
        merchantId: "4525644354",
    });
}
main();

```

```python Paginated activity records
from payroc import Payroc
import datetime

client = Payroc()

client.funding.funding_activity.list(
    before="2571",
    after="8516",
    limit=25,
    date_from=datetime.date.fromisoformat("2024-07-02"),
    date_to=datetime.date.fromisoformat("2024-07-03"),
    merchant_id="4525644354",
)

```

```java Paginated activity records
package com.example.usage;

import com.payroc.api.PayrocApiClient;
import com.payroc.api.resources.funding.fundingactivity.requests.ListFundingActivityRequest;
import java.time.LocalDate;

public class Example {
    public static void main(String[] args) {
        PayrocApiClient client = PayrocApiClient
            .builder()
            .build();

        client.funding().fundingActivity().list(
            ListFundingActivityRequest
                .builder()
                .dateFrom(LocalDate.parse("2024-07-02"))
                .dateTo(LocalDate.parse("2024-07-03"))
                .before("2571")
                .after("8516")
                .limit(25)
                .merchantId("4525644354")
                .build()
        );
    }
}
```

```ruby Paginated activity records
require "payroc"

client = Payroc::Client.new

client.funding.funding_activity.list(
  before: "2571",
  after: "8516",
  limit: 25,
  date_from: "2024-07-02",
  date_to: "2024-07-03",
  merchant_id: "4525644354"
)

```

```csharp Paginated activity records
using Payroc;
using System.Threading.Tasks;
using Payroc.Funding.FundingActivity;
using System;

namespace Usage;

public class Example
{
    public async Task Do() {
        var client = new PayrocClient();

        await client.Funding.FundingActivity.ListAsync(
            new ListFundingActivityRequest {
                Before = "2571",
                After = "8516",
                Limit = 25,
                DateFrom = DateOnly.Parse("2024-07-02"),
                DateTo = DateOnly.Parse("2024-07-03"),
                MerchantId = "4525644354"
            }
        );
    }

}

```

```go Paginated activity records
package main

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

func main() {

	url := "https://api.payroc.com/v1/funding-activity?before=2571&after=8516&limit=25&dateFrom=2024-07-02&dateTo=2024-07-03&merchantId=4525644354"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```php Paginated activity records
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.payroc.com/v1/funding-activity?before=2571&after=8516&limit=25&dateFrom=2024-07-02&dateTo=2024-07-03&merchantId=4525644354', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```swift Paginated activity records
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-activity?before=2571&after=8516&limit=25&dateFrom=2024-07-02&dateTo=2024-07-03&merchantId=4525644354")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

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

**Successful response:**

### Response (200)

```json
{
  "data": [
    {
      "id": 11,
      "date": "2024-07-02T17:00:00.000Z",
      "merchant": "Pizza Doe",
      "description": "sales",
      "amount": 4999,
      "type": "credit",
      "currency": "USD"
    },
    {
      "id": 12,
      "date": "2024-07-02T19:32:00.000Z",
      "merchant": "Pizza Doe",
      "description": "sales",
      "amount": 3999,
      "type": "credit",
      "currency": "USD"
    },
    {
      "id": 13,
      "date": "2024-07-02T17:00:00.000Z",
      "merchant": "Pizza Doe",
      "description": "sales",
      "amount": 3299,
      "type": "credit",
      "currency": "USD"
    },
    {
      "id": 14,
      "date": "2024-07-02T17:00:00.000Z",
      "merchant": "Pizza Doe",
      "description": "Interchange Fees",
      "amount": 50,
      "type": "debit",
      "currency": "USD",
      "recipient": "Payroc"
    },
    {
      "id": 15,
      "date": "2024-07-02T09:10:00.000Z",
      "merchant": "Pizza Doe",
      "description": "sales",
      "amount": 4999,
      "type": "credit",
      "currency": "USD"
    },
    {
      "id": 16,
      "date": "2024-07-02T17:00:00.000Z",
      "merchant": "Doe Hot Dogs",
      "description": "Adjustment",
      "amount": 750,
      "type": "credit",
      "currency": "USD"
    },
    {
      "id": 17,
      "date": "2024-07-02T17:00:00.000Z",
      "merchant": "Doe Hot Dogs",
      "description": "Interchange Fees",
      "amount": 5,
      "type": "debit",
      "currency": "USD",
      "recipient": "Payroc"
    },
    {
      "id": 18,
      "date": "2024-07-02T17:00:00.000Z",
      "merchant": "Pizza Doe",
      "description": "Charge back",
      "amount": 1000,
      "type": "debit",
      "currency": "USD",
      "recipient": "Payroc"
    },
    {
      "id": 19,
      "date": "2024-07-02T17:00:00.000Z",
      "merchant": "Pizza Doe",
      "description": "sales",
      "amount": 5999,
      "type": "credit",
      "currency": "USD"
    },
    {
      "id": 20,
      "date": "2024-07-02T17:00:00.000Z",
      "merchant": "Pizza Doe",
      "description": "payment",
      "amount": 1000,
      "type": "debit",
      "currency": "USD",
      "recipient": "Pizza Doe"
    }
  ],
  "limit": 10,
  "count": 10,
  "hasMore": true,
  "links": [
    {
      "rel": "previous",
      "method": "get",
      "href": "https://api.payroc.com/v1/funding-activity?before=11&limit=10&datefrom=2024-07-01&dateto=2024-07-03"
    },
    {
      "rel": "next",
      "method": "get",
      "href": "https://api.payroc.com/v1/funding-activity?after=20&limit=10&datefrom=2024-07-01&dateto=2024-07-03"
    }
  ]
}
```

## Results

After you complete your tests, send your results to [integrationsupport@payroc.com](mailto:integrationsupport@payroc.com).
A member of our team will contact you to confirm certification or to provide support.

## Need more help?

We are here to help! If you need help with your integration, contact us at [integrationsupport@payroc.com](mailto:integrationsupport@payroc.com) or through our **Developer Community**.