cURL
curl --request POST \
--url https://api.numeralhq.com/tax/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"transaction_id": "tr_123456789",
"type": "partial",
"refund_processed_at": 1714787673,
"line_items": [
{
"reference_product_id": "p-1233543",
"reference_line_item_id": "line_123456789",
"sales_amount_refunded": -200,
"quantity": 2,
"tax_amount_refunded": -14
}
]
}
'import requests
url = "https://api.numeralhq.com/tax/refunds"
payload = {
"transaction_id": "tr_123456789",
"type": "partial",
"refund_processed_at": 1714787673,
"line_items": [
{
"reference_product_id": "p-1233543",
"reference_line_item_id": "line_123456789",
"sales_amount_refunded": -200,
"quantity": 2,
"tax_amount_refunded": -14
}
]
}
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({
transaction_id: 'tr_123456789',
type: 'partial',
refund_processed_at: 1714787673,
line_items: [
{
reference_product_id: 'p-1233543',
reference_line_item_id: 'line_123456789',
sales_amount_refunded: -200,
quantity: 2,
tax_amount_refunded: -14
}
]
})
};
fetch('https://api.numeralhq.com/tax/refunds', 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.numeralhq.com/tax/refunds",
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([
'transaction_id' => 'tr_123456789',
'type' => 'partial',
'refund_processed_at' => 1714787673,
'line_items' => [
[
'reference_product_id' => 'p-1233543',
'reference_line_item_id' => 'line_123456789',
'sales_amount_refunded' => -200,
'quantity' => 2,
'tax_amount_refunded' => -14
]
]
]),
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.numeralhq.com/tax/refunds"
payload := strings.NewReader("{\n \"transaction_id\": \"tr_123456789\",\n \"type\": \"partial\",\n \"refund_processed_at\": 1714787673,\n \"line_items\": [\n {\n \"reference_product_id\": \"p-1233543\",\n \"reference_line_item_id\": \"line_123456789\",\n \"sales_amount_refunded\": -200,\n \"quantity\": 2,\n \"tax_amount_refunded\": -14\n }\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.numeralhq.com/tax/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"transaction_id\": \"tr_123456789\",\n \"type\": \"partial\",\n \"refund_processed_at\": 1714787673,\n \"line_items\": [\n {\n \"reference_product_id\": \"p-1233543\",\n \"reference_line_item_id\": \"line_123456789\",\n \"sales_amount_refunded\": -200,\n \"quantity\": 2,\n \"tax_amount_refunded\": -14\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.numeralhq.com/tax/refunds")
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 \"transaction_id\": \"tr_123456789\",\n \"type\": \"partial\",\n \"refund_processed_at\": 1714787673,\n \"line_items\": [\n {\n \"reference_product_id\": \"p-1233543\",\n \"reference_line_item_id\": \"line_123456789\",\n \"sales_amount_refunded\": -200,\n \"quantity\": 2,\n \"tax_amount_refunded\": -14\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "ref_tr_123456789",
"object": "tax.refund",
"refund_type": "partial",
"testmode": "false",
"refund_processed_at": 1714787673,
"line_items": [
{
"product": {
"reference_product_name": "Widget",
"reference_line_item_id": "line_987654321",
"reference_product_id": "p-1233543",
"product_tax_code": "GENERAL_MERCHANDISE"
},
"tax_jurisdictions": [
{
"tax_rate": 0.07,
"tax_due_decimal": 700,
"rate_type": "GENERAL STATE SALES TAX",
"fee_amount": 0,
"tax_authority_name": "Tennessee",
"tax_authority_type": "",
"tax_type": "SALES"
}
],
"quantity": 2,
"tax_amount": -14,
"amount_excluding_tax": -200,
"amount_including_tax": -214
}
]
}{
"error": {
"error_code": "missing_field",
"error_message": "Field is required",
"error_meta": {
"field": "path.to.fieldname",
"expected": "string",
"received": "undefined"
}
}
}{
"error": {
"error_code": "transaction_not_found",
"error_message": "Unable to find transaction with ID: {transaction_id}."
}
}Create Refunds
Add a refund to a transaction
POST
/
tax
/
refunds
cURL
curl --request POST \
--url https://api.numeralhq.com/tax/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"transaction_id": "tr_123456789",
"type": "partial",
"refund_processed_at": 1714787673,
"line_items": [
{
"reference_product_id": "p-1233543",
"reference_line_item_id": "line_123456789",
"sales_amount_refunded": -200,
"quantity": 2,
"tax_amount_refunded": -14
}
]
}
'import requests
url = "https://api.numeralhq.com/tax/refunds"
payload = {
"transaction_id": "tr_123456789",
"type": "partial",
"refund_processed_at": 1714787673,
"line_items": [
{
"reference_product_id": "p-1233543",
"reference_line_item_id": "line_123456789",
"sales_amount_refunded": -200,
"quantity": 2,
"tax_amount_refunded": -14
}
]
}
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({
transaction_id: 'tr_123456789',
type: 'partial',
refund_processed_at: 1714787673,
line_items: [
{
reference_product_id: 'p-1233543',
reference_line_item_id: 'line_123456789',
sales_amount_refunded: -200,
quantity: 2,
tax_amount_refunded: -14
}
]
})
};
fetch('https://api.numeralhq.com/tax/refunds', 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.numeralhq.com/tax/refunds",
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([
'transaction_id' => 'tr_123456789',
'type' => 'partial',
'refund_processed_at' => 1714787673,
'line_items' => [
[
'reference_product_id' => 'p-1233543',
'reference_line_item_id' => 'line_123456789',
'sales_amount_refunded' => -200,
'quantity' => 2,
'tax_amount_refunded' => -14
]
]
]),
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.numeralhq.com/tax/refunds"
payload := strings.NewReader("{\n \"transaction_id\": \"tr_123456789\",\n \"type\": \"partial\",\n \"refund_processed_at\": 1714787673,\n \"line_items\": [\n {\n \"reference_product_id\": \"p-1233543\",\n \"reference_line_item_id\": \"line_123456789\",\n \"sales_amount_refunded\": -200,\n \"quantity\": 2,\n \"tax_amount_refunded\": -14\n }\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.numeralhq.com/tax/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"transaction_id\": \"tr_123456789\",\n \"type\": \"partial\",\n \"refund_processed_at\": 1714787673,\n \"line_items\": [\n {\n \"reference_product_id\": \"p-1233543\",\n \"reference_line_item_id\": \"line_123456789\",\n \"sales_amount_refunded\": -200,\n \"quantity\": 2,\n \"tax_amount_refunded\": -14\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.numeralhq.com/tax/refunds")
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 \"transaction_id\": \"tr_123456789\",\n \"type\": \"partial\",\n \"refund_processed_at\": 1714787673,\n \"line_items\": [\n {\n \"reference_product_id\": \"p-1233543\",\n \"reference_line_item_id\": \"line_123456789\",\n \"sales_amount_refunded\": -200,\n \"quantity\": 2,\n \"tax_amount_refunded\": -14\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "ref_tr_123456789",
"object": "tax.refund",
"refund_type": "partial",
"testmode": "false",
"refund_processed_at": 1714787673,
"line_items": [
{
"product": {
"reference_product_name": "Widget",
"reference_line_item_id": "line_987654321",
"reference_product_id": "p-1233543",
"product_tax_code": "GENERAL_MERCHANDISE"
},
"tax_jurisdictions": [
{
"tax_rate": 0.07,
"tax_due_decimal": 700,
"rate_type": "GENERAL STATE SALES TAX",
"fee_amount": 0,
"tax_authority_name": "Tennessee",
"tax_authority_type": "",
"tax_type": "SALES"
}
],
"quantity": 2,
"tax_amount": -14,
"amount_excluding_tax": -200,
"amount_including_tax": -214
}
]
}{
"error": {
"error_code": "missing_field",
"error_message": "Field is required",
"error_meta": {
"field": "path.to.fieldname",
"expected": "string",
"received": "undefined"
}
}
}{
"error": {
"error_code": "transaction_not_found",
"error_message": "Unable to find transaction with ID: {transaction_id}."
}
}