curl --request POST \
--url https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/payments/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_amount_cents": 2,
"allocations": [
{
"amount_cents": 2,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"metadata": "<unknown>"
}
],
"external_id": "<string>",
"refund_type": "overpayment",
"refund_date": "2023-12-25",
"currency": "<string>",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>",
"payment_method": "bank_transfer",
"processor": "bank_transfer",
"payment_reference": "<string>",
"processing_fee_cents": 0
}
'import requests
url = "https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/payments/"
payload = {
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_amount_cents": 2,
"allocations": [
{
"amount_cents": 2,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"metadata": "<unknown>"
}
],
"external_id": "<string>",
"refund_type": "overpayment",
"refund_date": "2023-12-25",
"currency": "<string>",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>",
"payment_method": "bank_transfer",
"processor": "bank_transfer",
"payment_reference": "<string>",
"processing_fee_cents": 0
}
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_amount_cents: 2,
allocations: [
{
amount_cents: 2,
bill_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
bill_payment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
description: '<string>',
metadata: '<unknown>'
}
],
external_id: '<string>',
refund_type: 'overpayment',
refund_date: '2023-12-25',
currency: '<string>',
description: '<string>',
memo: '<string>',
reason: '<string>',
metadata: '<unknown>',
payment_method: 'bank_transfer',
processor: 'bank_transfer',
payment_reference: '<string>',
processing_fee_cents: 0
})
};
fetch('https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/payments/', 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/payments/",
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_amount_cents' => 2,
'allocations' => [
[
'amount_cents' => 2,
'bill_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'bill_payment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'description' => '<string>',
'metadata' => '<unknown>'
]
],
'external_id' => '<string>',
'refund_type' => 'overpayment',
'refund_date' => '2023-12-25',
'currency' => '<string>',
'description' => '<string>',
'memo' => '<string>',
'reason' => '<string>',
'metadata' => '<unknown>',
'payment_method' => 'bank_transfer',
'processor' => 'bank_transfer',
'payment_reference' => '<string>',
'processing_fee_cents' => 0
]),
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/payments/"
payload := strings.NewReader("{\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_amount_cents\": 2,\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 \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"refund_date\": \"2023-12-25\",\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0\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/payments/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_amount_cents\": 2,\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 \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"refund_date\": \"2023-12-25\",\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/payments/")
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_amount_cents\": 2,\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 \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"refund_date\": \"2023-12-25\",\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0\n}"
response = http.request(request)
puts response.read_body{
"refund": {},
"payment": {},
"allocations": [
{}
]
}{
"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 payment with allocations
Create a vendor refund payment with embedded allocations in a single atomic operation.
This endpoint follows the same pattern as invoice payments, where allocations are embedded in the payment creation request rather than being separate API calls.
Key Features:
- Atomic operation - all or nothing
- Comprehensive validation
- Support for multiple allocation types
- Idempotency support via
Idempotency-Keyheader
Allocation Types:
bill: Apply refund to a specific billpayment: Refund a specific bill paymentcredit: Create a credit balance for future use
Idempotency:
Include an Idempotency-Key header to ensure the same request isn’t processed twice.
If the same key is used again, the original response will be returned.
Example Request:
{
"vendor_id": "uuid",
"total_amount_cents": 100000,
"payment_method": "bank_transfer",
"refund_date": "2025-01-15",
"allocations": [
{
"allocation_type": "bill",
"bill_id": "uuid",
"amount_cents": 60000,
"description": "Partial refund for Bill #123"
},
{
"allocation_type": "credit",
"amount_cents": 40000,
"description": "Credit for future purchases"
}
]
}
curl --request POST \
--url https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/payments/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_amount_cents": 2,
"allocations": [
{
"amount_cents": 2,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"metadata": "<unknown>"
}
],
"external_id": "<string>",
"refund_type": "overpayment",
"refund_date": "2023-12-25",
"currency": "<string>",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>",
"payment_method": "bank_transfer",
"processor": "bank_transfer",
"payment_reference": "<string>",
"processing_fee_cents": 0
}
'import requests
url = "https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/payments/"
payload = {
"vendor_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"total_amount_cents": 2,
"allocations": [
{
"amount_cents": 2,
"bill_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"bill_payment_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"metadata": "<unknown>"
}
],
"external_id": "<string>",
"refund_type": "overpayment",
"refund_date": "2023-12-25",
"currency": "<string>",
"description": "<string>",
"memo": "<string>",
"reason": "<string>",
"metadata": "<unknown>",
"payment_method": "bank_transfer",
"processor": "bank_transfer",
"payment_reference": "<string>",
"processing_fee_cents": 0
}
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_amount_cents: 2,
allocations: [
{
amount_cents: 2,
bill_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
bill_payment_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
description: '<string>',
metadata: '<unknown>'
}
],
external_id: '<string>',
refund_type: 'overpayment',
refund_date: '2023-12-25',
currency: '<string>',
description: '<string>',
memo: '<string>',
reason: '<string>',
metadata: '<unknown>',
payment_method: 'bank_transfer',
processor: 'bank_transfer',
payment_reference: '<string>',
processing_fee_cents: 0
})
};
fetch('https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/payments/', 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/payments/",
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_amount_cents' => 2,
'allocations' => [
[
'amount_cents' => 2,
'bill_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'bill_payment_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'description' => '<string>',
'metadata' => '<unknown>'
]
],
'external_id' => '<string>',
'refund_type' => 'overpayment',
'refund_date' => '2023-12-25',
'currency' => '<string>',
'description' => '<string>',
'memo' => '<string>',
'reason' => '<string>',
'metadata' => '<unknown>',
'payment_method' => 'bank_transfer',
'processor' => 'bank_transfer',
'payment_reference' => '<string>',
'processing_fee_cents' => 0
]),
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/payments/"
payload := strings.NewReader("{\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_amount_cents\": 2,\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 \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"refund_date\": \"2023-12-25\",\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0\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/payments/")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"vendor_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"total_amount_cents\": 2,\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 \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"refund_date\": \"2023-12-25\",\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://dev-backend.thredfi.com/v1/platform/businesses/{business_id}/vendor-refunds/payments/")
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_amount_cents\": 2,\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 \"external_id\": \"<string>\",\n \"refund_type\": \"overpayment\",\n \"refund_date\": \"2023-12-25\",\n \"currency\": \"<string>\",\n \"description\": \"<string>\",\n \"memo\": \"<string>\",\n \"reason\": \"<string>\",\n \"metadata\": \"<unknown>\",\n \"payment_method\": \"bank_transfer\",\n \"processor\": \"bank_transfer\",\n \"payment_reference\": \"<string>\",\n \"processing_fee_cents\": 0\n}"
response = http.request(request)
puts response.read_body{
"refund": {},
"payment": {},
"allocations": [
{}
]
}{
"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 refund payments with embedded allocations.
This serializer handles the unified creation of vendor refunds, payments, and allocations in a single atomic operation.
Type of refund
overpayment- Overpaymentbilling_error- Billing Errorgoods_return- Goods Returncredit_balance- Credit Balanceduplicate_payment- Duplicate Paymentother- Other
overpayment, billing_error, goods_return, credit_balance, duplicate_payment, other Payment method used for the refund
bank_transfer- Bank Transferach- ACH Transferwire- Wire Transfercheck- Checkcredit_card- Credit Card Reversalcash- Cashother- Other
bank_transfer, ach, wire, check, credit_card, cash, other Response
Serializer for vendor refund payment create/update responses.
This serializer formats the response data for successful refund payment creation operations. Renamed from VendorRefundPaymentResponseSerializer to avoid naming conflict with vendor_refund_serializers.py.
Was this page helpful?