Skip to main content
PUT
/
v1
/
businesses
/
{businessId}
/
invoices
/
{invoiceId}
Update invoice
curl --request PUT \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/{invoiceId} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "external_id": "019234",
  "sent_at": "2023-11-07T05:31:56Z",
  "due_at": "2023-11-07T05:31:56Z",
  "voided_at": "2023-11-07T05:31:56Z",
  "invoice_number": "1",
  "customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "customer_external_id": "<string>",
  "line_items": [
    {
      "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"
        }
      },
      "external_id": "<string>",
      "description": "Line item description",
      "product": "Widgets",
      "unit_price": 123,
      "quantity": 123,
      "discount_amount": 123,
      "sales_taxes": [
        {
          "amount": 123,
          "tax_account": {
            "name": "CALIFORNIA_VAT",
            "type": "Tax_Name"
          }
        }
      ],
      "dedicated_refunds": [
        {
          "external_id": "31415926535",
          "account_identifier": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "line_items": [
            {
              "amount": 123,
              "external_id": "<string>",
              "account_identifier": {
                "type": "AccountId",
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
              },
              "prepayment_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>"
            }
          ],
          "completed_at": "2023-11-07T05:31:56Z",
          "refund_processing_fee": 123,
          "processor": "<string>",
          "refunded_payment_fees": [
            {
              "account": {
                "type": "AccountId",
                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
              },
              "fee_amount": 123,
              "description": "<string>"
            }
          ],
          "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>",
          "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"
        }
      ],
      "time_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    }
  ],
  "additional_sales_taxes": [
    {
      "amount": 123,
      "tax_account": {
        "name": "CALIFORNIA_VAT",
        "type": "Tax_Name"
      }
    }
  ],
  "additional_discount": 123,
  "tips": 123,
  "tips_account": {
    "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>"
}
'
import requests

url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/{invoiceId}"

payload = {
    "external_id": "019234",
    "sent_at": "2023-11-07T05:31:56Z",
    "due_at": "2023-11-07T05:31:56Z",
    "voided_at": "2023-11-07T05:31:56Z",
    "invoice_number": "1",
    "customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "customer_external_id": "<string>",
    "line_items": [
        {
            "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" }
            },
            "external_id": "<string>",
            "description": "Line item description",
            "product": "Widgets",
            "unit_price": 123,
            "quantity": 123,
            "discount_amount": 123,
            "sales_taxes": [
                {
                    "amount": 123,
                    "tax_account": {
                        "name": "CALIFORNIA_VAT",
                        "type": "Tax_Name"
                    }
                }
            ],
            "dedicated_refunds": [
                {
                    "external_id": "31415926535",
                    "account_identifier": {
                        "type": "AccountId",
                        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
                    },
                    "line_items": [
                        {
                            "amount": 123,
                            "external_id": "<string>",
                            "account_identifier": {
                                "type": "AccountId",
                                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
                            },
                            "prepayment_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>"
                        }
                    ],
                    "completed_at": "2023-11-07T05:31:56Z",
                    "refund_processing_fee": 123,
                    "processor": "<string>",
                    "refunded_payment_fees": [
                        {
                            "account": {
                                "type": "AccountId",
                                "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
                            },
                            "fee_amount": 123,
                            "description": "<string>"
                        }
                    ],
                    "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>",
                    "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"
                }
            ],
            "time_entry_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        }
    ],
    "additional_sales_taxes": [
        {
            "amount": 123,
            "tax_account": {
                "name": "CALIFORNIA_VAT",
                "type": "Tax_Name"
            }
        }
    ],
    "additional_discount": 123,
    "tips": 123,
    "tips_account": {
        "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>"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    external_id: '019234',
    sent_at: '2023-11-07T05:31:56Z',
    due_at: '2023-11-07T05:31:56Z',
    voided_at: '2023-11-07T05:31:56Z',
    invoice_number: '1',
    customer_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    customer_external_id: '<string>',
    line_items: [
      {
        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'}
        },
        external_id: '<string>',
        description: 'Line item description',
        product: 'Widgets',
        unit_price: 123,
        quantity: 123,
        discount_amount: 123,
        sales_taxes: [{amount: 123, tax_account: {name: 'CALIFORNIA_VAT', type: 'Tax_Name'}}],
        dedicated_refunds: [
          {
            external_id: '31415926535',
            account_identifier: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
            line_items: [
              {
                amount: 123,
                external_id: '<string>',
                account_identifier: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
                prepayment_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>'
              }
            ],
            completed_at: '2023-11-07T05:31:56Z',
            refund_processing_fee: 123,
            processor: '<string>',
            refunded_payment_fees: [
              {
                account: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
                fee_amount: 123,
                description: '<string>'
              }
            ],
            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>',
            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'
          }
        ],
        time_entry_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'
      }
    ],
    additional_sales_taxes: [{amount: 123, tax_account: {name: 'CALIFORNIA_VAT', type: 'Tax_Name'}}],
    additional_discount: 123,
    tips: 123,
    tips_account: {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>'
  })
};

fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/{invoiceId}', 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}/invoices/{invoiceId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS => json_encode([
    'external_id' => '019234',
    'sent_at' => '2023-11-07T05:31:56Z',
    'due_at' => '2023-11-07T05:31:56Z',
    'voided_at' => '2023-11-07T05:31:56Z',
    'invoice_number' => '1',
    'customer_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
    'customer_external_id' => '<string>',
    'line_items' => [
        [
                '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'
                                ]
                ],
                'external_id' => '<string>',
                'description' => 'Line item description',
                'product' => 'Widgets',
                'unit_price' => 123,
                'quantity' => 123,
                'discount_amount' => 123,
                'sales_taxes' => [
                                [
                                                                'amount' => 123,
                                                                'tax_account' => [
                                                                                                                                'name' => 'CALIFORNIA_VAT',
                                                                                                                                'type' => 'Tax_Name'
                                                                ]
                                ]
                ],
                'dedicated_refunds' => [
                                [
                                                                'external_id' => '31415926535',
                                                                'account_identifier' => [
                                                                                                                                'type' => 'AccountId',
                                                                                                                                'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
                                                                ],
                                                                'line_items' => [
                                                                                                                                [
                                                                                                                                                                                                                                                                'amount' => 123,
                                                                                                                                                                                                                                                                'external_id' => '<string>',
                                                                                                                                                                                                                                                                'account_identifier' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'type' => 'AccountId',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'prepayment_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>'
                                                                                                                                ]
                                                                ],
                                                                'completed_at' => '2023-11-07T05:31:56Z',
                                                                'refund_processing_fee' => 123,
                                                                'processor' => '<string>',
                                                                'refunded_payment_fees' => [
                                                                                                                                [
                                                                                                                                                                                                                                                                'account' => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'type' => 'AccountId',
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                'fee_amount' => 123,
                                                                                                                                                                                                                                                                'description' => '<string>'
                                                                                                                                ]
                                                                ],
                                                                '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>',
                                                                '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'
                                ]
                ],
                'time_entry_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
        ]
    ],
    'additional_sales_taxes' => [
        [
                'amount' => 123,
                'tax_account' => [
                                'name' => 'CALIFORNIA_VAT',
                                'type' => 'Tax_Name'
                ]
        ]
    ],
    'additional_discount' => 123,
    'tips' => 123,
    'tips_account' => [
        '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>'
  ]),
  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}/invoices/{invoiceId}"

	payload := strings.NewReader("{\n  \"external_id\": \"019234\",\n  \"sent_at\": \"2023-11-07T05:31:56Z\",\n  \"due_at\": \"2023-11-07T05:31:56Z\",\n  \"voided_at\": \"2023-11-07T05:31:56Z\",\n  \"invoice_number\": \"1\",\n  \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"customer_external_id\": \"<string>\",\n  \"line_items\": [\n    {\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      \"external_id\": \"<string>\",\n      \"description\": \"Line item description\",\n      \"product\": \"Widgets\",\n      \"unit_price\": 123,\n      \"quantity\": 123,\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      \"dedicated_refunds\": [\n        {\n          \"external_id\": \"31415926535\",\n          \"account_identifier\": {\n            \"type\": \"AccountId\",\n            \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n          },\n          \"line_items\": [\n            {\n              \"amount\": 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\": \"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          \"completed_at\": \"2023-11-07T05:31:56Z\",\n          \"refund_processing_fee\": 123,\n          \"processor\": \"<string>\",\n          \"refunded_payment_fees\": [\n            {\n              \"account\": {\n                \"type\": \"AccountId\",\n                \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n              },\n              \"fee_amount\": 123,\n              \"description\": \"<string>\"\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          \"payment_clearing_account_identifier\": {\n            \"type\": \"AccountId\",\n            \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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      \"time_entry_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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  \"additional_discount\": 123,\n  \"tips\": 123,\n  \"tips_account\": {\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}")

	req, _ := http.NewRequest("PUT", 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.put("https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/{invoiceId}")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"external_id\": \"019234\",\n  \"sent_at\": \"2023-11-07T05:31:56Z\",\n  \"due_at\": \"2023-11-07T05:31:56Z\",\n  \"voided_at\": \"2023-11-07T05:31:56Z\",\n  \"invoice_number\": \"1\",\n  \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"customer_external_id\": \"<string>\",\n  \"line_items\": [\n    {\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      \"external_id\": \"<string>\",\n      \"description\": \"Line item description\",\n      \"product\": \"Widgets\",\n      \"unit_price\": 123,\n      \"quantity\": 123,\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      \"dedicated_refunds\": [\n        {\n          \"external_id\": \"31415926535\",\n          \"account_identifier\": {\n            \"type\": \"AccountId\",\n            \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n          },\n          \"line_items\": [\n            {\n              \"amount\": 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\": \"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          \"completed_at\": \"2023-11-07T05:31:56Z\",\n          \"refund_processing_fee\": 123,\n          \"processor\": \"<string>\",\n          \"refunded_payment_fees\": [\n            {\n              \"account\": {\n                \"type\": \"AccountId\",\n                \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n              },\n              \"fee_amount\": 123,\n              \"description\": \"<string>\"\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          \"payment_clearing_account_identifier\": {\n            \"type\": \"AccountId\",\n            \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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      \"time_entry_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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  \"additional_discount\": 123,\n  \"tips\": 123,\n  \"tips_account\": {\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}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/{invoiceId}")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"external_id\": \"019234\",\n  \"sent_at\": \"2023-11-07T05:31:56Z\",\n  \"due_at\": \"2023-11-07T05:31:56Z\",\n  \"voided_at\": \"2023-11-07T05:31:56Z\",\n  \"invoice_number\": \"1\",\n  \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n  \"customer_external_id\": \"<string>\",\n  \"line_items\": [\n    {\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      \"external_id\": \"<string>\",\n      \"description\": \"Line item description\",\n      \"product\": \"Widgets\",\n      \"unit_price\": 123,\n      \"quantity\": 123,\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      \"dedicated_refunds\": [\n        {\n          \"external_id\": \"31415926535\",\n          \"account_identifier\": {\n            \"type\": \"AccountId\",\n            \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n          },\n          \"line_items\": [\n            {\n              \"amount\": 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\": \"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          \"completed_at\": \"2023-11-07T05:31:56Z\",\n          \"refund_processing_fee\": 123,\n          \"processor\": \"<string>\",\n          \"refunded_payment_fees\": [\n            {\n              \"account\": {\n                \"type\": \"AccountId\",\n                \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n              },\n              \"fee_amount\": 123,\n              \"description\": \"<string>\"\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          \"payment_clearing_account_identifier\": {\n            \"type\": \"AccountId\",\n            \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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      \"time_entry_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\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  \"additional_discount\": 123,\n  \"tips\": 123,\n  \"tips_account\": {\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}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "type": "Invoice",
    "business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "external_id": "1",
    "sent_at": "2023-11-07T05:31:56Z",
    "due_at": "2023-11-07T05:31:56Z",
    "paid_at": "2023-11-07T05:31:56Z",
    "voided_at": "2023-11-07T05:31:56Z",
    "line_items": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "external_id": "<string>",
        "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "account_identifier": {
          "type": "AccountId",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        },
        "ledger_account": {
          "type": "Single_Chart_Account",
          "id": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "name": "Current Assets",
          "account_number": "4000",
          "stable_name": {
            "type": "StableName",
            "stable_name": "CURRENT_ASSETS"
          },
          "account_type": {
            "display_name": "Asset"
          },
          "account_subtype": {
            "display_name": "Current Assets"
          }
        },
        "prepayment_account": {
          "type": "Single_Chart_Account",
          "id": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "name": "Current Assets",
          "account_number": "4000",
          "stable_name": {
            "type": "StableName",
            "stable_name": "CURRENT_ASSETS"
          },
          "account_type": {
            "display_name": "Asset"
          },
          "account_subtype": {
            "display_name": "Current Assets"
          }
        },
        "description": "Widget sale",
        "product": "Widget",
        "unit_price": 123,
        "quantity": 123,
        "subtotal": 123,
        "discount_amount": 123,
        "sales_taxes_total": 123,
        "sales_taxes": [
          {
            "tax_account": {
              "name": "CALIFORNIA_VAT",
              "type": "Tax_Name"
            },
            "tax_ledger_account": {
              "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
              "name": "Sales tax: CALIFORNIA",
              "stable_name": "SALES_TAXES_PAYABLE:CALIFORNIA",
              "normality": "CREDIT",
              "account_type": {
                "value": "LIABILITY",
                "display_name": "Liabilities"
              },
              "account_subtype": {
                "value": "SALES_TAXES_PAYABLE",
                "display_name": "Sales Taxes Payable"
              }
            },
            "amount": 123
          }
        ],
        "total_amount": 123,
        "refund_allocations": [],
        "transaction_tags": [
          {
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "key": "ExampleTagKey",
            "value": "ExampleTagValue",
            "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
            "dimension_display_name": "<string>",
            "value_display_name": "<string>",
            "archived_at": "2023-11-07T05:31:56Z"
          }
        ]
      }
    ],
    "subtotal": 123,
    "additional_discount": 123,
    "additional_sales_taxes_total": 123,
    "additional_sales_taxes": [
      {
        "tax_account": {
          "name": "CALIFORNIA_VAT",
          "type": "Tax_Name"
        },
        "tax_ledger_account": {
          "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
          "name": "Sales tax: CALIFORNIA",
          "stable_name": "SALES_TAXES_PAYABLE:CALIFORNIA",
          "normality": "CREDIT",
          "account_type": {
            "value": "LIABILITY",
            "display_name": "Liabilities"
          },
          "account_subtype": {
            "value": "SALES_TAXES_PAYABLE",
            "display_name": "Sales Taxes Payable"
          }
        },
        "amount": 123
      }
    ],
    "tips": 123,
    "total_amount": 123,
    "outstanding_balance": 123,
    "memo": "<string>",
    "payment_allocations": [],
    "refund_allocations": [],
    "imported_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "transaction_tags": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "key": "ExampleTagKey",
        "value": "ExampleTagValue",
        "dimension_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "definition_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "dimension_display_name": "<string>",
        "value_display_name": "<string>",
        "archived_at": "2023-11-07T05:31:56Z"
      }
    ],
    "metadata": {
      "custom_field": "value",
      "any valid json": "below 1kb",
      "nested": {
        "meaning of life": 42,
        "array": []
      }
    },
    "reference_number": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

