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

Mercoa supports instant addition and verification of bank accounts via Plaid. This allows you to skip the manual steps of collecting bank account details and sending and confirming micro-deposits.

Additionally, if you are already linking accounts to your platform via Plaid, Mercoa can use your pre-existing integration to add and verify bank accounts with zero user interaction.

We recommend using your own Plaid integration. This will allow you to own your UI and cause less friction for your users.
If you use Mercoa's built-in integration, the Plaid popup will show that the user is linking their bank account to Mercoa, not your platform.

[I have a Plaid integration](#i-have-a-plaid-integration)

[I don't have a Plaid integration](#i-dont-have-a-plaid-integration)

## I have a Plaid integration

### Configuring Plaid

Mercoa uses Moov for domestic ACH transfers. You will need to configure your Plaid account to authorize Moov.

To enable your Plaid account for the integration, go to the [Integrations](https://dashboard.plaid.com/developers/integrations) section of the account dashboard. If the integration is off, click the 'Enable' button for Moov to enable the integration.

### Processor Token

Creating a processor token gives Mercoa access to verify the bank account. It is recommended to use this method if you already have a Plaid integration, as Mercoa will have the most limited access to the bank account.

To create a processor token, follow [this guide](https://plaid.com/docs/auth/partnerships/moov/#write-server-side-handler) to create a processor token.

You will need to provide the routing and account number in the creation request, as Mercoa will not be able to pull this information from Plaid.

### Request

POST [https://api.mercoa.com/entity/\{entityId}/paymentMethod](https://api.mercoa.com/entity/\{entityId}/paymentMethod)

**`BankAccountPlaidProcessorToken`**

```curl BankAccountPlaidProcessorToken
curl -X POST https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "type": "bankAccount",
  "accountNumber": "99988767623",
  "accountType": "CHECKING",
  "routingNumber": "12345678",
  "plaid": {
    "processorToken": "processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
  }
}'
```

**`BankAccountPlaidProcessorToken`**

```python BankAccountPlaidProcessorToken
import requests

url = "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod"

payload = {
    "type": "bankAccount",
    "accountNumber": "99988767623",
    "accountType": "CHECKING",
    "routingNumber": "12345678",
    "plaid": { "processorToken": "processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176" }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

**`BankAccountPlaidProcessorToken`**

```typescript BankAccountPlaidProcessorToken
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entity.paymentMethod.create("ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", {
    type: "bankAccount",
    routingNumber: "12345678",
    accountNumber: "99988767623",
    accountType: "CHECKING",
    plaid: {
        processorToken: "processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
    }
});

```

**`BankAccountPlaidProcessorToken`**

```go BankAccountPlaidProcessorToken
package main

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

func main() {

	url := "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod"

	payload := strings.NewReader("{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"99988767623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"12345678\",\n  \"plaid\": {\n    \"processorToken\": \"processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}")

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

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

}
```

**`BankAccountPlaidProcessorToken`**

```ruby BankAccountPlaidProcessorToken
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"99988767623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"12345678\",\n  \"plaid\": {\n    \"processorToken\": \"processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}"

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

**`BankAccountPlaidProcessorToken`**

```java BankAccountPlaidProcessorToken
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"99988767623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"12345678\",\n  \"plaid\": {\n    \"processorToken\": \"processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}")
  .asString();
```

**`BankAccountPlaidProcessorToken`**

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod', [
  'body' => '{
  "type": "bankAccount",
  "accountNumber": "99988767623",
  "accountType": "CHECKING",
  "routingNumber": "12345678",
  "plaid": {
    "processorToken": "processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

**`BankAccountPlaidProcessorToken`**

```csharp BankAccountPlaidProcessorToken
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"99988767623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"12345678\",\n  \"plaid\": {\n    \"processorToken\": \"processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`BankAccountPlaidProcessorToken`**

```swift BankAccountPlaidProcessorToken
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "bankAccount",
  "accountNumber": "99988767623",
  "accountType": "CHECKING",
  "routingNumber": "12345678",
  "plaid": ["processorToken": "processor-sandbox-af1a0311-da53-4636-b754-dd15cc058176"]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")! 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()
```

### Access Token

You can also use an access token to verify the bank account. Unlike processor tokens, you can pass in an empty string for the routing number and account number.

### Request

POST [https://api.mercoa.com/entity/\{entityId}/paymentMethod](https://api.mercoa.com/entity/\{entityId}/paymentMethod)

**`BankAccountPlaidAccessToken`**

```curl BankAccountPlaidAccessToken
curl -X POST https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "type": "bankAccount",
  "accountNumber": "7623",
  "accountType": "CHECKING",
  "routingNumber": "",
  "plaid": {
    "accessToken": "access-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
    "accountId": "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
  }
}'
```

**`BankAccountPlaidAccessToken`**

```python BankAccountPlaidAccessToken
import requests

url = "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod"

payload = {
    "type": "bankAccount",
    "accountNumber": "7623",
    "accountType": "CHECKING",
    "routingNumber": "",
    "plaid": {
        "accessToken": "access-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
        "accountId": "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

**`BankAccountPlaidAccessToken`**

```typescript BankAccountPlaidAccessToken
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entity.paymentMethod.create("ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", {
    type: "bankAccount",
    routingNumber: "",
    accountNumber: "7623",
    accountType: "CHECKING",
    plaid: {
        accessToken: "access-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
        accountId: "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
    }
});

```

**`BankAccountPlaidAccessToken`**

```go BankAccountPlaidAccessToken
package main

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

func main() {

	url := "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod"

	payload := strings.NewReader("{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"7623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"\",\n  \"plaid\": {\n    \"accessToken\": \"access-sandbox-af1a0311-da53-4636-b754-dd15cc058176\",\n    \"accountId\": \"account-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}")

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

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

}
```

**`BankAccountPlaidAccessToken`**

```ruby BankAccountPlaidAccessToken
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"7623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"\",\n  \"plaid\": {\n    \"accessToken\": \"access-sandbox-af1a0311-da53-4636-b754-dd15cc058176\",\n    \"accountId\": \"account-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}"

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

**`BankAccountPlaidAccessToken`**

```java BankAccountPlaidAccessToken
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"7623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"\",\n  \"plaid\": {\n    \"accessToken\": \"access-sandbox-af1a0311-da53-4636-b754-dd15cc058176\",\n    \"accountId\": \"account-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}")
  .asString();
```

**`BankAccountPlaidAccessToken`**

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod', [
  'body' => '{
  "type": "bankAccount",
  "accountNumber": "7623",
  "accountType": "CHECKING",
  "routingNumber": "",
  "plaid": {
    "accessToken": "access-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
    "accountId": "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

**`BankAccountPlaidAccessToken`**

```csharp BankAccountPlaidAccessToken
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"7623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"\",\n  \"plaid\": {\n    \"accessToken\": \"access-sandbox-af1a0311-da53-4636-b754-dd15cc058176\",\n    \"accountId\": \"account-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`BankAccountPlaidAccessToken`**

```swift BankAccountPlaidAccessToken
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "bankAccount",
  "accountNumber": "7623",
  "accountType": "CHECKING",
  "routingNumber": "",
  "plaid": [
    "accessToken": "access-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
    "accountId": "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")! 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()
```

## I don't have a Plaid integration

If you don't have a Plaid integration, you can use Mercoa's built in integration to add and verify bank accounts.

### Mercoa React Component

You can use the [`BankAccount` component](https://react.mercoa.com/docs/PaymentMethods/BankAccount) to add and verify bank accounts. This is the recommended way to use Mercoa's Plaid integration.

### Plaid Link

You can use [Plaid Link](https://plaid.com/docs/link/web/) to add and verify bank accounts.

#### Creating a link token

You can create a link token using the [Plaid Link Token Creation Endpoint](/api-reference/entity/plaid-link-token).

Once you have a link token, you can use it in the Plaid Link component. Once the user has added and verified their bank account, the component will return a `public_token` and an `account_id` that you can use to create a Mercoa payment method.

You can pass in an empty string for the routing number and account number if you don't have them.

### Request

POST [https://api.mercoa.com/entity/\{entityId}/paymentMethod](https://api.mercoa.com/entity/\{entityId}/paymentMethod)

**`BankAccountPlaidPublicToken`**

```curl BankAccountPlaidPublicToken
curl -X POST https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "type": "bankAccount",
  "accountNumber": "7623",
  "accountType": "CHECKING",
  "routingNumber": "",
  "plaid": {
    "publicToken": "public-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
    "accountId": "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
  }
}'
```

**`BankAccountPlaidPublicToken`**

```python BankAccountPlaidPublicToken
import requests

url = "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod"

payload = {
    "type": "bankAccount",
    "accountNumber": "7623",
    "accountType": "CHECKING",
    "routingNumber": "",
    "plaid": {
        "publicToken": "public-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
        "accountId": "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
    }
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

**`BankAccountPlaidPublicToken`**

```typescript BankAccountPlaidPublicToken
import { MercoaClient } from "@mercoa/javascript";

const client = new MercoaClient({ token: "YOUR_TOKEN" });
await client.entity.paymentMethod.create("ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", {
    type: "bankAccount",
    routingNumber: "",
    accountNumber: "7623",
    accountType: "CHECKING",
    plaid: {
        publicToken: "public-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
        accountId: "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
    }
});

```

**`BankAccountPlaidPublicToken`**

```go BankAccountPlaidPublicToken
package main

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

func main() {

	url := "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod"

	payload := strings.NewReader("{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"7623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"\",\n  \"plaid\": {\n    \"publicToken\": \"public-sandbox-af1a0311-da53-4636-b754-dd15cc058176\",\n    \"accountId\": \"account-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}")

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

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

}
```

**`BankAccountPlaidPublicToken`**

```ruby BankAccountPlaidPublicToken
require 'uri'
require 'net/http'

url = URI("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"7623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"\",\n  \"plaid\": {\n    \"publicToken\": \"public-sandbox-af1a0311-da53-4636-b754-dd15cc058176\",\n    \"accountId\": \"account-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}"

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

**`BankAccountPlaidPublicToken`**

```java BankAccountPlaidPublicToken
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"7623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"\",\n  \"plaid\": {\n    \"publicToken\": \"public-sandbox-af1a0311-da53-4636-b754-dd15cc058176\",\n    \"accountId\": \"account-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}")
  .asString();
```

**`BankAccountPlaidPublicToken`**

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod', [
  'body' => '{
  "type": "bankAccount",
  "accountNumber": "7623",
  "accountType": "CHECKING",
  "routingNumber": "",
  "plaid": {
    "publicToken": "public-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
    "accountId": "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

**`BankAccountPlaidPublicToken`**

```csharp BankAccountPlaidPublicToken
using RestSharp;

var client = new RestClient("https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"type\": \"bankAccount\",\n  \"accountNumber\": \"7623\",\n  \"accountType\": \"CHECKING\",\n  \"routingNumber\": \"\",\n  \"plaid\": {\n    \"publicToken\": \"public-sandbox-af1a0311-da53-4636-b754-dd15cc058176\",\n    \"accountId\": \"account-sandbox-af1a0311-da53-4636-b754-dd15cc058176\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`BankAccountPlaidPublicToken`**

```swift BankAccountPlaidPublicToken
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "type": "bankAccount",
  "accountNumber": "7623",
  "accountType": "CHECKING",
  "routingNumber": "",
  "plaid": [
    "publicToken": "public-sandbox-af1a0311-da53-4636-b754-dd15cc058176",
    "accountId": "account-sandbox-af1a0311-da53-4636-b754-dd15cc058176"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/entity/ent_8545a84e-a45f-41bf-bdf1-33b42a55812c/paymentMethod")! 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()
```

### Mercoa iFrame

If you do not use React, you can use a Mercoa iFrame to add and verify bank accounts. This is not recommended if you are using React, as the Mercoa iFrame is not as flexible as the React component.

#### Generate a user token

Before you can embed the component, you will need to generate a user token. This token will be used to authenticate the user in the iFrame.

Follow [this guide](/getting-started/step-1-get-api-keys) to learn how to generate a user token.

#### Embed the Component

Once you have a user token, you can embed the component in your app.

##### Add a bank account button

```html
<script>
  // Listen for messages from the iFrame. If the payment method is added successfully, the iFrame will send a message with the payment method response.
  window.addEventListener('message', function (event) {
    if (event.origin === 'https://mercoa.com') {
      console.log(event.data) // PaymentMethodResponse object
    }
  })
</script>
<iframe
  src="https://mercoa.com/embedded/add-bank-account/button?token=<USER_TOKEN>"
  width="100%"
  height="100%"
  style="border: none;"
></iframe>
```

##### Open the bank account popup with your own button

```html
<script>
  // Listen for messages from the iFrame. If the payment method is added successfully, the iFrame will send a message with the payment method response.
  window.addEventListener('message', function (event) {
    if (event.origin === 'https://mercoa.com') {
      console.log(event.data) //PaymentMethodResponse object
      window.mercoaBankPopup.close() // Close the popup
    }
  })
</script>
<button
  onClick="function(){
  window.mercoaBankPopup = window.open(
    '/embedded/add-bank-account/popup?token=' + <USER_TOKEN>,
    'popup',
    'width=600,height=600',
  )
}"
>
  Your button text
</button>
```

##### Update the bank account popup with your own button

Sometimes, the Plaid conection needs to be re-established. To do this, open the 'update bank account' popup with the `paymentMethodId` you need to reconnect with Plaid.

```html
<script>
  // Listen for messages from the iFrame. If the payment method is added successfully, the iFrame will send a message with the payment method response.
  window.addEventListener('message', function (event) {
    if (event.origin === 'https://mercoa.com') {
      console.log(event.data) //PaymentMethodResponse object
      window.mercoaBankPopup.close() // Close the popup
    }
  })
</script>
<button
  onClick="function(){
  window.mercoaBankPopup = window.open(
    '/embedded/update-bank-account/{paymentMethodId}?token=' + <USER_TOKEN>,
    'popup',
    'width=600,height=600',
  )
}"
>
  Update Bank Account
</button>
```