Refund the unused prepaid balance
curl --request POST \
--url https://api.checkfu.com/v1/billing/credits/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'checkfu-version: <checkfu-version>' \
--header 'idempotency-key: <idempotency-key>' \
--data '
{
"reason": "account_closure"
}
'import requests
url = "https://api.checkfu.com/v1/billing/credits/refunds"
payload = { "reason": "account_closure" }
headers = {
"checkfu-version": "<checkfu-version>",
"idempotency-key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'checkfu-version': '<checkfu-version>',
'idempotency-key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({reason: 'account_closure'})
};
fetch('https://api.checkfu.com/v1/billing/credits/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.checkfu.com/v1/billing/credits/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([
'reason' => 'account_closure'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"checkfu-version: <checkfu-version>",
"idempotency-key: <idempotency-key>"
],
]);
$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.checkfu.com/v1/billing/credits/refunds"
payload := strings.NewReader("{\n \"reason\": \"account_closure\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("checkfu-version", "<checkfu-version>")
req.Header.Add("idempotency-key", "<idempotency-key>")
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.checkfu.com/v1/billing/credits/refunds")
.header("checkfu-version", "<checkfu-version>")
.header("idempotency-key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"account_closure\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.checkfu.com/v1/billing/credits/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["checkfu-version"] = '<checkfu-version>'
request["idempotency-key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"account_closure\"\n}"
response = http.request(request)
puts response.read_body{
"refund_id": "<string>",
"reason": "account_closure",
"amount_minor_units": 0,
"currency": "usd",
"state": "pending",
"created_at": "<string>"
}{
"refund_id": "<string>",
"reason": "account_closure",
"amount_minor_units": 0,
"currency": "usd",
"state": "pending",
"created_at": "<string>"
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-malformed",
"code": "validation.malformed"
},
"type": "error",
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "authentication_error",
"code": "auth.invalid_key",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#auth-invalid-key"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "permission_error",
"code": "auth.disabled_tenancy",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#auth-disabled-tenancy"
},
"request_id": "<string>"
}{
"error": {
"type": "conflict_error",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-conflict",
"code": "validation.conflict"
},
"type": "error",
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "rate_limit_error",
"code": "budget.exceeded",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#budget-exceeded"
},
"request_id": "<string>"
}{
"error": {
"type": "api_error",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#runtime-internal",
"code": "runtime.internal"
},
"type": "error",
"request_id": "<string>"
}{
"error": {
"type": "api_error",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#billing-entitlement-unavailable",
"code": "billing.entitlement_unavailable"
},
"type": "error",
"request_id": "<string>"
}Refund the unused prepaid balance
Asks for the unused prepaid balance back on account closure, rounded down to whole US cents.
POST
/
v1
/
billing
/
credits
/
refunds
Refund the unused prepaid balance
curl --request POST \
--url https://api.checkfu.com/v1/billing/credits/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'checkfu-version: <checkfu-version>' \
--header 'idempotency-key: <idempotency-key>' \
--data '
{
"reason": "account_closure"
}
'import requests
url = "https://api.checkfu.com/v1/billing/credits/refunds"
payload = { "reason": "account_closure" }
headers = {
"checkfu-version": "<checkfu-version>",
"idempotency-key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'checkfu-version': '<checkfu-version>',
'idempotency-key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({reason: 'account_closure'})
};
fetch('https://api.checkfu.com/v1/billing/credits/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.checkfu.com/v1/billing/credits/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([
'reason' => 'account_closure'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"checkfu-version: <checkfu-version>",
"idempotency-key: <idempotency-key>"
],
]);
$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.checkfu.com/v1/billing/credits/refunds"
payload := strings.NewReader("{\n \"reason\": \"account_closure\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("checkfu-version", "<checkfu-version>")
req.Header.Add("idempotency-key", "<idempotency-key>")
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.checkfu.com/v1/billing/credits/refunds")
.header("checkfu-version", "<checkfu-version>")
.header("idempotency-key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"account_closure\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.checkfu.com/v1/billing/credits/refunds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["checkfu-version"] = '<checkfu-version>'
request["idempotency-key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"account_closure\"\n}"
response = http.request(request)
puts response.read_body{
"refund_id": "<string>",
"reason": "account_closure",
"amount_minor_units": 0,
"currency": "usd",
"state": "pending",
"created_at": "<string>"
}{
"refund_id": "<string>",
"reason": "account_closure",
"amount_minor_units": 0,
"currency": "usd",
"state": "pending",
"created_at": "<string>"
}{
"error": {
"type": "invalid_request_error",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-malformed",
"code": "validation.malformed"
},
"type": "error",
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "authentication_error",
"code": "auth.invalid_key",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#auth-invalid-key"
},
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "permission_error",
"code": "auth.disabled_tenancy",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#auth-disabled-tenancy"
},
"request_id": "<string>"
}{
"error": {
"type": "conflict_error",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#validation-conflict",
"code": "validation.conflict"
},
"type": "error",
"request_id": "<string>"
}{
"type": "error",
"error": {
"type": "rate_limit_error",
"code": "budget.exceeded",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#budget-exceeded"
},
"request_id": "<string>"
}{
"error": {
"type": "api_error",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#runtime-internal",
"code": "runtime.internal"
},
"type": "error",
"request_id": "<string>"
}{
"error": {
"type": "api_error",
"message": "<string>",
"more": "https://docs.checkfu.com/reference/errors#billing-entitlement-unavailable",
"code": "billing.entitlement_unavailable"
},
"type": "error",
"request_id": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Available options:
2026-08-31 Required string length:
1 - 255Body
application/json
Why the balance is refunded. Only closure is offered: the unused balance is refunded in whole cents and fenced from spending until the payout completes.
Available options:
account_closure Response
Success
Available options:
account_closure Required range:
-9007199254740991 <= x <= 9007199254740991Available options:
usd Available options:
pending, paid, failed