Bills represent your customers’ accounts payable: amounts they owe to vendors for goods or services received. Importing bills lets Layer track outstanding payables, recognize expenses, and reconcile the bank transactions that pay those bills.
A typical accounts payable flow has three steps:
- Create a vendor, the party the bill is owed to.
- Create a bill with its line items, terms, and due date.
- Record a bill payment against one or more bills.
Bill / AP support may need to be enabled for your platform. Reach out to your Layer contact for access.
Create a vendor
A bill must be associated with a vendor. Create one with the Create Vendor endpoint, supplying your own external_id so you can reference it later without storing Layer’s IDs.
curl -X POST https://sandbox.layerfi.com/v1/businesses/{businessId}/vendors \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"external_id": "vendor-1",
"company_name": "Acme Supplies Inc.",
"email": "billing@acmesupplies.com",
"office_phone": "555-123-4567",
"address_string": "123 Vendor St, Supply City, CA 90210"
}'
The API responds with a Vendor object. You can later look up vendors with List Vendors.
Create a bill
Create a bill with the Create Bill endpoint. Each bill references a vendor (by vendor_id or vendor_external_id), one or more line_items, and either a due_at date or bill_terms (one of DUE_ON_RECEIPT, NET_10, NET_15, NET_30, NET_60).
Each line item requires a product_name and unit_price (in cents) and may include a quantity, description, discounts, sales taxes, and an account_identifier to control which expense account the line posts to.
curl -X POST https://sandbox.layerfi.com/v1/businesses/{businessId}/bills \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"external_id": "vendor-bill-123",
"vendor_external_id": "vendor-1",
"received_at": "2024-06-01T10:11:57Z",
"bill_terms": "NET_30",
"reference_number": "VB-123",
"memo": "Monthly office supplies",
"line_items": [
{
"external_id": "bill-line-item-1",
"product_name": "Paper reams",
"description": "Monthly office supplies",
"unit_price": 1500,
"quantity": 10,
"discount_amount": 1000,
"sales_taxes": [
{
"tax_account": {
"type": "Tax_Name",
"name": "CA_SALES_TAX"
},
"amount": 1120
}
]
}
]
}'
The API responds with a Bill object. The bill’s status reflects how much has been paid (RECEIVED, PARTIALLY_PAID, PAID, or VOIDED), and outstanding_balance tracks what remains owed.
external_id is your idempotency key. Re-posting a bill with the same external_id updates the existing bill rather than creating a duplicate. To create many bills at once, use Batch Create Bills.
Record a bill payment
When a customer pays a bill, record the payment so Layer can mark the bill paid and reconcile it against bank activity.
For a payment made at the same time the bill is created, include a payments array directly in the Create Bill request. To record a payment against an existing bill, or a single payment that covers several bills, use the Create Bill Payment endpoint and allocate the amount across bills with bill_payment_allocations.
curl -X POST https://sandbox.layerfi.com/v1/businesses/{businessId}/bills/bill-payments \
-H "Authorization: Bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"external_id": "bill-payment-1",
"paid_at": "2024-06-15T00:00:00Z",
"method": "ACH",
"amount": 10000,
"bill_payment_allocations": [
{
"bill_external_id": "vendor-bill-123",
"amount": 10000
}
]
}'
The method is one of CASH, CHECK, CREDIT_CARD, ACH, CREDIT_BALANCE, or OTHER. All amounts are in cents.
Vendor credits and refunds
Layer also supports reducing payables through vendor credits (credits a vendor issues that can be applied to future bills) and vendor refunds (money a vendor returns). See the API reference for details.