curl --request POST \
--url https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_refunded_amount_cents": 2,
"external_id": "<string>",
"refund_type": "overpayment",
"reference_number": "<string>",
"currency": "EUR",
"refund_date": "2023-12-25",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>",
"allocations": [
{
"amount_cents": 2,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"metadata": "<unknown>"
}
],
"payments": [
{
"refunded_amount_cents": 2,
"payment_reference": "<string>",
"processing_fee_cents": 0,
"payment_method": "bank_transfer",
"processor": "bank_transfer",
"payment_date": "2023-12-25",
"description": "<string>",
"memo": "<string>",
"metadata": "<unknown>"
}
],
"document": {
"file": "<string>",
"document_type": "vendor_refund",
"upload_source": "<string>",
"metadata": "<unknown>",
"tags": "<unknown>"
}
}
'import requests
url = "https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/"
payload = {
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_refunded_amount_cents": 2,
"external_id": "<string>",
"refund_type": "overpayment",
"reference_number": "<string>",
"currency": "EUR",
"refund_date": "2023-12-25",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>",
"allocations": [
{
"amount_cents": 2,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"metadata": "<unknown>"
}
],
"payments": [
{
"refunded_amount_cents": 2,
"payment_reference": "<string>",
"processing_fee_cents": 0,
"payment_method": "bank_transfer",
"processor": "bank_transfer",
"payment_date": "2023-12-25",
"description": "<string>",
"memo": "<string>",
"metadata": "<unknown>"
}
],
"document": {
"file": "<string>",
"document_type": "vendor_refund",
"upload_source": "<string>",
"metadata": "<unknown>",
"tags": "<unknown>"
}
}
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({
vendor_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
total_refunded_amount_cents: 2,
external_id: '<string>',
refund_type: 'overpayment',
reference_number: '<string>',
currency: 'EUR',
refund_date: '2023-12-25',
description: '<string>',
memo: '<string>',
reason: '<string>',
metadata: '<unknown>',
allocations: [
{
amount_cents: 2,
bill_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
bill_payment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
description: '<string>',
metadata: '<unknown>'
}
],
payments: [
{
refunded_amount_cents: 2,
payment_reference: '<string>',
processing_fee_cents: 0,
payment_method: 'bank_transfer',
processor: 'bank_transfer',
payment_date: '2023-12-25',
description: '<string>',
memo: '<string>',
metadata: '<unknown>'
}
],
document: {
file: '<string>',
document_type: 'vendor_refund',
upload_source: '<string>',
metadata: '<unknown>',
tags: '<unknown>'
}
})
};
fetch('https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-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://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-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([
'vendor_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'total_refunded_amount_cents' => 2,
'external_id' => '<string>',
'refund_type' => 'overpayment',
'reference_number' => '<string>',
'currency' => 'EUR',
'refund_date' => '2023-12-25',
'description' => '<string>',
'memo' => '<string>',
'reason' => '<string>',
'metadata' => '<unknown>',
'allocations' => [
[
'amount_cents' => 2,
'bill_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'bill_payment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'description' => '<string>',
'metadata' => '<unknown>'
]
],
'payments' => [
[
'refunded_amount_cents' => 2,
'payment_reference' => '<string>',
'processing_fee_cents' => 0,
'payment_method' => 'bank_transfer',
'processor' => 'bank_transfer',
'payment_date' => '2023-12-25',
'description' => '<string>',
'memo' => '<string>',
'metadata' => '<unknown>'
]
],
'document' => [
'file' => '<string>',
'document_type' => 'vendor_refund',
'upload_source' => '<string>',
'metadata' => '<unknown>',
'tags' => '<unknown>'
]
]),
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://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/"
payload := strings.NewReader("{\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_refunded_amount_cents\": 2,\n \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"reference_number\": \"<string>\",\n \"currency\": \"EUR\",\n \"refund_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"allocations\": [\n {\n \"amount_cents\": 2,\n \"bill_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bill_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"payments\": [\n {\n \"refunded_amount_cents\": 2,\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0,\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"document\": {\n \"file\": \"<string>\",\n \"document_type\": \"vendor_refund\",\n \"upload_source\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"tags\": \"<unknown>\"\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://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_refunded_amount_cents\": 2,\n \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"reference_number\": \"<string>\",\n \"currency\": \"EUR\",\n \"refund_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"allocations\": [\n {\n \"amount_cents\": 2,\n \"bill_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bill_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"payments\": [\n {\n \"refunded_amount_cents\": 2,\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0,\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"document\": {\n \"file\": \"<string>\",\n \"document_type\": \"vendor_refund\",\n \"upload_source\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"tags\": \"<unknown>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-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 \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_refunded_amount_cents\": 2,\n \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"reference_number\": \"<string>\",\n \"currency\": \"EUR\",\n \"refund_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"allocations\": [\n {\n \"amount_cents\": 2,\n \"bill_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bill_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"payments\": [\n {\n \"refunded_amount_cents\": 2,\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0,\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"document\": {\n \"file\": \"<string>\",\n \"document_type\": \"vendor_refund\",\n \"upload_source\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"tags\": \"<unknown>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_name": "<string>",
"total_refunded_amount": 123,
"allocated_amount": 123,
"unallocated_amount": 123,
"allocations": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_number": "<string>",
"bill_outstanding_balance_cents": 123,
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"target_description": "<string>",
"allocation_type": "bill",
"allocation_date": "2023-11-07T05:31:56Z",
"description": "<string>",
"metadata": "<unknown>"
}
],
"vendor_refund_payments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_refund_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"refunded_amount": 123,
"processing_fee": 123,
"net_amount": 123,
"reconciled_bank_transactions": [
{
"bank_transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bank_transaction_date": "2023-11-07T05:31:56Z",
"bank_transaction_amount_cents": 123,
"bank_transaction_direction": "<string>",
"reconciled_amount_cents": 123,
"reconciliation_link_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reconciled_at": "2023-11-07T05:31:56Z",
"currency": "<string>",
"payment_type": "<string>",
"bank_account_name": "<string>",
"notes": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"payment_reference": "<string>",
"processor_payment_id": "<string>",
"payment_date": "2023-12-25",
"payment_method": "bank_transfer",
"processor": "stripe",
"status": "pending",
"submitted_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z",
"failure_reason": "<string>",
"description": "<string>",
"memo": "<string>",
"metadata": "<unknown>",
"transaction_tags": "<unknown>"
}
],
"document": {
"url": "<string>",
"expires_in": 123,
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"file_name": "<string>",
"file_size": 123,
"mime_type": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"refund_type": "overpayment",
"reference_number": "<string>",
"refund_date": "2023-12-25",
"expected_completion_date": "2023-12-25",
"currency": "EUR",
"status": "pending",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}Create vendor refund
Create a new vendor refund record (parent transaction).
Idempotency: Uses external_id field - duplicate requests with the same
external_id will return HTTP 200 with the existing refund instead of creating
a duplicate.
Required Fields:
vendor_id: UUID of the vendor issuing the refundtotal_refunded_amount_cents: Total amount being refunded in cents (e.g., 10050 for £100.50)currency: ISO 4217 currency code (EUR, GBP, USD)
Optional Fields:
external_id: Your system’s unique identifier (for idempotency)reference_number: External reference numberrefund_type: Type of refund (overpayment, billing_error, goods_return, etc.)refund_date: Date of refund (defaults to today)description: Detailed descriptionmemo: Internal memo/notesreason: Reason for the refundmetadata: Additional structured data (JSON object)allocations: Array of allocations to create with the refundpayments: Array of payments to create with the refunddocument: Optional document upload (multipart fieldfilewith optional document_type, upload_source, metadata, tags)
Common Scenarios:
-
Overpayment refund - Vendor returns excess payment
{ "vendor_id": "uuid", "total_refunded_amount_cents": 15000, "currency": "GBP", "refund_type": "overpayment", "description": "Refund of overpayment" } -
Billing error - Vendor refunds due to billing mistake
{ "vendor_id": "uuid", "total_refunded_amount_cents": 50000, "currency": "GBP", "refund_type": "billing_error", "reference_number": "REF-12345", "allocations": [{ "allocation_type": "bill", "bill_id": "bill-uuid", "amount_cents": 50000 }] } -
Complete refund with payment - Create refund with allocation and payment in one request
{ "vendor_id": "uuid", "total_refunded_amount_cents": 100000, "currency": "GBP", "external_id": "my-refund-123", "allocations": [{ "allocation_type": "bill", "bill_id": "bill-uuid", "amount_cents": 100000 }], "payments": [{ "refunded_amount_cents": 100000, "payment_method": "bank_transfer", "processor": "wise" }] }
Returns:
- HTTP 201: Refund created successfully
- HTTP 200: Existing refund (idempotent - same external_id)
- HTTP 400: Validation error
curl --request POST \
--url https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_refunded_amount_cents": 2,
"external_id": "<string>",
"refund_type": "overpayment",
"reference_number": "<string>",
"currency": "EUR",
"refund_date": "2023-12-25",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>",
"allocations": [
{
"amount_cents": 2,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"metadata": "<unknown>"
}
],
"payments": [
{
"refunded_amount_cents": 2,
"payment_reference": "<string>",
"processing_fee_cents": 0,
"payment_method": "bank_transfer",
"processor": "bank_transfer",
"payment_date": "2023-12-25",
"description": "<string>",
"memo": "<string>",
"metadata": "<unknown>"
}
],
"document": {
"file": "<string>",
"document_type": "vendor_refund",
"upload_source": "<string>",
"metadata": "<unknown>",
"tags": "<unknown>"
}
}
'import requests
url = "https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/"
payload = {
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_refunded_amount_cents": 2,
"external_id": "<string>",
"refund_type": "overpayment",
"reference_number": "<string>",
"currency": "EUR",
"refund_date": "2023-12-25",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>",
"allocations": [
{
"amount_cents": 2,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"metadata": "<unknown>"
}
],
"payments": [
{
"refunded_amount_cents": 2,
"payment_reference": "<string>",
"processing_fee_cents": 0,
"payment_method": "bank_transfer",
"processor": "bank_transfer",
"payment_date": "2023-12-25",
"description": "<string>",
"memo": "<string>",
"metadata": "<unknown>"
}
],
"document": {
"file": "<string>",
"document_type": "vendor_refund",
"upload_source": "<string>",
"metadata": "<unknown>",
"tags": "<unknown>"
}
}
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({
vendor_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
total_refunded_amount_cents: 2,
external_id: '<string>',
refund_type: 'overpayment',
reference_number: '<string>',
currency: 'EUR',
refund_date: '2023-12-25',
description: '<string>',
memo: '<string>',
reason: '<string>',
metadata: '<unknown>',
allocations: [
{
amount_cents: 2,
bill_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
bill_payment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
description: '<string>',
metadata: '<unknown>'
}
],
payments: [
{
refunded_amount_cents: 2,
payment_reference: '<string>',
processing_fee_cents: 0,
payment_method: 'bank_transfer',
processor: 'bank_transfer',
payment_date: '2023-12-25',
description: '<string>',
memo: '<string>',
metadata: '<unknown>'
}
],
document: {
file: '<string>',
document_type: 'vendor_refund',
upload_source: '<string>',
metadata: '<unknown>',
tags: '<unknown>'
}
})
};
fetch('https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-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://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-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([
'vendor_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'total_refunded_amount_cents' => 2,
'external_id' => '<string>',
'refund_type' => 'overpayment',
'reference_number' => '<string>',
'currency' => 'EUR',
'refund_date' => '2023-12-25',
'description' => '<string>',
'memo' => '<string>',
'reason' => '<string>',
'metadata' => '<unknown>',
'allocations' => [
[
'amount_cents' => 2,
'bill_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'bill_payment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'description' => '<string>',
'metadata' => '<unknown>'
]
],
'payments' => [
[
'refunded_amount_cents' => 2,
'payment_reference' => '<string>',
'processing_fee_cents' => 0,
'payment_method' => 'bank_transfer',
'processor' => 'bank_transfer',
'payment_date' => '2023-12-25',
'description' => '<string>',
'memo' => '<string>',
'metadata' => '<unknown>'
]
],
'document' => [
'file' => '<string>',
'document_type' => 'vendor_refund',
'upload_source' => '<string>',
'metadata' => '<unknown>',
'tags' => '<unknown>'
]
]),
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://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/"
payload := strings.NewReader("{\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_refunded_amount_cents\": 2,\n \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"reference_number\": \"<string>\",\n \"currency\": \"EUR\",\n \"refund_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"allocations\": [\n {\n \"amount_cents\": 2,\n \"bill_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bill_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"payments\": [\n {\n \"refunded_amount_cents\": 2,\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0,\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"document\": {\n \"file\": \"<string>\",\n \"document_type\": \"vendor_refund\",\n \"upload_source\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"tags\": \"<unknown>\"\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://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_refunded_amount_cents\": 2,\n \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"reference_number\": \"<string>\",\n \"currency\": \"EUR\",\n \"refund_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"allocations\": [\n {\n \"amount_cents\": 2,\n \"bill_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bill_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"payments\": [\n {\n \"refunded_amount_cents\": 2,\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0,\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"document\": {\n \"file\": \"<string>\",\n \"document_type\": \"vendor_refund\",\n \"upload_source\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"tags\": \"<unknown>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-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 \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_refunded_amount_cents\": 2,\n \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"reference_number\": \"<string>\",\n \"currency\": \"EUR\",\n \"refund_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"allocations\": [\n {\n \"amount_cents\": 2,\n \"bill_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"bill_payment_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"description\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"payments\": [\n {\n \"refunded_amount_cents\": 2,\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0,\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_date\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"metadata\": \"<unknown>\"\n }\n ],\n \"document\": {\n \"file\": \"<string>\",\n \"document_type\": \"vendor_refund\",\n \"upload_source\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"tags\": \"<unknown>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_name": "<string>",
"total_refunded_amount": 123,
"allocated_amount": 123,
"unallocated_amount": 123,
"allocations": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"amount": 123,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_number": "<string>",
"bill_outstanding_balance_cents": 123,
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"target_description": "<string>",
"allocation_type": "bill",
"allocation_date": "2023-11-07T05:31:56Z",
"description": "<string>",
"metadata": "<unknown>"
}
],
"vendor_refund_payments": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendor_refund_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"refunded_amount": 123,
"processing_fee": 123,
"net_amount": 123,
"reconciled_bank_transactions": [
{
"bank_transaction_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bank_transaction_date": "2023-11-07T05:31:56Z",
"bank_transaction_amount_cents": 123,
"bank_transaction_direction": "<string>",
"reconciled_amount_cents": 123,
"reconciliation_link_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"reconciled_at": "2023-11-07T05:31:56Z",
"currency": "<string>",
"payment_type": "<string>",
"bank_account_name": "<string>",
"notes": "<string>"
}
],
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"payment_reference": "<string>",
"processor_payment_id": "<string>",
"payment_date": "2023-12-25",
"payment_method": "bank_transfer",
"processor": "stripe",
"status": "pending",
"submitted_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"failed_at": "2023-11-07T05:31:56Z",
"failure_reason": "<string>",
"description": "<string>",
"memo": "<string>",
"metadata": "<unknown>",
"transaction_tags": "<unknown>"
}
],
"document": {
"url": "<string>",
"expires_in": 123,
"document_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"file_name": "<string>",
"file_size": 123,
"mime_type": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"external_id": "<string>",
"refund_type": "overpayment",
"reference_number": "<string>",
"refund_date": "2023-12-25",
"expected_completion_date": "2023-12-25",
"currency": "EUR",
"status": "pending",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}{
"error_code": "<string>",
"message": "<string>",
"detail": {},
"request_id": "<string>"
}Authorizations
Body
Serializer for creating vendor refunds. Handles validation and conversion of amounts from base units to cents.
Type/reason for the refund
overpayment- overpaymentcredit_balance- credit_balanceduplicate_payment- duplicate_paymentbilling_error- billing_errorgoods_return- goods_returnservice_cancellation- service_cancellationother- other
overpayment, credit_balance, duplicate_payment, billing_error, goods_return, service_cancellation, other Response
Comprehensive serializer for vendor refund responses. Includes all refund details plus related allocations and payments.
Refund type: overpayment, credit_balance, billing_error, goods_return, duplicate_payment, service_cancellation, other
overpayment- Overpayment Refundcredit_balance- Credit Balance Refundduplicate_payment- Duplicate Paymentbilling_error- Billing Errorgoods_return- Goods Returnservice_cancellation- Service Cancellationother- Other
overpayment, credit_balance, duplicate_payment, billing_error, goods_return, service_cancellation, other Refund status: pending, partially_allocated, allocated, completed, cancelled (computed from allocations)
pending- Pendingpartially_allocated- Partially Allocatedallocated- Allocatedcompleted- Completedcancelled- Cancelled
pending, partially_allocated, allocated, completed, cancelled Was this page helpful?