POST
/
v1
/
businesses
/
{businessId}
/
invoices
/
refunds
curl --request POST \
  --url https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "external_id": "<string>",
  "refunded_amount": 123,
  "completed_at": "2023-11-07T05:31:56Z",
  "payments": [
    {
      "external_id": "31415926535",
      "refunded_amount": 123,
      "refund_processing_fee": 123,
      "completed_at": "2023-11-07T05:31:56Z",
      "method": "CASH",
      "processor": "STRIPE",
      "refunded_payment_fees": [
        {
          "account": {
            "type": "AccountId",
            "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
          },
          "description": "<string>",
          "fee_amount": 123
        }
      ]
    }
  ],
  "refund_processing_fee": 123,
  "method": "CASH",
  "processor": "<string>",
  "refunded_payment_fees": [
    {
      "account": {
        "type": "AccountId",
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      },
      "description": "<string>",
      "fee_amount": 123
    }
  ],
  "allocations": [
    {
      "amount": 123,
      "account_identifier": {
        "type": "AccountId",
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      },
      "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "invoice_external_id": "<string>",
      "invoice_line_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "invoice_line_item_external_id": "<string>",
      "invoice_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "invoice_payment_external_id": "<string>",
      "customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "customer_external_id": "<string>"
    }
  ],
  "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoice_external_id": "<string>",
  "invoice_line_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoice_line_item_external_id": "<string>",
  "invoice_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "invoice_payment_external_id": "<string>",
  "customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "customer_external_id": "<string>"
}'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "external_id": "31415926535",
  "refunded_amount": 123,
  "status": "PAID",
  "completed_at": "2023-11-07T05:31:56Z",
  "payments": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "external_id": "31415926535",
      "refunded_amount": 123,
      "fee": 123,
      "completed_at": "2023-11-07T05:31:56Z",
      "method": "CREDIT_CARD",
      "processor": "STRIPE"
    }
  ],
  "allocations": [
    {
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "invoice_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "amount": 123,
      "account_identifier": {
        "type": "AccountId",
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      },
      "invoice_external_id": "<string>",
      "invoice_line_item_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "invoice_line_item_external_id": "<string>",
      "invoice_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "invoice_payment_external_id": "<string>",
      "customer": {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "external_id": "31415926535",
        "individual_name": "<string>",
        "company_name": "<string>",
        "email": "<string>",
        "mobile_phone": "<string>",
        "office_phone": "<string>",
        "address_string": "<string>",
        "notes": "<string>",
        "status": "ACTIVE"
      }
    }
  ]
}

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 create a refund for.

Body

application/json
external_id
string

An external identifier for the refund transaction.

refunded_amount
integer

The amount of the refund in cents. This value must be positive.

completed_at
string

The time the refund was completed.

payments
object[]

Refund payments that have been made towards the balance of the refund. For a refund that is owed but not yet paid, this will be an empty list. If null, a refund payment will implicitly be created from the fields below.

refund_processing_fee
integer | null

Only used in order to create a refund payment if the payments field is null. The fee associated with the implicit refund payment in cents. This value must be positive.

method
enum<string>

Only used in order to create a refund payment if the payments field is null. The method used to refund the payment.

Available options:
CASH,
CHECK,
CREDIT_CARD,
ACH,
CREDIT_BALANCE,
OTHER
processor
string | null

Only used in order to create a refund payment if the payments field is null. The payment processor used to refund the payment.

refunded_payment_fees
object[]

Only used in order to create a refund payment if the payments field is null. List of fees associated with the payment. These are refunded from the payment processor rather than the business.

allocations
object[]

The targets of the refund. Each can refer to an Invoice, Invoice Line Item, Invoice Payment, or Customer. If null, a refund allocation will be implicitly created from the fields below.

invoice_id
string | null

Only used in order to create a refund allocation if the allocations field is null. The ID of the invoice to refund.

invoice_external_id
string | null

Only used in order to create a refund allocation if the allocations field is null. The external ID of the invoice to refund.

invoice_line_item_id
string | null

Only used in order to create a refund allocation if the allocations field is null. The ID of the invoice line item to refund.

invoice_line_item_external_id
string | null

Only used in order to create a refund allocation if the allocations field is null. The external ID of the invoice line item to refund.

invoice_payment_id
string | null

Only used in order to create a refund allocation if the allocations field is null. The ID of the invoice payment to refund.

invoice_payment_external_id
string | null

Only used in order to create a refund allocation if the allocations field is null. The external ID of the invoice payment to refund.

customer_id
string | null

Only used in order to create a refund allocation if the allocations field is null. The ID of the customer to refund.

customer_external_id
string | null

Only used in order to create a refund allocation if the allocations field is null. The external ID of the customer to refund.

Response

200
application/json
Refund has been successfully updated or unchanged.

A refund represents a transaction that returns value to from a business to a customer. A specific payment can be refunded or a general refund can be applied to an invoice.

id
string

Unique identifier for the refund.

external_id
string

Unique ID of the refund in your system for linking purposes. Idempotency key.

Example:

"31415926535"

refunded_amount
integer

Amount refunded to the customer in cents.

status
string

Status of the refund.

Example:

"PAID"

completed_at
string

Time when the refund was completed.

payments
object[]

Payments associated with this refund.

A payment represents a transaction that moves value from a customer to a business. A specific payment can be refunded or a general refund can be applied to an invoice.

allocations
object[]

Allocations associated with this refund.