A Refund represents a transaction that returns value from a business to a customer. Each refund has one or more Refund Allocations (targets) and zero or more Refund Payments.
Creating Refunds
There are two ways to create refunds:
Simple Refunds
Use simple refunds when you want to fully refund a single target (invoice, invoice line item, or invoice payment) and the refund is fully paid. Layer automatically:
Calculates the refund amount based on what can be refunded from the target
Creates one allocation that perfectly cancels out the target
Creates one refund payment that pays the refund in full
Itemized Refunds
Use itemized refunds for more complex scenarios including:
Refunding multiple targets in a single refund
Partial refunds that don’t fully cancel out the target
Unpaid refunds (refunds owed but not yet disbursed)
Custom allocation amounts or payment structures
With itemized refunds, you specify all allocations and payments explicitly.
Refund Object
Attributes
Unique identifier for the refund.
Unique ID of the refund in your system for linking purposes. Idempotency key .
Amount refunded to the customer in cents.
completed_at
ISO8601 timestamp
required
Time when the refund was completed.
Whether this refund is dedicated or not. Dedicated refunds can only have one allocation and one payment, and their allocation target cannot be changed.
allocations
array of RefundAllocation objects
payments
array of RefundPayment objects
Payouts associated with this refund.
Tags associated with the refund. created_at
ISO8601 timestamp
required
When the tag was created
updated_at
ISO8601 timestamp
required
When the tag was last updated
Memo for any text you would like to associate with the refund.
Arbitrary metadata you can include with the refund.
Any (typically user-visible) identifier you would like to associate with the refund. Can be used to filter when listing refunds.
Refund Allocation Object
A Refund Allocation represents one of the targets of a refund. It can reference a specific invoice, invoice line item, invoice payment, or customer.
For example, a refund can apply to two separate invoices if the invoices have the same customer.
The total of the amounts of the refund allocations must add up to the refund amount.
Unique identifier for the refund allocation.
ID of the invoice this allocation is associated with.
Amount of the allocation in cents.
line_items
array of RefundAllocationLineItem objects
External ID of the invoice this allocation is associated with.
ID of the invoice line item this allocation is associated with. If specified, must not refer to a different invoice than invoice_id
or invoice_external_id
.
invoice_line_item_external_id
The external ID of the invoice line item to refund. If specified alongside invoice_line_item_id
, they must refer to the same invoice line item.
ID of the invoice payment this allocation is associated with.
invoice_payment_external_id
External ID of the invoice payment this allocation is associated with.
The Customer associated with this refund allocation.
Tags associated with the refund allocation. created_at
ISO8601 timestamp
required
When the tag was created
updated_at
ISO8601 timestamp
required
When the tag was last updated
Memo for any text you would like to associate with the refund allocation.
Arbitrary metadata you can include with the refund allocation.
Any (typically user-visible) identifier you would like to associate with the refund allocation.
Refund Allocation Line Item Object
A Refund Allocation Line Item represents a specific line within a refund allocation, allowing for detailed breakdowns of how the allocation amount is distributed across different ledger accounts.
External identifier for the line item.
Amount of the line item in cents.
The ledger account associated with this line item.
The prepayment ledger account associated with this line item, if applicable.
Tags associated with the line item. created_at
ISO8601 timestamp
required
When the tag was created
updated_at
ISO8601 timestamp
required
When the tag was last updated
Memo for any text you would like to associate with the line item.
Arbitrary metadata you can include with the line item.
Any (typically user-visible) identifier you would like to associate with the refund pyment. Can be used to filter when listing refund payments.
Refund Payment Object
A Refund Payment represents a money movement by which the refund was disbursed to the customer.
A refund with zero payments represents a refund that is owed to a customer but has not yet been sent.
A refund can have many payments so long as the total of their refunded_amount
s does not exceed the total amount of the refund.
Refund payments are matchable to bank transactions and are therefore the means by which refunds are reconciled with bank accounts.
Unique identifier for the payment.
Unique ID of the payment in your system for linking purposes. Idempotency key .
Amount refunded to the customer in cents.
Fee paid by the business to make the refund payment (typically a payment processing fee).
completed_at
ISO8601 timestamp
required
Time when the payment was completed.
Method of the payment (e.g., CREDIT_CARD
, ACH
, etc.).
Processor used for the payment (e.g., STRIPE
, SHOPIFY
, etc.).
refunded_payment_fees
array of RefundedPaymentFee objects
Tags associated with the refund payment. created_at
ISO8601 timestamp
required
When the tag was created
updated_at
ISO8601 timestamp
required
When the tag was last updated
Memo for any text you would like to associate with the refund payment.
Arbitrary metadata you can include with the refund payment.
Refunded Payment Fee Object
A Refunded Payment Fee represents a fee that was refunded as part of a refund payment.
This differs from the ‘refund_processing_fee’ field on the refund payment, since that is paid by the business (typically to a payment processor), whereas this is refunded from the payment processor back to the business.
account
AccountIdentifier object
required
Identifier of the ledger account for the refunded payment fee.
Description of the fee that the refunded payment fee refunds.
Amount of the fee refund in cents.
Simple Refund Creation Parameters
Use these parameters to create a simple refund that fully refunds a single target (invoice, invoice line item, or invoice payment) and is fully paid.
Unique ID of the refund in your system for linking purposes. Idempotency key .
completed_at
ISO8601 timestamp
required
When the refund was completed and paid.
The ID of the invoice to refund. Cannot be used with other target identifiers.
The external ID of the invoice to refund. Cannot be used with other target identifiers.
The ID of the invoice line item to refund. Cannot be used with other target identifiers.
invoice_line_item_external_id
The external ID of the invoice line item to refund. Cannot be used with other target identifiers.
The ID of the invoice payment to refund. Cannot be used with other target identifiers.
invoice_payment_external_id
The external ID of the invoice payment to refund. Cannot be used with other target identifiers.
Fee charged to the business for processing the refund in cents. Defaults to 0.
method
PaymentMethod enum
required
Method of the payment (e.g., CREDIT_CARD
, ACH
, etc.).
Processor used for the payment (e.g., STRIPE
, SHOPIFY
, etc.).
tags
array of TagKeyValue objects
List of tags associated with this refund. Show TagKeyValue properties
Memo for any text you would like to associate with the refund.
Arbitrary metadata you can include with the refund.
Itemized Refund Creation Parameters
Use these parameters to create an itemized refund with full control over allocations and payments.
Unique ID of the refund in your system for linking purposes. Idempotency key .
The total amount of the refund in cents. Must equal the sum of all allocation amounts.
completed_at
ISO8601 timestamp
required
When the refund was completed.
allocations
array of RefundAllocationParams objects
required
The targets of the refund. Each allocation specifies how much of the refund should be applied to a specific invoice, line item, payment, or customer. Show RefundAllocationParams properties
External identifier for the allocation.
Total amount of this allocation in cents. Must equal the sum of all line item amounts.
line_items
array of LineItemParams objects
required
Line items that make up this allocation.
ID of the invoice this allocation targets.
External ID of the invoice this allocation targets.
ID of the invoice line item this allocation targets.
invoice_line_item_external_id
External ID of the invoice line item this allocation targets.
ID of the invoice payment this allocation targets.
invoice_payment_external_id
External ID of the invoice payment this allocation targets.
ID of the customer this allocation targets.
External ID of the customer this allocation targets.
tags
array of TagKeyValue objects
Tags for this allocation.
Memo for this allocation.
Metadata for this allocation.
payments
array of RefundPaymentParams objects
required
The payment methods and amounts used to process the refund. Show RefundPaymentParams properties
External identifier for the payment.
Amount refunded to the customer in cents.
Fee charged to the business for processing this payment.
completed_at
ISO8601 timestamp
required
When this payment was completed.
method
PaymentMethod enum
required
Payment method used.
Processor used for this payment.
refunded_payment_fees
array of RefundedPaymentFeeInput objects
Fees refunded as part of this payment.
tags
array of TagKeyValue objects
Tags for this payment.
Metadata for this payment.
Any (typically user-visible) identifier for this payment.
tags
array of TagKeyValue objects
List of tags associated with this refund.
Memo for any text you would like to associate with the refund.
Arbitrary metadata you can include with the refund.
{
"id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a" ,
"external_id" : "31415926535" ,
"refunded_amount" : 123 ,
"status" : "PAID" ,
"completed_at" : "2023-11-07T05:31:56Z" ,
"is_dedicated" : false ,
"allocations" : [
{
"id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a" ,
"invoice_id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a" ,
"amount" : 123 ,
"line_items" : [
{
"external_id" : "line-item-1" ,
"amount" : 123 ,
"ledger_account" : {
"id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a" ,
"name" : "Revenue" ,
"account_number" : "4000"
},
"prepayment_account" : null ,
"transaction_tags" : [],
"memo" : null ,
"metadata" : null
}
],
"invoice_external_id" : "invoice-123" ,
"invoice_line_item_id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a" ,
"invoice_line_item_external_id" : "line-item-123" ,
"invoice_payment_id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a" ,
"invoice_payment_external_id" : "payment-123" ,
"customer" : {
"id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a" ,
"external_id" : "31415926535" ,
"individual_name" : "John Doe" ,
"company_name" : "Acme Corp" ,
"email" : "john@example.com" ,
"mobile_phone" : "555-123-4567" ,
"office_phone" : "555-987-6543" ,
"address_string" : "123 Main St, Anytown, CA 90210" ,
"notes" : "VIP customer" ,
"status" : "ACTIVE" ,
"transaction_tags" : [
{
"key" : "CustomerType" ,
"value" : "Premium" ,
"created_at" : "2023-11-07T05:31:56Z" ,
"updated_at" : "2023-11-07T05:31:56Z" ,
"deleted_at" : null
}
]
},
"transaction_tags" : [
{
"key" : "RefundReason" ,
"value" : "CustomerRequest" ,
"created_at" : "2023-11-07T05:31:56Z" ,
"updated_at" : "2023-11-07T05:31:56Z" ,
"deleted_at" : null
}
],
"memo" : null ,
"metadata" : null
}
],
"payments" : [
{
"id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a" ,
"external_id" : "31415926535" ,
"refunded_amount" : 123 ,
"refund_processing_fee" : 15 ,
"completed_at" : "2023-11-07T05:31:56Z" ,
"method" : "CREDIT_CARD" ,
"processor" : "STRIPE" ,
"refunded_payment_fees" : [
{
"account" : {
"type" : "AccountId" ,
"id" : "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"description" : "Processing fee refund" ,
"fee_amount" : 10
}
],
"transaction_tags" : [
{
"key" : "ProcessorReference" ,
"value" : "ref_12345" ,
"created_at" : "2023-11-07T05:31:56Z" ,
"updated_at" : "2023-11-07T05:31:56Z" ,
"deleted_at" : null
}
],
"memo" : null ,
"metadata" : null
}
],
"payouts" : [],
"transaction_tags" : [
{
"key" : "Department" ,
"value" : "CustomerService" ,
"created_at" : "2023-11-07T05:31:56Z" ,
"updated_at" : "2023-11-07T05:31:56Z" ,
"deleted_at" : null
}
],
"memo" : null ,
"metadata" : null
}