Skip to main content
POST
/
v1
/
businesses
/
{businessId}
/
invoices
/
payments
/
bulk
Bulk create invoice payments
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/payments/bulk \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
[
  {
    "paid_at": "2023-11-07T05:31:56Z",
    "amount": 123,
    "invoice_payments": [
      {
        "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "invoice_external_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "amount": 123,
        "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>",
    "fee": 123,
    "additional_fees": [
      {
        "account": {
          "type": "AccountId",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        },
        "fee_amount": 123,
        "description": "<string>",
        "is_passed_to_customer": true
      }
    ],
    "processor": "<string>",
    "payment_clearing_account_identifier": {
      "type": "AccountId",
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    },
    "redemption_account": {
      "type": "AccountId",
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    },
    "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"
      }
    ],
    "memo": "<string>",
    "metadata": {},
    "reference_number": "<string>"
  }
]
'
[
  {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "external_id": "payment-1",
    "at": "2023-11-07T05:31:56Z",
    "fee": 123,
    "prepayment_account": {
      "type": "AccountId",
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
    },
    "payment_clearing_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"
      }
    },
    "additional_fees": [
      {
        "fee_amount": 123,
        "description": "<string>",
        "account": {
          "type": "AccountId",
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
        },
        "is_passed_to_customer": true
      }
    ],
    "amount": 123,
    "processor": "STRIPE",
    "imported_at": "2023-11-07T05:31:56Z",
    "allocations": [
      {
        "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "amount": 123,
        "amount_net_of_refunds": 123,
        "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"
          }
        ],
        "memo": "<string>",
        "metadata": {
          "custom_field": "value",
          "any valid json": "below 1kb",
          "nested": {
            "meaning of life": 42,
            "array": []
          }
        },
        "reference_number": "<string>"
      }
    ],
    "refund_allocations": [],
    "payouts": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "external_id": "payout-1234",
        "business_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "paid_out_amount": 123,
        "fee": 123,
        "processor": "STRIPE",
        "payment_clearing_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"
          }
        },
        "imported_at": "2023-11-07T05:31:56Z",
        "completed_at": "2023-11-07T05:31:56Z",
        "match": {
          "id": "6b0a3734-f4ef-4fb0-9fc1-3f59b0c1cf99",
          "match_type": "PAYOUT",
          "bank_transaction": {
            "type": "Bank_Transaction_Data",
            "id": "a703c8d6-cfe8-453d-a275-b92eacc6fc6e",
            "business_id": "738ec216-e8e5-48f2-b7f2-cdc89c96b3d4",
            "source": "STRIPE",
            "source_transaction_id": "trxn_1sdOeLQiFAKE2LQBkcvrJw95f",
            "source_account_id": "738ec216-e154-48f2-1111-cdc89c96b3d4",
            "imported_at": "2024-03-19T22:09:53.290591Z",
            "date": "2024-03-06T06:06:40Z",
            "direction": "CREDIT",
            "amount": 87459,
            "counterparty_name": null,
            "description": "Payout (po_1OqnTHISISFAKEiTVBkCiyAERwm).",
            "account_name": "Layer Banking",
            "categorization_status": "MATCHED"
          },
          "details": {
            "type": "Payout_Match",
            "id": "d224508b-b05e-41da-89de-0fbd8a573507",
            "amount": 87459,
            "date": "2024-03-06T00:00:00Z",
            "description": "Payout from STRIPE.",
            "adjustment": null
          }
        },
        "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"
          }
        ],
        "memo": "<string>",
        "metadata": {
          "custom_field": "value",
          "any valid json": "below 1kb",
          "nested": {
            "meaning of life": 42,
            "array": []
          }
        },
        "reference_number": "<string>"
      }
    ],
    "transaction_tags": [],
    "memo": "<string>",
    "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<uuid>
required

The UUID of the business to create payments for.

Body

application/json

Array of payments to create. Each payment follows the same schema as the single payment creation endpoint.

paid_at
string<date-time>
required

The timestamp when the payment was made.

method
enum<string>
required

Payment method.

Available options:
CASH,
CHECK,
CREDIT_CARD,
ACH,
CREDIT_BALANCE,
OTHER
amount
integer<int64>
required

Payment amount in cents.

invoice_payments
(Invoice Payment Allocation · object | Ledger Account Allocation · object)[]
required

Each element in this array is either an InvoicePaymentAllocation (allocating to an invoice) or an InvoicePaymentAllocationToLedgerAccount (allocating directly to a ledger account). The type is determined by the fields present: if account is provided, it is treated as a ledger account allocation; otherwise, it is treated as an invoice allocation.

Allocates a portion of the payment to a specific invoice.

external_id
string | null

External identifier for the payment, used for idempotency.

fee
integer<int64> | null

Fee amount in cents.

additional_fees
object[]

Additional fees associated with the payment.

processor
string | null

Payment processor name.

payment_clearing_account_identifier
Account ID · object

The ledger account to use for the payment (overrides the default determined by the payment method).

redemption_account
Account ID · object

Account to use for credit balance redemptions. Only applicable when method is CREDIT_BALANCE.

dedicated_refunds
object[]

Dedicated refunds to associate with this invoice payment.

tags
object[]

Tags to apply to the payment.

memo
string | null

Memo for any text you would like to associate with the payment.

metadata
object

Arbitrary custom metadata in JSON format.

reference_number
string | null

Any (typically user-visible) identifier you would like to associate with the payment.

Response

Payments created or updated successfully. Returns the created/updated payment objects in the same order as the request.

id
string<uuid>

Unique identifier for the payment.

external_id
string | null

Unique ID of the invoice payment in an external system for linking and idempotency.

Example:

"payment-1"

at
string<date-time>

Timestamp when the payment was completed.

method
enum<string>

Payment method.

Available options:
CASH,
CHECK,
CREDIT_CARD,
ACH,
CREDIT_BALANCE,
OTHER
fee
integer<int64>

Fee paid by business for processing of payment in positive cents.

prepayment_account
Account ID · object

Identifier for the ledger account to use if this is a prepayment.

payment_clearing_account
object

The the ledger account to use for the payment (overrides the default determined by the payment method), if specified.

additional_fees
object[]

List of additional fees associated with this payment.

amount
integer<int64>

Customer payment amount, in cents.

processor
string | null

Processor used to make the payment, if any. Any processor name can be provided and will be tracked. Allowed only when method is CREDIT_CARD, ACH, CREDIT_BALANCE, or OTHER.

Example:

"STRIPE"

imported_at
string<date-time>

Timestamp when the payment was imported into Layer.

allocations
(Invoice Payment Allocation · object | Ledger Account Allocation · object)[]

Allocations specify how a payment is distributed. A payment can include two types of allocations: InvoicePaymentAllocation (allocates to an invoice) and InvoicePaymentAllocationToLedgerAccount (allocates directly to a ledger account for overpayments or deposits). The sum of all allocation amounts must be less than or equal to the payment amount.

Allocates a portion of the payment to a specific invoice.

refund_allocations
object[]

Refund allocations associated with this invoice payment.

Example:
[]
payouts
object[]

Payouts associated with this payment.

transaction_tags
object[]

List of tags associated with this transaction.

Example:
[]
memo
string | null

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

metadata
object

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 payment. Can be used to filter when listing invoice payments.