curl --request POST \
--url https://api.bachs.io/v1/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"charge_id": "ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f",
"reference": "RF-20260713-0042",
"amount": "29.00",
"fee_bearer": "org",
"reason": "Customer requested cancellation",
"idempotency_key": "RF-20260713-0042"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
charge_id: 'ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f',
reference: 'RF-20260713-0042',
amount: '29.00',
fee_bearer: 'org',
reason: 'Customer requested cancellation',
idempotency_key: 'RF-20260713-0042'
})
};
fetch('https://api.bachs.io/v1/refunds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.bachs.io/v1/refunds"
payload = {
"charge_id": "ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f",
"reference": "RF-20260713-0042",
"amount": "29.00",
"fee_bearer": "org",
"reason": "Customer requested cancellation",
"idempotency_key": "RF-20260713-0042"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bachs.io/v1/refunds"
payload := strings.NewReader("{\n \"charge_id\": \"ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f\",\n \"reference\": \"RF-20260713-0042\",\n \"amount\": \"29.00\",\n \"fee_bearer\": \"org\",\n \"reason\": \"Customer requested cancellation\",\n \"idempotency_key\": \"RF-20260713-0042\"\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))
}{
"refund_id": "b7f2c41a-9d38-4e6b-8c15-2a7d0e934f61",
"charge_id": "ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f",
"reference": "RF-20260713-0042",
"status": "processing",
"requested_amount": "29.00",
"refunded_amount": null,
"refund_fee_amount": "0.00",
"fee_bearer": "org",
"reason": "Customer requested cancellation",
"created_at": "2026-07-13T14:20:00.000Z",
"updated_at": "2026-07-13T14:20:00.000Z",
"completed_at": null
}{
"detail": "Invalid request parameters",
"error_code": "VALIDATION_ERROR",
"errors": [
{
"field": "amount",
"message": "Amount must be a positive decimal string",
"type": "value_error"
}
]
}{
"detail": "Invalid API key",
"error_code": "UNAUTHORIZED"
}{
"detail": "API key does not have permission for this operation",
"error_code": "FORBIDDEN"
}{
"detail": "Resource not found",
"error_code": "NOT_FOUND"
}{
"detail": "Duplicate request detected",
"error_code": "CONFLICT"
}{
"detail": "Rate limit exceeded. Please retry after a few seconds.",
"error_code": "TOO_MANY_REQUESTS"
}{
"detail": "An unexpected error occurred. Please try again later.",
"error_code": "INTERNAL_SERVER_ERROR"
}Create a refund
Create a refund for a completed payment. Only one refund can be created per charge.
curl --request POST \
--url https://api.bachs.io/v1/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"charge_id": "ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f",
"reference": "RF-20260713-0042",
"amount": "29.00",
"fee_bearer": "org",
"reason": "Customer requested cancellation",
"idempotency_key": "RF-20260713-0042"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
charge_id: 'ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f',
reference: 'RF-20260713-0042',
amount: '29.00',
fee_bearer: 'org',
reason: 'Customer requested cancellation',
idempotency_key: 'RF-20260713-0042'
})
};
fetch('https://api.bachs.io/v1/refunds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.bachs.io/v1/refunds"
payload = {
"charge_id": "ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f",
"reference": "RF-20260713-0042",
"amount": "29.00",
"fee_bearer": "org",
"reason": "Customer requested cancellation",
"idempotency_key": "RF-20260713-0042"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.bachs.io/v1/refunds"
payload := strings.NewReader("{\n \"charge_id\": \"ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f\",\n \"reference\": \"RF-20260713-0042\",\n \"amount\": \"29.00\",\n \"fee_bearer\": \"org\",\n \"reason\": \"Customer requested cancellation\",\n \"idempotency_key\": \"RF-20260713-0042\"\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))
}{
"refund_id": "b7f2c41a-9d38-4e6b-8c15-2a7d0e934f61",
"charge_id": "ch_9f4c1d2e7b6a4f8e9c0d1a2b3c4d5e6f",
"reference": "RF-20260713-0042",
"status": "processing",
"requested_amount": "29.00",
"refunded_amount": null,
"refund_fee_amount": "0.00",
"fee_bearer": "org",
"reason": "Customer requested cancellation",
"created_at": "2026-07-13T14:20:00.000Z",
"updated_at": "2026-07-13T14:20:00.000Z",
"completed_at": null
}{
"detail": "Invalid request parameters",
"error_code": "VALIDATION_ERROR",
"errors": [
{
"field": "amount",
"message": "Amount must be a positive decimal string",
"type": "value_error"
}
]
}{
"detail": "Invalid API key",
"error_code": "UNAUTHORIZED"
}{
"detail": "API key does not have permission for this operation",
"error_code": "FORBIDDEN"
}{
"detail": "Resource not found",
"error_code": "NOT_FOUND"
}{
"detail": "Duplicate request detected",
"error_code": "CONFLICT"
}{
"detail": "Rate limit exceeded. Please retry after a few seconds.",
"error_code": "TOO_MANY_REQUESTS"
}{
"detail": "An unexpected error occurred. Please try again later.",
"error_code": "INTERNAL_SERVER_ERROR"
}Authorizations
Bearer token authentication. Pass your API key as Authorization: Bearer sk_.... See Authentication for keys, scopes, and sandbox vs production.
Body
Who absorbs the refund fee. org: the fee is charged to your balance on top of the amount returned. customer: the fee is taken out of what the customer receives. Defaults to the fee handling set on your account. Case is ignored.
org, customer "org"
Response
Success - Refund created
Where the refund has reached. processing: the return has been accepted and your balance is already reserved, but the outcome is not yet known. success: the funds have reached the customer; this is final and cannot be reversed. failed: the return did not go through and the reserved balance has been released. This is final for this refund, but it moved no money, so the payment becomes refundable again and you can create a new refund for it.
processing, success, failed "processing"

