curl --request PUT \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds/{refundId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"allocations": [
{
"total_amount": 123,
"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>"
}
],
"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>",
"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>"
}
],
"payments": [
{
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"external_id": "31415926535",
"refund_processing_fee": 123,
"processor": "STRIPE",
"payment_clearing_account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"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>"
}
],
"external_id": "<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"
}
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds/{refundId}"
payload = {
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"allocations": [
{
"total_amount": 123,
"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>"
}
],
"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>",
"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>"
}
],
"payments": [
{
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"external_id": "31415926535",
"refund_processing_fee": 123,
"processor": "STRIPE",
"payment_clearing_account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"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>"
}
],
"external_id": "<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"
}
}
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({
refunded_amount: 123,
completed_at: '2023-11-07T05:31:56Z',
allocations: [
{
total_amount: 123,
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>'
}
],
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>',
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>'
}
],
payments: [
{
refunded_amount: 123,
completed_at: '2023-11-07T05:31:56Z',
external_id: '31415926535',
refund_processing_fee: 123,
processor: 'STRIPE',
payment_clearing_account_identifier: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
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>'
}
],
external_id: '<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'}
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds/{refundId}', 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/refunds/{refundId}",
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([
'refunded_amount' => 123,
'completed_at' => '2023-11-07T05:31:56Z',
'allocations' => [
[
'total_amount' => 123,
'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>'
]
],
'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>',
'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>'
]
],
'payments' => [
[
'refunded_amount' => 123,
'completed_at' => '2023-11-07T05:31:56Z',
'external_id' => '31415926535',
'refund_processing_fee' => 123,
'processor' => 'STRIPE',
'payment_clearing_account_identifier' => [
'type' => 'AccountId',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'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>'
]
],
'external_id' => '<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'
]
]),
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/refunds/{refundId}"
payload := strings.NewReader("{\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"allocations\": [\n {\n \"total_amount\": 123,\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 \"external_id\": \"<string>\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_external_id\": \"<string>\",\n \"invoice_line_item_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_line_item_external_id\": \"<string>\",\n \"invoice_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_payment_external_id\": \"<string>\",\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer_external_id\": \"<string>\",\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 \"payments\": [\n {\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"external_id\": \"31415926535\",\n \"refund_processing_fee\": 123,\n \"processor\": \"STRIPE\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\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 }\n ],\n \"external_id\": \"<string>\",\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}")
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/refunds/{refundId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"allocations\": [\n {\n \"total_amount\": 123,\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 \"external_id\": \"<string>\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_external_id\": \"<string>\",\n \"invoice_line_item_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_line_item_external_id\": \"<string>\",\n \"invoice_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_payment_external_id\": \"<string>\",\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer_external_id\": \"<string>\",\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 \"payments\": [\n {\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"external_id\": \"31415926535\",\n \"refund_processing_fee\": 123,\n \"processor\": \"STRIPE\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\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 }\n ],\n \"external_id\": \"<string>\",\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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds/{refundId}")
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 \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"allocations\": [\n {\n \"total_amount\": 123,\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 \"external_id\": \"<string>\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_external_id\": \"<string>\",\n \"invoice_line_item_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_line_item_external_id\": \"<string>\",\n \"invoice_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_payment_external_id\": \"<string>\",\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer_external_id\": \"<string>\",\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 \"payments\": [\n {\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"external_id\": \"31415926535\",\n \"refund_processing_fee\": 123,\n \"processor\": \"STRIPE\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\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 }\n ],\n \"external_id\": \"<string>\",\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}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "Customer_Refund",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "31415926535",
"refunded_amount": 123,
"status": "PAID",
"completed_at": "2023-11-07T05:31:56Z",
"is_dedicated": true,
"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": {
"type": "CustomerData",
"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>",
"memo": "<string>",
"status": "ACTIVE",
"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"
}
]
},
"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>"
}
],
"payments": [
{
"type": "Customer_Refund_Payment",
"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",
"payment_clearing_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"
}
},
"refunded_payment_fees": [
{
"account": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"description": "<string>",
"fee_amount": 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>"
}
],
"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": {
"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"
}
},
"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": [
{
"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>"
}
}{
"description": "<string>",
"meta": {}
}{
"description": "<string>",
"meta": {}
}Update refund
Fully replaces an existing refund. All allocations and payments will be replaced with the new values provided. This will reverse any existing ledger entries and create new ones based on the updated refund data.
curl --request PUT \
--url https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds/{refundId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"allocations": [
{
"total_amount": 123,
"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>"
}
],
"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>",
"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>"
}
],
"payments": [
{
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"external_id": "31415926535",
"refund_processing_fee": 123,
"processor": "STRIPE",
"payment_clearing_account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"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>"
}
],
"external_id": "<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"
}
}
'import requests
url = "https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds/{refundId}"
payload = {
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"allocations": [
{
"total_amount": 123,
"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>"
}
],
"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>",
"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>"
}
],
"payments": [
{
"refunded_amount": 123,
"completed_at": "2023-11-07T05:31:56Z",
"external_id": "31415926535",
"refund_processing_fee": 123,
"processor": "STRIPE",
"payment_clearing_account_identifier": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"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>"
}
],
"external_id": "<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"
}
}
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({
refunded_amount: 123,
completed_at: '2023-11-07T05:31:56Z',
allocations: [
{
total_amount: 123,
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>'
}
],
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>',
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>'
}
],
payments: [
{
refunded_amount: 123,
completed_at: '2023-11-07T05:31:56Z',
external_id: '31415926535',
refund_processing_fee: 123,
processor: 'STRIPE',
payment_clearing_account_identifier: {type: 'AccountId', id: '3c90c3cc-0d44-4b50-8888-8dd25736052a'},
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>'
}
],
external_id: '<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'}
})
};
fetch('https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds/{refundId}', 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/refunds/{refundId}",
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([
'refunded_amount' => 123,
'completed_at' => '2023-11-07T05:31:56Z',
'allocations' => [
[
'total_amount' => 123,
'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>'
]
],
'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>',
'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>'
]
],
'payments' => [
[
'refunded_amount' => 123,
'completed_at' => '2023-11-07T05:31:56Z',
'external_id' => '31415926535',
'refund_processing_fee' => 123,
'processor' => 'STRIPE',
'payment_clearing_account_identifier' => [
'type' => 'AccountId',
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'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>'
]
],
'external_id' => '<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'
]
]),
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/refunds/{refundId}"
payload := strings.NewReader("{\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"allocations\": [\n {\n \"total_amount\": 123,\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 \"external_id\": \"<string>\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_external_id\": \"<string>\",\n \"invoice_line_item_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_line_item_external_id\": \"<string>\",\n \"invoice_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_payment_external_id\": \"<string>\",\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer_external_id\": \"<string>\",\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 \"payments\": [\n {\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"external_id\": \"31415926535\",\n \"refund_processing_fee\": 123,\n \"processor\": \"STRIPE\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\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 }\n ],\n \"external_id\": \"<string>\",\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}")
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/refunds/{refundId}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"allocations\": [\n {\n \"total_amount\": 123,\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 \"external_id\": \"<string>\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_external_id\": \"<string>\",\n \"invoice_line_item_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_line_item_external_id\": \"<string>\",\n \"invoice_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_payment_external_id\": \"<string>\",\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer_external_id\": \"<string>\",\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 \"payments\": [\n {\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"external_id\": \"31415926535\",\n \"refund_processing_fee\": 123,\n \"processor\": \"STRIPE\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\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 }\n ],\n \"external_id\": \"<string>\",\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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.layerfi.com/v1/businesses/{businessId}/invoices/refunds/{refundId}")
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 \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"allocations\": [\n {\n \"total_amount\": 123,\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 \"external_id\": \"<string>\",\n \"invoice_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_external_id\": \"<string>\",\n \"invoice_line_item_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_line_item_external_id\": \"<string>\",\n \"invoice_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"invoice_payment_external_id\": \"<string>\",\n \"customer_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customer_external_id\": \"<string>\",\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 \"payments\": [\n {\n \"refunded_amount\": 123,\n \"completed_at\": \"2023-11-07T05:31:56Z\",\n \"external_id\": \"31415926535\",\n \"refund_processing_fee\": 123,\n \"processor\": \"STRIPE\",\n \"payment_clearing_account_identifier\": {\n \"type\": \"AccountId\",\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n },\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 }\n ],\n \"external_id\": \"<string>\",\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}"
response = http.request(request)
puts response.read_body{
"data": {
"type": "Customer_Refund",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "31415926535",
"refunded_amount": 123,
"status": "PAID",
"completed_at": "2023-11-07T05:31:56Z",
"is_dedicated": true,
"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": {
"type": "CustomerData",
"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>",
"memo": "<string>",
"status": "ACTIVE",
"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"
}
]
},
"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>"
}
],
"payments": [
{
"type": "Customer_Refund_Payment",
"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",
"payment_clearing_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"
}
},
"refunded_payment_fees": [
{
"account": {
"type": "AccountId",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
},
"description": "<string>",
"fee_amount": 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>"
}
],
"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": {
"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"
}
},
"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": [
{
"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>"
}
}{
"description": "<string>",
"meta": {}
}{
"description": "<string>",
"meta": {}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Content-Type must be set to application/json.
Path Parameters
The UUID of the business to update the refund for.
The UUID of the refund to update.
Body
Itemized refund creation parameters. Provides full control over refund allocations and payments. The sum of allocation amounts must equal the refunded_amount.
The total amount of the refund in cents. This value must be positive and equal to the sum of all allocation amounts.
The time the refund was completed.
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 child attributes
Show child attributes
The payment methods and amounts used to process the refund.
Show child attributes
Show child attributes
An external identifier for the refund transaction.
Tags to associate with the refund.
Show child attributes
Show child attributes
Memo for any text you would like to associate with the refund (for example, to display to end users).
Arbitrary custom metadata in JSON format with a size limit of 1KB.
{
"custom_field": "value",
"any valid json": "below 1kb",
"nested": { "meaning of life": 42, "array": [] }
}
Any (typically user-visible) identifier you would like to associate with the refund. Can be used to filter when listing refunds.
Optional account identifier to specify the clearing account for inferred refund payments. Only used when the payments field is not provided and the system automatically generates a payment based on the method field.
- Account ID
- Account Stable Name
Show child attributes
Show child attributes
Response
Refund updated successfully.
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.
Show child attributes
Show child attributes