Content-Type
string

Content-Type must be set to application/json.

Path Parameters

businessId
string
required

The UUID of the business to update the invoice for.

invoiceId
string
required

The UUID of the invoice to update.

Body

application/json
external_id
string

External ID for the invoice within your platform. Idempotency key.

Example:

"019234"

sent_at
string<date-time>

When the invoice was sent by the business to the recipient.

due_at
string<date-time>

When the invoice is due.

voided_at
string<date-time>

When the invoice was voided. Voiding excludes the invoice entirely from accounting.

invoice_number
string

Number for the invoice for display to end-users.

Example:

"1"

customer_id
string<uuid>

ID of the customer to associate with the invoice.

customer_external_id
string

External ID of the customer to associate with the invoice.

line_items
object[]

Line items making up the invoice.

additional_sales_taxes
object[]

List of sales tax obligations on this line item.

additional_discount
integer

Additional discount applied to the whole invoice in addition to individual line items.

tips
integer

Tips included by the buyer, in cents.

tips_account
Account ID Ā· object

The Account Identifier for a tips account.

tags
object[]
memo
string | null

Memo for any text you would like to associate with the invoice (for example, to display to end users).

metadata
object | null

Arbitrary custom metadata in JSON format with a size limit of 1KB.

Example:
{
  "custom_field": "value",
  "any valid json": "below 1kb",
  "nested": { "meaning of life": 42, "array": [] }
}
reference_number
string | null

Any (typically user-visible) identifier you would like to associate with the invoice. Can be used to filter when listing invoices.

Response

200 - application/json

Invoice updated successfully.

data
object
required