curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/bills \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"received_at": "2023-11-07T05:31:56Z",
"line_items": [
{
"product_name": "<string>",
"unit_price": 123,
"external_id": "<string>",
"account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"prepayment_account_identifier": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"account_type": {
"display_name": "Asset"
},
"account_subtype": {
"display_name": "Current Assets"
}
},
"description": "<string>",
"quantity": 1,
"discount_amount": 123,
"sales_taxes": [
{
"amount": 123,
"tax_account": {
"name": "CALIFORNIA_VAT",
"type": "Tax_Name"
}
}
],
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"memo": "<string>",
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
],
"external_id": "<string>",
"due_at": "2023-11-07T05:31:56Z",
"additional_discount": 0,
"memo": "<string>",
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_external_id": "<string>",
"payments": [
{
"amount": 123,
"external_id": "<string>",
"processor": "<string>",
"payment_clearing_account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"memo": "<string>",
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
],
"additional_sales_taxes": [
{
"amount": 123,
"tax_account": {
"name": "CALIFORNIA_VAT",
"type": "Tax_Name"
}
}
],
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"is_expense": false,
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/bills"
payload = {
"received_at": "2023-11-07T05:31:56Z",
"line_items": [
{
"product_name": "<string>",
"unit_price": 123,
"external_id": "<string>",
"account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"prepayment_account_identifier": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"account_type": { "display_name": "Asset" },
"account_subtype": { "display_name": "Current Assets" }
},
"description": "<string>",
"quantity": 1,
"discount_amount": 123,
"sales_taxes": [
{
"amount": 123,
"tax_account": {
"name": "CALIFORNIA_VAT",
"type": "Tax_Name"
}
}
],
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"memo": "<string>",
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
],
"external_id": "<string>",
"due_at": "2023-11-07T05:31:56Z",
"additional_discount": 0,
"memo": "<string>",
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_external_id": "<string>",
"payments": [
{
"amount": 123,
"external_id": "<string>",
"processor": "<string>",
"payment_clearing_account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"memo": "<string>",
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
],
"additional_sales_taxes": [
{
"amount": 123,
"tax_account": {
"name": "CALIFORNIA_VAT",
"type": "Tax_Name"
}
}
],
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"is_expense": False,
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
received_at: '2023-11-07T05:31:56Z',
line_items: [
{
product_name: '<string>',
unit_price: 123,
external_id: '<string>',
account_identifier: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
prepayment_account_identifier: {
type: 'Single_Chart_Account',
id: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
name: 'Current Assets',
account_number: '4000',
account_type: {display_name: 'Asset'},
account_subtype: {display_name: 'Current Assets'}
},
description: '<string>',
quantity: 1,
discount_amount: 123,
sales_taxes: [{amount: 123, tax_account: {name: 'CALIFORNIA_VAT', type: 'Tax_Name'}}],
tags: [
{
key: 'department',
value: 'sales',
dimension_display_name: 'Department',
value_display_name: 'Sales Department'
}
],
memo: '<string>',
metadata: {
custom_field: 'value',
'any valid json': 'below 1kb',
nested: {'meaning of life': 42, array: []}
},
reference_number: '<string>'
}
],
external_id: '<string>',
due_at: '2023-11-07T05:31:56Z',
additional_discount: 0,
memo: '<string>',
vendor_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
vendor_external_id: '<string>',
payments: [
{
amount: 123,
external_id: '<string>',
processor: '<string>',
payment_clearing_account_identifier: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
tags: [
{
key: 'department',
value: 'sales',
dimension_display_name: 'Department',
value_display_name: 'Sales Department'
}
],
memo: '<string>',
metadata: {
custom_field: 'value',
'any valid json': 'below 1kb',
nested: {'meaning of life': 42, array: []}
},
reference_number: '<string>'
}
],
additional_sales_taxes: [{amount: 123, tax_account: {name: 'CALIFORNIA_VAT', type: 'Tax_Name'}}],
tags: [
{
key: 'department',
value: 'sales',
dimension_display_name: 'Department',
value_display_name: 'Sales Department'
}
],
is_expense: false,
metadata: {
custom_field: 'value',
'any valid json': 'below 1kb',
nested: {'meaning of life': 42, array: []}
},
reference_number: '<string>'
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/bills', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.layerfi.com/v1/businesses/{businessId}/bills",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'received_at' => '2023-11-07T05:31:56Z',
'line_items' => [
[
'product_name' => '<string>',
'unit_price' => 123,
'external_id' => '<string>',
'account_identifier' => [
'type' => 'AccountId',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'prepayment_account_identifier' => [
'type' => 'Single_Chart_Account',
'id' => [
'type' => 'AccountId',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'name' => 'Current Assets',
'account_number' => '4000',
'account_type' => [
'display_name' => 'Asset'
],
'account_subtype' => [
'display_name' => 'Current Assets'
]
],
'description' => '<string>',
'quantity' => 1,
'discount_amount' => 123,
'sales_taxes' => [
[
'amount' => 123,
'tax_account' => [
'name' => 'CALIFORNIA_VAT',
'type' => 'Tax_Name'
]
]
],
'tags' => [
[
'key' => 'department',
'value' => 'sales',
'dimension_display_name' => 'Department',
'value_display_name' => 'Sales Department'
]
],
'memo' => '<string>',
'metadata' => [
'custom_field' => 'value',
'any valid json' => 'below 1kb',
'nested' => [
'meaning of life' => 42,
'array' => [
]
]
],
'reference_number' => '<string>'
]
],
'external_id' => '<string>',
'due_at' => '2023-11-07T05:31:56Z',
'additional_discount' => 0,
'memo' => '<string>',
'vendor_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'vendor_external_id' => '<string>',
'payments' => [
[
'amount' => 123,
'external_id' => '<string>',
'processor' => '<string>',
'payment_clearing_account_identifier' => [
'type' => 'AccountId',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'tags' => [
[
'key' => 'department',
'value' => 'sales',
'dimension_display_name' => 'Department',
'value_display_name' => 'Sales Department'
]
],
'memo' => '<string>',
'metadata' => [
'custom_field' => 'value',
'any valid json' => 'below 1kb',
'nested' => [
'meaning of life' => 42,
'array' => [
]
]
],
'reference_number' => '<string>'
]
],
'additional_sales_taxes' => [
[
'amount' => 123,
'tax_account' => [
'name' => 'CALIFORNIA_VAT',
'type' => 'Tax_Name'
]
]
],
'tags' => [
[
'key' => 'department',
'value' => 'sales',
'dimension_display_name' => 'Department',
'value_display_name' => 'Sales Department'
]
],
'is_expense' => false,
'metadata' => [
'custom_field' => 'value',
'any valid json' => 'below 1kb',
'nested' => [
'meaning of life' => 42,
'array' => [
]
]
],
'reference_number' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.layerfi.com/v1/businesses/{businessId}/bills"
payload := strings.NewReader("{\n \"received_at\": \"2023-11-07T05:31:56Z\",\n \"line_items\": [\n {\n \"product_name\": \"<string>\",\n \"unit_price\": 123,\n \"external_id\": \"<string>\",\n \"account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"prepayment_account_identifier\": {\n \"type\": \"Single_Chart_Account\",\n \"id\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"Current Assets\",\n \"account_number\": \"4000\",\n \"account_type\": {\n \"display_name\": \"Asset\"\n },\n \"account_subtype\": {\n \"display_name\": \"Current Assets\"\n }\n },\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"discount_amount\": 123,\n \"sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"external_id\": \"<string>\",\n \"due_at\": \"2023-11-07T05:31:56Z\",\n \"additional_discount\": 0,\n \"memo\": \"<string>\",\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vendor_external_id\": \"<string>\",\n \"payments\": [\n {\n \"amount\": 123,\n \"external_id\": \"<string>\",\n \"processor\": \"<string>\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"additional_sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"is_expense\": false,\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\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(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.layerfi.com/v1/businesses/{businessId}/bills")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"received_at\": \"2023-11-07T05:31:56Z\",\n \"line_items\": [\n {\n \"product_name\": \"<string>\",\n \"unit_price\": 123,\n \"external_id\": \"<string>\",\n \"account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"prepayment_account_identifier\": {\n \"type\": \"Single_Chart_Account\",\n \"id\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"Current Assets\",\n \"account_number\": \"4000\",\n \"account_type\": {\n \"display_name\": \"Asset\"\n },\n \"account_subtype\": {\n \"display_name\": \"Current Assets\"\n }\n },\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"discount_amount\": 123,\n \"sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"external_id\": \"<string>\",\n \"due_at\": \"2023-11-07T05:31:56Z\",\n \"additional_discount\": 0,\n \"memo\": \"<string>\",\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vendor_external_id\": \"<string>\",\n \"payments\": [\n {\n \"amount\": 123,\n \"external_id\": \"<string>\",\n \"processor\": \"<string>\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"additional_sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"is_expense\": false,\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/bills")
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 \"received_at\": \"2023-11-07T05:31:56Z\",\n \"line_items\": [\n {\n \"product_name\": \"<string>\",\n \"unit_price\": 123,\n \"external_id\": \"<string>\",\n \"account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"prepayment_account_identifier\": {\n \"type\": \"Single_Chart_Account\",\n \"id\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"Current Assets\",\n \"account_number\": \"4000\",\n \"account_type\": {\n \"display_name\": \"Asset\"\n },\n \"account_subtype\": {\n \"display_name\": \"Current Assets\"\n }\n },\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"discount_amount\": 123,\n \"sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"external_id\": \"<string>\",\n \"due_at\": \"2023-11-07T05:31:56Z\",\n \"additional_discount\": 0,\n \"memo\": \"<string>\",\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vendor_external_id\": \"<string>\",\n \"payments\": [\n {\n \"amount\": 123,\n \"external_id\": \"<string>\",\n \"processor\": \"<string>\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"additional_sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"is_expense\": false,\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
"business_id": "188eb399-f171-4849-861c-5c02d91f800b",
"external_id": "vendor-bill-123",
"status": "PARTIALLY_PAID",
"terms": "NET_30",
"received_at": "2024-06-01T10:11:57.184157Z",
"due_at": "2024-07-01T10:11:57.184158Z",
"paid_at": null,
"voided_at": null,
"reference_number": "VB-123",
"vendor": {
"id": "a4c38874-8c01-4986-b8d0-4f159a52dd39",
"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",
"notes": "Primary office supplies vendor",
"status": "ACTIVE"
},
"line_items": [
{
"id": "733de30f-db72-4d52-98c5-fe070d4433f7",
"external_id": "bill-line-item-1",
"bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
"account_identifier": {
"type": "AccountId",
"id": "80b708b5-7b27-456c-9fb1-b8b918241908"
},
"ledger_account": {
"id": "80b708b5-7b27-456c-9fb1-b8b918241908",
"name": "Office Supplies",
"stable_name": "OFFICE_SUPPLIES",
"normality": "DEBIT",
"account_type": {
"value": "EXPENSE",
"display_name": "Expenses"
},
"account_subtype": {
"value": "OPERATING_EXPENSES",
"display_name": "Operating Expenses"
}
},
"description": "Monthly office supplies",
"product_name": "Paper reams",
"unit_price": 1500,
"quantity": "10.00",
"subtotal": 15000,
"discount_amount": 1000,
"sales_taxes_total": 1120,
"sales_taxes": [
{
"tax_account": {
"type": "Tax_Name",
"name": "CA_SALES_TAX"
},
"tax_ledger_account": {
"id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
"name": "Sales tax: CA",
"stable_name": "SALES_TAXES:CA",
"normality": "DEBIT",
"account_type": {
"value": "EXPENSE",
"display_name": "Expenses"
},
"account_subtype": {
"value": "SALES_TAXES",
"display_name": "Sales Taxes"
}
},
"amount": 1120
}
],
"total_amount": 15120,
"transaction_tags": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"key": "department",
"value": "operations",
"dimension_display_name": "Department",
"value_display_name": "Operations",
"dimension_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
"definition_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
"created_at": "2024-02-27T02:16:40.389772Z",
"updated_at": "2024-02-27T02:16:40.389772Z",
"deleted_at": null,
"archived_at": null
}
]
}
],
"subtotal": 15000,
"additional_sales_taxes": [],
"additional_sales_taxes_total": 0,
"total_amount": 15120,
"outstanding_balance": 5120,
"memo": "Memo for the office supplies purchase",
"payment_allocations": [
{
"id": "8901abcd-ef23-4567-8901-abcd12345678",
"bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
"payment_id": "590ed436-c2bd-4e39-8047-f913a852f99c",
"amount": 10000,
"payment": {
"id": "590ed436-c2bd-4e39-8047-f913a852f99c",
"external_id": "bill-payment-1",
"paid_at": "2024-06-15T00:00:00Z",
"method": "ACH",
"amount": 10000,
"processor": "BANK_TRANSFER",
"imported_at": "2024-06-15T18:11:57.339076Z",
"allocations": [
{
"id": "8901abcd-ef23-4567-8901-abcd12345678",
"bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
"payment_id": "590ed436-c2bd-4e39-8047-f913a852f99c",
"amount": 10000,
"transaction_tags": []
}
],
"transaction_tags": [],
"memo": "First partial payment",
"metadata": {},
"reference_number": "PAY-1001"
},
"transaction_tags": [],
"memo": "Allocated to June office supplies bill",
"metadata": {},
"reference_number": "ALLOC-1001"
}
],
"vendor_credits": [],
"imported_at": "2024-06-01T10:11:57.184157Z",
"updated_at": "2024-06-15T18:11:57.339076Z",
"transaction_tags": [],
"metadata": {}
}
}Create bill
Creates a new bill for a business.
curl --request POST \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/bills \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"received_at": "2023-11-07T05:31:56Z",
"line_items": [
{
"product_name": "<string>",
"unit_price": 123,
"external_id": "<string>",
"account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"prepayment_account_identifier": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"account_type": {
"display_name": "Asset"
},
"account_subtype": {
"display_name": "Current Assets"
}
},
"description": "<string>",
"quantity": 1,
"discount_amount": 123,
"sales_taxes": [
{
"amount": 123,
"tax_account": {
"name": "CALIFORNIA_VAT",
"type": "Tax_Name"
}
}
],
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"memo": "<string>",
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
],
"external_id": "<string>",
"due_at": "2023-11-07T05:31:56Z",
"additional_discount": 0,
"memo": "<string>",
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_external_id": "<string>",
"payments": [
{
"amount": 123,
"external_id": "<string>",
"processor": "<string>",
"payment_clearing_account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"memo": "<string>",
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
],
"additional_sales_taxes": [
{
"amount": 123,
"tax_account": {
"name": "CALIFORNIA_VAT",
"type": "Tax_Name"
}
}
],
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"is_expense": false,
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/bills"
payload = {
"received_at": "2023-11-07T05:31:56Z",
"line_items": [
{
"product_name": "<string>",
"unit_price": 123,
"external_id": "<string>",
"account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"prepayment_account_identifier": {
"type": "Single_Chart_Account",
"id": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"name": "Current Assets",
"account_number": "4000",
"account_type": { "display_name": "Asset" },
"account_subtype": { "display_name": "Current Assets" }
},
"description": "<string>",
"quantity": 1,
"discount_amount": 123,
"sales_taxes": [
{
"amount": 123,
"tax_account": {
"name": "CALIFORNIA_VAT",
"type": "Tax_Name"
}
}
],
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"memo": "<string>",
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
],
"external_id": "<string>",
"due_at": "2023-11-07T05:31:56Z",
"additional_discount": 0,
"memo": "<string>",
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_external_id": "<string>",
"payments": [
{
"amount": 123,
"external_id": "<string>",
"processor": "<string>",
"payment_clearing_account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"memo": "<string>",
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
],
"additional_sales_taxes": [
{
"amount": 123,
"tax_account": {
"name": "CALIFORNIA_VAT",
"type": "Tax_Name"
}
}
],
"tags": [
{
"key": "department",
"value": "sales",
"dimension_display_name": "Department",
"value_display_name": "Sales Department"
}
],
"is_expense": False,
"metadata": {
"custom_field": "value",
"any valid json": "below 1kb",
"nested": {
"meaning of life": 42,
"array": []
}
},
"reference_number": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
received_at: '2023-11-07T05:31:56Z',
line_items: [
{
product_name: '<string>',
unit_price: 123,
external_id: '<string>',
account_identifier: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
prepayment_account_identifier: {
type: 'Single_Chart_Account',
id: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
name: 'Current Assets',
account_number: '4000',
account_type: {display_name: 'Asset'},
account_subtype: {display_name: 'Current Assets'}
},
description: '<string>',
quantity: 1,
discount_amount: 123,
sales_taxes: [{amount: 123, tax_account: {name: 'CALIFORNIA_VAT', type: 'Tax_Name'}}],
tags: [
{
key: 'department',
value: 'sales',
dimension_display_name: 'Department',
value_display_name: 'Sales Department'
}
],
memo: '<string>',
metadata: {
custom_field: 'value',
'any valid json': 'below 1kb',
nested: {'meaning of life': 42, array: []}
},
reference_number: '<string>'
}
],
external_id: '<string>',
due_at: '2023-11-07T05:31:56Z',
additional_discount: 0,
memo: '<string>',
vendor_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
vendor_external_id: '<string>',
payments: [
{
amount: 123,
external_id: '<string>',
processor: '<string>',
payment_clearing_account_identifier: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
tags: [
{
key: 'department',
value: 'sales',
dimension_display_name: 'Department',
value_display_name: 'Sales Department'
}
],
memo: '<string>',
metadata: {
custom_field: 'value',
'any valid json': 'below 1kb',
nested: {'meaning of life': 42, array: []}
},
reference_number: '<string>'
}
],
additional_sales_taxes: [{amount: 123, tax_account: {name: 'CALIFORNIA_VAT', type: 'Tax_Name'}}],
tags: [
{
key: 'department',
value: 'sales',
dimension_display_name: 'Department',
value_display_name: 'Sales Department'
}
],
is_expense: false,
metadata: {
custom_field: 'value',
'any valid json': 'below 1kb',
nested: {'meaning of life': 42, array: []}
},
reference_number: '<string>'
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/bills', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.layerfi.com/v1/businesses/{businessId}/bills",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'received_at' => '2023-11-07T05:31:56Z',
'line_items' => [
[
'product_name' => '<string>',
'unit_price' => 123,
'external_id' => '<string>',
'account_identifier' => [
'type' => 'AccountId',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'prepayment_account_identifier' => [
'type' => 'Single_Chart_Account',
'id' => [
'type' => 'AccountId',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'name' => 'Current Assets',
'account_number' => '4000',
'account_type' => [
'display_name' => 'Asset'
],
'account_subtype' => [
'display_name' => 'Current Assets'
]
],
'description' => '<string>',
'quantity' => 1,
'discount_amount' => 123,
'sales_taxes' => [
[
'amount' => 123,
'tax_account' => [
'name' => 'CALIFORNIA_VAT',
'type' => 'Tax_Name'
]
]
],
'tags' => [
[
'key' => 'department',
'value' => 'sales',
'dimension_display_name' => 'Department',
'value_display_name' => 'Sales Department'
]
],
'memo' => '<string>',
'metadata' => [
'custom_field' => 'value',
'any valid json' => 'below 1kb',
'nested' => [
'meaning of life' => 42,
'array' => [
]
]
],
'reference_number' => '<string>'
]
],
'external_id' => '<string>',
'due_at' => '2023-11-07T05:31:56Z',
'additional_discount' => 0,
'memo' => '<string>',
'vendor_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'vendor_external_id' => '<string>',
'payments' => [
[
'amount' => 123,
'external_id' => '<string>',
'processor' => '<string>',
'payment_clearing_account_identifier' => [
'type' => 'AccountId',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'tags' => [
[
'key' => 'department',
'value' => 'sales',
'dimension_display_name' => 'Department',
'value_display_name' => 'Sales Department'
]
],
'memo' => '<string>',
'metadata' => [
'custom_field' => 'value',
'any valid json' => 'below 1kb',
'nested' => [
'meaning of life' => 42,
'array' => [
]
]
],
'reference_number' => '<string>'
]
],
'additional_sales_taxes' => [
[
'amount' => 123,
'tax_account' => [
'name' => 'CALIFORNIA_VAT',
'type' => 'Tax_Name'
]
]
],
'tags' => [
[
'key' => 'department',
'value' => 'sales',
'dimension_display_name' => 'Department',
'value_display_name' => 'Sales Department'
]
],
'is_expense' => false,
'metadata' => [
'custom_field' => 'value',
'any valid json' => 'below 1kb',
'nested' => [
'meaning of life' => 42,
'array' => [
]
]
],
'reference_number' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.layerfi.com/v1/businesses/{businessId}/bills"
payload := strings.NewReader("{\n \"received_at\": \"2023-11-07T05:31:56Z\",\n \"line_items\": [\n {\n \"product_name\": \"<string>\",\n \"unit_price\": 123,\n \"external_id\": \"<string>\",\n \"account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"prepayment_account_identifier\": {\n \"type\": \"Single_Chart_Account\",\n \"id\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"Current Assets\",\n \"account_number\": \"4000\",\n \"account_type\": {\n \"display_name\": \"Asset\"\n },\n \"account_subtype\": {\n \"display_name\": \"Current Assets\"\n }\n },\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"discount_amount\": 123,\n \"sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"external_id\": \"<string>\",\n \"due_at\": \"2023-11-07T05:31:56Z\",\n \"additional_discount\": 0,\n \"memo\": \"<string>\",\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vendor_external_id\": \"<string>\",\n \"payments\": [\n {\n \"amount\": 123,\n \"external_id\": \"<string>\",\n \"processor\": \"<string>\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"additional_sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"is_expense\": false,\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\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(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.layerfi.com/v1/businesses/{businessId}/bills")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"received_at\": \"2023-11-07T05:31:56Z\",\n \"line_items\": [\n {\n \"product_name\": \"<string>\",\n \"unit_price\": 123,\n \"external_id\": \"<string>\",\n \"account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"prepayment_account_identifier\": {\n \"type\": \"Single_Chart_Account\",\n \"id\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"Current Assets\",\n \"account_number\": \"4000\",\n \"account_type\": {\n \"display_name\": \"Asset\"\n },\n \"account_subtype\": {\n \"display_name\": \"Current Assets\"\n }\n },\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"discount_amount\": 123,\n \"sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"external_id\": \"<string>\",\n \"due_at\": \"2023-11-07T05:31:56Z\",\n \"additional_discount\": 0,\n \"memo\": \"<string>\",\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vendor_external_id\": \"<string>\",\n \"payments\": [\n {\n \"amount\": 123,\n \"external_id\": \"<string>\",\n \"processor\": \"<string>\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"additional_sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"is_expense\": false,\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/bills")
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 \"received_at\": \"2023-11-07T05:31:56Z\",\n \"line_items\": [\n {\n \"product_name\": \"<string>\",\n \"unit_price\": 123,\n \"external_id\": \"<string>\",\n \"account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"prepayment_account_identifier\": {\n \"type\": \"Single_Chart_Account\",\n \"id\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"name\": \"Current Assets\",\n \"account_number\": \"4000\",\n \"account_type\": {\n \"display_name\": \"Asset\"\n },\n \"account_subtype\": {\n \"display_name\": \"Current Assets\"\n }\n },\n \"description\": \"<string>\",\n \"quantity\": 1,\n \"discount_amount\": 123,\n \"sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"external_id\": \"<string>\",\n \"due_at\": \"2023-11-07T05:31:56Z\",\n \"additional_discount\": 0,\n \"memo\": \"<string>\",\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"vendor_external_id\": \"<string>\",\n \"payments\": [\n {\n \"amount\": 123,\n \"external_id\": \"<string>\",\n \"processor\": \"<string>\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"memo\": \"<string>\",\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n }\n ],\n \"additional_sales_taxes\": [\n {\n \"amount\": 123,\n \"tax_account\": {\n \"name\": \"CALIFORNIA_VAT\",\n \"type\": \"Tax_Name\"\n }\n }\n ],\n \"tags\": [\n {\n \"key\": \"department\",\n \"value\": \"sales\",\n \"dimension_display_name\": \"Department\",\n \"value_display_name\": \"Sales Department\"\n }\n ],\n \"is_expense\": false,\n \"metadata\": {\n \"custom_field\": \"value\",\n \"any valid json\": \"below 1kb\",\n \"nested\": {\n \"meaning of life\": 42,\n \"array\": []\n }\n },\n \"reference_number\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
"business_id": "188eb399-f171-4849-861c-5c02d91f800b",
"external_id": "vendor-bill-123",
"status": "PARTIALLY_PAID",
"terms": "NET_30",
"received_at": "2024-06-01T10:11:57.184157Z",
"due_at": "2024-07-01T10:11:57.184158Z",
"paid_at": null,
"voided_at": null,
"reference_number": "VB-123",
"vendor": {
"id": "a4c38874-8c01-4986-b8d0-4f159a52dd39",
"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",
"notes": "Primary office supplies vendor",
"status": "ACTIVE"
},
"line_items": [
{
"id": "733de30f-db72-4d52-98c5-fe070d4433f7",
"external_id": "bill-line-item-1",
"bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
"account_identifier": {
"type": "AccountId",
"id": "80b708b5-7b27-456c-9fb1-b8b918241908"
},
"ledger_account": {
"id": "80b708b5-7b27-456c-9fb1-b8b918241908",
"name": "Office Supplies",
"stable_name": "OFFICE_SUPPLIES",
"normality": "DEBIT",
"account_type": {
"value": "EXPENSE",
"display_name": "Expenses"
},
"account_subtype": {
"value": "OPERATING_EXPENSES",
"display_name": "Operating Expenses"
}
},
"description": "Monthly office supplies",
"product_name": "Paper reams",
"unit_price": 1500,
"quantity": "10.00",
"subtotal": 15000,
"discount_amount": 1000,
"sales_taxes_total": 1120,
"sales_taxes": [
{
"tax_account": {
"type": "Tax_Name",
"name": "CA_SALES_TAX"
},
"tax_ledger_account": {
"id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
"name": "Sales tax: CA",
"stable_name": "SALES_TAXES:CA",
"normality": "DEBIT",
"account_type": {
"value": "EXPENSE",
"display_name": "Expenses"
},
"account_subtype": {
"value": "SALES_TAXES",
"display_name": "Sales Taxes"
}
},
"amount": 1120
}
],
"total_amount": 15120,
"transaction_tags": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"key": "department",
"value": "operations",
"dimension_display_name": "Department",
"value_display_name": "Operations",
"dimension_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
"definition_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
"created_at": "2024-02-27T02:16:40.389772Z",
"updated_at": "2024-02-27T02:16:40.389772Z",
"deleted_at": null,
"archived_at": null
}
]
}
],
"subtotal": 15000,
"additional_sales_taxes": [],
"additional_sales_taxes_total": 0,
"total_amount": 15120,
"outstanding_balance": 5120,
"memo": "Memo for the office supplies purchase",
"payment_allocations": [
{
"id": "8901abcd-ef23-4567-8901-abcd12345678",
"bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
"payment_id": "590ed436-c2bd-4e39-8047-f913a852f99c",
"amount": 10000,
"payment": {
"id": "590ed436-c2bd-4e39-8047-f913a852f99c",
"external_id": "bill-payment-1",
"paid_at": "2024-06-15T00:00:00Z",
"method": "ACH",
"amount": 10000,
"processor": "BANK_TRANSFER",
"imported_at": "2024-06-15T18:11:57.339076Z",
"allocations": [
{
"id": "8901abcd-ef23-4567-8901-abcd12345678",
"bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
"payment_id": "590ed436-c2bd-4e39-8047-f913a852f99c",
"amount": 10000,
"transaction_tags": []
}
],
"transaction_tags": [],
"memo": "First partial payment",
"metadata": {},
"reference_number": "PAY-1001"
},
"transaction_tags": [],
"memo": "Allocated to June office supplies bill",
"metadata": {},
"reference_number": "ALLOC-1001"
}
],
"vendor_credits": [],
"imported_at": "2024-06-01T10:11:57.184157Z",
"updated_at": "2024-06-15T18:11:57.339076Z",
"transaction_tags": [],
"metadata": {}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The UUID of the business to create the bill for.
Body
When the bill was received by the business from the vendor.
Line items making up the bill.
Show child attributes
Show child attributes
External ID for the bill within your platform. Idempotency key.
When the bill is due. Either due_at or bill_terms must be specified, but not both.
Payment terms for the bill. Either due_at or bill_terms must be specified, but not both.
DUE_ON_RECEIPT, NET_10, NET_15, NET_30, NET_60 Additional discount applied to the whole bill in addition to individual line item discounts, in cents.
Memo for any text you would like to associate with the bill (for example, to display to end users).
ID of the vendor to associate with the bill. Either vendor_id or vendor_external_id must be specified.
External ID of the vendor to associate with the bill. Either vendor_id or vendor_external_id must be specified.
Payments that have been made towards the balance of the bill. When upserting an existing bill: omitting this field (or passing null) preserves any existing dedicated payments; passing an empty array [] removes all dedicated payments. Non-dedicated payments (those independently recorded or included in a vendor payout) are never removed by this field.
Show child attributes
Show child attributes
Additional sales tax line items for the bill.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Whether the bill should be treated as an expense.
Arbitrary custom metadata in JSON format with a size limit of 1KB.
{ "custom_field": "value", "any valid json": "below 1kb", "nested": { "meaning of life": 42, "array": [] } }
Any (typically user-visible) identifier you would like to associate with the bill. Can be used to filter when listing bills.
Response
Bill created successfully.
Show child attributes
Show child attributes