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
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}."
}
}Refund Endpoint (2024-09-01)
Add a refund to a previously recorded transaction.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The ID of the transaction to refund. This is the transaction_id returned from the /transactions creation response.
"tr_123456789"
This will be either 'full' or 'partial'. If type='partial', you must also provide the line item(s) you wish to apply refunds against.
"partial"
Unix timestamp in seconds representing the date and time the refund was made. If not provided, the current date and time will be used.
1714787673
If the refund is type=full, line items aren't necessary. If the refund is type=partial, you must provide the line item(s) you wish to apply refunds against using a reference_product_id.
Show child attributes
Show child attributes
Response
Refund response
The ID of the refund. We recommend you store this value. If you need to reverse this refund, you will be required to reference this ID.
"ref_tr_123456789"
The type of object: tax.refund.
"tax.refund"
This will be either 'full' or 'partial'.
"partial"
True if using a production API key. False if using a test API key.
"false"
Unix timestamp in seconds representing the date and time the refund was made. If not provided, the time the refund was created will be used.
1714787673
Show child attributes
Show child attributes