{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "external_id": "vc001",
    "customer": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "external_id": "abc123",
      "individual_name": null,
      "company_name": "Widgets & Co",
      "email": null,
      "mobile_phone": null,
      "office_phone": null,
      "address_string": null,
      "notes": null,
      "status": "ACTIVE",
      "transaction_tags": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "key": "ExampleTagKey",
          "value": "ExampleTagValue",
          "created_at": "2023-11-07T05:31:56Z",
          "updated_at": "2023-11-07T05:31:56Z",
          "deleted_at": null
        }
      ]
    },
    "sent_at": "2023-11-07T05:31:56Z",
    "line_items": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "ledger_account": {
          "id": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "name": "Sales",
          "stable_name": {
            "type": "StableName",
            "stable_name": "SALES"
          },
          "normality": "CREDIT",
          "account_type": {
            "value": "REVENUE",
            "display_name": "Revenue"
          },
          "account_subtype": {
            "value": "SALES",
            "display_name": "Sales"
          }
        },
        "amount": 123,
        "memo": null
      }
    ],
    "allocations": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "customer_credit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "amount": 123
      }
    ],
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "deleted_at": null,
    "transaction_tags": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "key": "ExampleTagKey",
        "value": "ExampleTagValue",
        "created_at": "2023-11-07T05:31:56Z",
        "updated_at": "2023-11-07T05:31:56Z",
        "deleted_at": null
      }
    ],
    "metadata": null
  }
}
A Customer Credit represents a transaction that reduces accounts payable to a customer, typically due to returned goods. Each customer credit has one or more line items specifying debited revenue accounts, and zero or more allocations applying portions of the credit to invoices.

Attributes

id
string
required
Unique identifier for the customer credit.
external_id
string
Unique ID of the customer credit in your system for linking purposes. Idempotency key.
customer
Customer object
required
The Customer associated with this credit.
sent_at
ISO8601 timestamp
required
Time when the customer credit was sent.
line_items
array of CustomerCreditLineItem objects
required
Line items included in this customer credit. See Customer Credit Line Item Object for details.
allocations
array of CustomerCreditAllocation objects
Allocations of this customer credit to invoices. See Customer Credit Allocation Object for details.
created_at
ISO8601 timestamp
required
Time when the customer credit was created in Layer.
updated_at
ISO8601 timestamp
required
Time when the customer credit was last updated in Layer.
deleted_at
ISO8601 timestamp
Time when the customer credit was deleted, if applicable.
transaction_tags
Array of Tags
Tags associated with the customer credit.
memo
string
Memo for any text you would like to associate with the customer credit (for example, to display to end users).
metadata
object
Arbitrary custom metadata in JSON format with a size limit of 10KB.
reference_number
string
Any (typically user-visible) identifier you would like to associate with the customer credit. Can be used to filter when listing customer credits.

Customer Credit Line Item Object

A Customer Credit Line Item represents an individual revenue account being credited by the Customer Credit.
id
string
required
Unique identifier for the customer credit line item.
ledger_account
SingleApiChartAccount object
Ledger account associated with this line item. This is what you’re specifying with the ‘revenue_account_identifier’ in the create parameters.
amount
integer
required
Amount for the line item in cents.
memo
string
Description or notes for the line item.
metadata
json object
Arbitrary metadata you can include with the customer credit line item

Customer Credit Allocation Object

A Customer Credit Allocation represents how a portion of a customer credit is applied to a specific invoice. By allocating customer credits to invoices, the amount owed to customers can be reduced accordingly.
id
string
required
Unique identifier for the customer credit allocation.
customer_credit_id
string
required
ID of the customer credit this allocation belongs to.
invoice_id
string
required
ID of the invoice this allocation is for.
amount
integer
required
Amount of the allocation in cents.
{
  "data": {
    "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "external_id": "vc001",
    "customer": {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "external_id": "abc123",
      "individual_name": null,
      "company_name": "Widgets & Co",
      "email": null,
      "mobile_phone": null,
      "office_phone": null,
      "address_string": null,
      "notes": null,
      "status": "ACTIVE",
      "transaction_tags": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "key": "ExampleTagKey",
          "value": "ExampleTagValue",
          "created_at": "2023-11-07T05:31:56Z",
          "updated_at": "2023-11-07T05:31:56Z",
          "deleted_at": null
        }
      ]
    },
    "sent_at": "2023-11-07T05:31:56Z",
    "line_items": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "ledger_account": {
          "id": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "name": "Sales",
          "stable_name": {
            "type": "StableName",
            "stable_name": "SALES"
          },
          "normality": "CREDIT",
          "account_type": {
            "value": "REVENUE",
            "display_name": "Revenue"
          },
          "account_subtype": {
            "value": "SALES",
            "display_name": "Sales"
          }
        },
        "amount": 123,
        "memo": null
      }
    ],
    "allocations": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "customer_credit_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "amount": 123
      }
    ],
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "deleted_at": null,
    "transaction_tags": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "key": "ExampleTagKey",
        "value": "ExampleTagValue",
        "created_at": "2023-11-07T05:31:56Z",
        "updated_at": "2023-11-07T05:31:56Z",
        "deleted_at": null
      }
    ],
    "metadata": null
  }
}