Getting Started

Payments Only Integration

In this guide, we will be using Mercoa for AP Payments. We will not be using the frontend components or workflows.

Mercoa has a fully documented Rest API that can be used in any language. We also have Node, Python, and Java SDKs.

If you plan on using the frontend components, check out our standard guide

Install SDK

$npm install --save @mercoa/javascript
># or
>yarn add @mercoa/javascript

Create the payer entity

API Reference

The payer entity is the customer who will initiate the payment of an invoice. In order to start processing payments for the customer, you will need to collect data required to run KYB.

1import { MercoaClient, Mercoa } from "@mercoa/javascript";
3const mercoa = new MercoaClient({ token: "YOUR_TOKEN" });
5await mercoa.entity.create({
6 isCustomer: true,
7 isPayor: true,
8 isPayee: false,
9 accountType: Mercoa.AccountType.Business,
10 foreignId: "YOUR_DATABASE_ID",
11 profile: {
12 business: {
13 email: "",
14 legalBusinessName: "Acme Inc.",
15 website: "",
16 businessType: Mercoa.BusinessType.Llc,
17 phone: {
18 countryCode: "1",
19 number: "4155551234"
20 },
21 address: {
22 addressLine1: "123 Main St",
23 city: "San Francisco",
24 stateOrProvince: "CA",
25 postalCode: "94105",
26 country: "US"
27 },
28 taxId: {
29 ein: {
30 number: "12-3456789"
31 }
32 }
33 }
34 }

If you do not have all the data required, you can use Mercoa’s hosted onboarding to capture it.

By using a foreignId, you don’t need to store the Mercoa entityId in your system.

You can query for entities by foreignId with:

1const payer = await mercoa.entity.find({
2 isCustomer: true,
3 foreignId: "YOUR_DATABASE_ID",

Create Representatives

API Reference

If the entity is a business, you will need to collect information about the owners and controllers of the business.

See the Business Representatives guide for more details.

Mercoa’s hosted onboarding can capture this information for you!

Accept Terms of Service

Once the entity and representatives are created, your user will need to accept the Mercoa ToS. There are a few ways to do this:

  1. Include the Mercoas ToS as part of your ToS and have the user accept the updated ToS
  2. Show the Mercoa ToS directly, and have the user accept the Mercoa ToS

Mercoa’s hosted onboarding can have the user accept the terms of service directly

Once the user has accepted the ToS, use the Accept ToS Endpoint to indicate as such.

1await mercoa.entity.acceptTermsOfService(

Initiate KYB

Once all data is captured and ToS is verified, you can initiate the KYB process.

1await mercoa.entity.initiateKyb(

Create Payer Bank AccountType

The easiest way to connect the payer bank account is to use our Plaid integration

You can also create the account via API and use micro-deposits to verify it. Micro-deposits can take 2-5 days to show up in the bank account.


1const payerPaymentMethod = await mercoa.entity.paymentMethod.create(, {
2 type: Mercoa.PaymentMethodType.BankAccount, //'bankAccount'
3 accountNumber: '98766544354',
4 routingNumber: '12345678',
5 bankName: 'Bank of America',
6 accountType: Mercoa.BankType.Checking, //'CHECKING'

Initiate Micro Deposits:

1await mercoa.entity.paymentMethod.initiateMicroDeposits(,;

Complete Micro Deposits:

1await mercoa.entity.paymentMethod.completeMicroDeposits(,, {
2 amounts: [0.2, 0.4]

Create the vendor entity

The next step is to create the vendor entity. This is the entity that will be paid by your customer. For a business, we require their legal business name as well as their website or description.

1const vendor = await mercoa.entity.create({
2 isCustomer: false,
3 isPayor: false,
4 isPayee: true,
5 accountType: Mercoa.AccountType.Business,
6 foreignId: "YOUR_DATABASE_ID",
7 profile: {
8 business: {
9 legalBusinessName: "Acme Inc.",
10 website: "",
11 description: "Consulting Services",
12 }
13 }

Create vendor payment method

If you have the vendor’s bank acount information, you can pre-create their payment method

1const vendorPaymentMethod = await mercoa.entity.paymentMethod.create(, {
2 type: Mercoa.PaymentMethodType.BankAccount, //'bankAccount'
3 accountNumber: '98766544354',
4 routingNumber: '12345678',
5 bankName: 'Bank of America',
6 accountType: Mercoa.BankType.Checking, //'CHECKING'

Vendor bank accounts do not need to be verified.

If you don’t have the vendor’s account information, you can collect it using the entity onboarding link

Create and schedule the payment

The final step to make a payment is to create and schedule the invoice.

1const invoice = await mercoa.invoice.create({
2 status: Mercoa.InvoiceStatus.Scheduled,//'SCHEDULED',
3 payerId:,
4 creatorEntityId:,
5 vendorId:,
6 amount: 1000,
7 currency: Mercoa.CurrencyCode.Usd,//'USD',
8 invoiceDate: '2021-01-01',
9 dueDate: '2021-01-15',
10 deductionDate: '2021-01-13',
11 paymentSourceId:,
12 paymentDestinationId:

If you don’t have the paymentDestinationId, you can collect it using the payment acceptance link. The invoice needs to be set into the DRAFT or NEW state as it cannot be scheduled without a paymentDestinationId

On the deductionDate, the payment will be triggered! If the deductionDate is set to a past date or is set after the daily payments cutoff, the payment will be triggered on the next payments window.