Refund an Invoice
Scopes: invoice:create
curl --request POST \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 100,
"refund_external_id": "<string>",
"refunded_at": "2023-11-07T05:31:56Z",
"invoices_to_refund": [
{
"amount": 100,
"invoice_id": "inv_WQMDNUHpBThYSNh4AprDBo",
"invoice_external_id": "ext_inv_001",
"invoice_line_id": "inl_WQMDNUHpBThYSNh4AprDBo",
"memo": "Refund for returned item"
}
],
"memo": "Customer returned defective item",
"processor": "John Doe",
"is_return": false,
"tags": {
"Location": "NYC"
}
}
'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/refund"
payload = {
"amount": 100,
"refund_external_id": "<string>",
"refunded_at": "2023-11-07T05:31:56Z",
"invoices_to_refund": [
{
"amount": 100,
"invoice_id": "inv_WQMDNUHpBThYSNh4AprDBo",
"invoice_external_id": "ext_inv_001",
"invoice_line_id": "inl_WQMDNUHpBThYSNh4AprDBo",
"memo": "Refund for returned item"
}
],
"memo": "Customer returned defective item",
"processor": "John Doe",
"is_return": False,
"tags": { "Location": "NYC" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 100,
refund_external_id: '<string>',
refunded_at: '2023-11-07T05:31:56Z',
invoices_to_refund: [
{
amount: 100,
invoice_id: 'inv_WQMDNUHpBThYSNh4AprDBo',
invoice_external_id: 'ext_inv_001',
invoice_line_id: 'inl_WQMDNUHpBThYSNh4AprDBo',
memo: 'Refund for returned item'
}
],
memo: 'Customer returned defective item',
processor: 'John Doe',
is_return: false,
tags: {Location: 'NYC'}
})
};
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/refund', 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://api.sandbox.getasset.com/v0/business/{business_id}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 100,
'refund_external_id' => '<string>',
'refunded_at' => '2023-11-07T05:31:56Z',
'invoices_to_refund' => [
[
'amount' => 100,
'invoice_id' => 'inv_WQMDNUHpBThYSNh4AprDBo',
'invoice_external_id' => 'ext_inv_001',
'invoice_line_id' => 'inl_WQMDNUHpBThYSNh4AprDBo',
'memo' => 'Refund for returned item'
]
],
'memo' => 'Customer returned defective item',
'processor' => 'John Doe',
'is_return' => false,
'tags' => [
'Location' => 'NYC'
]
]),
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://api.sandbox.getasset.com/v0/business/{business_id}/refund"
payload := strings.NewReader("{\n \"amount\": 100,\n \"refund_external_id\": \"<string>\",\n \"refunded_at\": \"2023-11-07T05:31:56Z\",\n \"invoices_to_refund\": [\n {\n \"amount\": 100,\n \"invoice_id\": \"inv_WQMDNUHpBThYSNh4AprDBo\",\n \"invoice_external_id\": \"ext_inv_001\",\n \"invoice_line_id\": \"inl_WQMDNUHpBThYSNh4AprDBo\",\n \"memo\": \"Refund for returned item\"\n }\n ],\n \"memo\": \"Customer returned defective item\",\n \"processor\": \"John Doe\",\n \"is_return\": false,\n \"tags\": {\n \"Location\": \"NYC\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sandbox.getasset.com/v0/business/{business_id}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 100,\n \"refund_external_id\": \"<string>\",\n \"refunded_at\": \"2023-11-07T05:31:56Z\",\n \"invoices_to_refund\": [\n {\n \"amount\": 100,\n \"invoice_id\": \"inv_WQMDNUHpBThYSNh4AprDBo\",\n \"invoice_external_id\": \"ext_inv_001\",\n \"invoice_line_id\": \"inl_WQMDNUHpBThYSNh4AprDBo\",\n \"memo\": \"Refund for returned item\"\n }\n ],\n \"memo\": \"Customer returned defective item\",\n \"processor\": \"John Doe\",\n \"is_return\": false,\n \"tags\": {\n \"Location\": \"NYC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/business/{business_id}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 100,\n \"refund_external_id\": \"<string>\",\n \"refunded_at\": \"2023-11-07T05:31:56Z\",\n \"invoices_to_refund\": [\n {\n \"amount\": 100,\n \"invoice_id\": \"inv_WQMDNUHpBThYSNh4AprDBo\",\n \"invoice_external_id\": \"ext_inv_001\",\n \"invoice_line_id\": \"inl_WQMDNUHpBThYSNh4AprDBo\",\n \"memo\": \"Refund for returned item\"\n }\n ],\n \"memo\": \"Customer returned defective item\",\n \"processor\": \"John Doe\",\n \"is_return\": false,\n \"tags\": {\n \"Location\": \"NYC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"business_id": "<string>",
"external_id": "<string>",
"amount": 123,
"refunded_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"amount_paid": 0,
"memo": "<string>",
"processor": "<string>",
"is_return": false,
"status": "pending",
"payments": [
{
"amount": 123,
"id": "<string>",
"transaction_id": "<string>"
}
],
"refund_invoices": [
{
"amount": 123,
"id": "<string>",
"invoice_id": "<string>",
"invoice_line_id": "inl_WQMDNUHpBThYSNh4AprDBo",
"external_id": "<string>",
"memo": "<string>"
}
],
"tags": {
"Job": [
{
"amount": "60.00",
"value": "Maple Street Remodel"
},
{
"amount": "40.00",
"value": "Downtown Office Rewire"
}
]
}
}
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Headers
Optional external entity identifier that performed the action
Path Parameters
The id of the business
"biz_GA6EG2qFxA97NZHtxeLPUy"
Body
The amount to refund.
x > 0100
The external ID of the refund.
255"ref_ext_001"
The date and time of the refund.
"2025-01-15T14:30:00Z"
The method of the refund.
cash, check, credit_card, ach, credit_balance, other "cash"
"check"
"credit_card"
"ach"
"credit_balance"
"other"
The invoices to refund.
1 - 100 elementsShow child attributes
Show child attributes
The memo for the refund.
255"Customer returned defective item"
The name of the person who processed the refund.
255"John Doe"
Whether the refund is for a return.
Inline tag input. Each field maps to either a single value (string, e.g. 'NYC') or a list of {value, amount} objects to allocate the refund across multiple values. The tag field must already exist; values are created automatically if missing. Per-field sum of amounts must not exceed the refund amount.
Show child attributes
Show child attributes
{ "Location": "NYC" }
Response
Successful Response
Show child attributes
Show child attributes
curl --request POST \
--url https://api.sandbox.getasset.com/v0/business/{business_id}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 100,
"refund_external_id": "<string>",
"refunded_at": "2023-11-07T05:31:56Z",
"invoices_to_refund": [
{
"amount": 100,
"invoice_id": "inv_WQMDNUHpBThYSNh4AprDBo",
"invoice_external_id": "ext_inv_001",
"invoice_line_id": "inl_WQMDNUHpBThYSNh4AprDBo",
"memo": "Refund for returned item"
}
],
"memo": "Customer returned defective item",
"processor": "John Doe",
"is_return": false,
"tags": {
"Location": "NYC"
}
}
'import requests
url = "https://api.sandbox.getasset.com/v0/business/{business_id}/refund"
payload = {
"amount": 100,
"refund_external_id": "<string>",
"refunded_at": "2023-11-07T05:31:56Z",
"invoices_to_refund": [
{
"amount": 100,
"invoice_id": "inv_WQMDNUHpBThYSNh4AprDBo",
"invoice_external_id": "ext_inv_001",
"invoice_line_id": "inl_WQMDNUHpBThYSNh4AprDBo",
"memo": "Refund for returned item"
}
],
"memo": "Customer returned defective item",
"processor": "John Doe",
"is_return": False,
"tags": { "Location": "NYC" }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 100,
refund_external_id: '<string>',
refunded_at: '2023-11-07T05:31:56Z',
invoices_to_refund: [
{
amount: 100,
invoice_id: 'inv_WQMDNUHpBThYSNh4AprDBo',
invoice_external_id: 'ext_inv_001',
invoice_line_id: 'inl_WQMDNUHpBThYSNh4AprDBo',
memo: 'Refund for returned item'
}
],
memo: 'Customer returned defective item',
processor: 'John Doe',
is_return: false,
tags: {Location: 'NYC'}
})
};
fetch('https://api.sandbox.getasset.com/v0/business/{business_id}/refund', 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://api.sandbox.getasset.com/v0/business/{business_id}/refund",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'amount' => 100,
'refund_external_id' => '<string>',
'refunded_at' => '2023-11-07T05:31:56Z',
'invoices_to_refund' => [
[
'amount' => 100,
'invoice_id' => 'inv_WQMDNUHpBThYSNh4AprDBo',
'invoice_external_id' => 'ext_inv_001',
'invoice_line_id' => 'inl_WQMDNUHpBThYSNh4AprDBo',
'memo' => 'Refund for returned item'
]
],
'memo' => 'Customer returned defective item',
'processor' => 'John Doe',
'is_return' => false,
'tags' => [
'Location' => 'NYC'
]
]),
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://api.sandbox.getasset.com/v0/business/{business_id}/refund"
payload := strings.NewReader("{\n \"amount\": 100,\n \"refund_external_id\": \"<string>\",\n \"refunded_at\": \"2023-11-07T05:31:56Z\",\n \"invoices_to_refund\": [\n {\n \"amount\": 100,\n \"invoice_id\": \"inv_WQMDNUHpBThYSNh4AprDBo\",\n \"invoice_external_id\": \"ext_inv_001\",\n \"invoice_line_id\": \"inl_WQMDNUHpBThYSNh4AprDBo\",\n \"memo\": \"Refund for returned item\"\n }\n ],\n \"memo\": \"Customer returned defective item\",\n \"processor\": \"John Doe\",\n \"is_return\": false,\n \"tags\": {\n \"Location\": \"NYC\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.sandbox.getasset.com/v0/business/{business_id}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 100,\n \"refund_external_id\": \"<string>\",\n \"refunded_at\": \"2023-11-07T05:31:56Z\",\n \"invoices_to_refund\": [\n {\n \"amount\": 100,\n \"invoice_id\": \"inv_WQMDNUHpBThYSNh4AprDBo\",\n \"invoice_external_id\": \"ext_inv_001\",\n \"invoice_line_id\": \"inl_WQMDNUHpBThYSNh4AprDBo\",\n \"memo\": \"Refund for returned item\"\n }\n ],\n \"memo\": \"Customer returned defective item\",\n \"processor\": \"John Doe\",\n \"is_return\": false,\n \"tags\": {\n \"Location\": \"NYC\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sandbox.getasset.com/v0/business/{business_id}/refund")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 100,\n \"refund_external_id\": \"<string>\",\n \"refunded_at\": \"2023-11-07T05:31:56Z\",\n \"invoices_to_refund\": [\n {\n \"amount\": 100,\n \"invoice_id\": \"inv_WQMDNUHpBThYSNh4AprDBo\",\n \"invoice_external_id\": \"ext_inv_001\",\n \"invoice_line_id\": \"inl_WQMDNUHpBThYSNh4AprDBo\",\n \"memo\": \"Refund for returned item\"\n }\n ],\n \"memo\": \"Customer returned defective item\",\n \"processor\": \"John Doe\",\n \"is_return\": false,\n \"tags\": {\n \"Location\": \"NYC\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"business_id": "<string>",
"external_id": "<string>",
"amount": 123,
"refunded_at": "2023-11-07T05:31:56Z",
"id": "<string>",
"amount_paid": 0,
"memo": "<string>",
"processor": "<string>",
"is_return": false,
"status": "pending",
"payments": [
{
"amount": 123,
"id": "<string>",
"transaction_id": "<string>"
}
],
"refund_invoices": [
{
"amount": 123,
"id": "<string>",
"invoice_id": "<string>",
"invoice_line_id": "inl_WQMDNUHpBThYSNh4AprDBo",
"external_id": "<string>",
"memo": "<string>"
}
],
"tags": {
"Job": [
{
"amount": "60.00",
"value": "Maple Street Remodel"
},
{
"amount": "40.00",
"value": "Downtown Office Rewire"
}
]
}
}
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}{
"error": "<string>",
"data": "<unknown>"
}