Create a refund
curl --request POST \
--url https://developersandbox-api.flutterwave.com/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 12.34,
"charge_id": "<string>",
"reason": "requested_by_customer",
"meta": {}
}
'import requests
url = "https://developersandbox-api.flutterwave.com/refunds"
payload = {
"amount": 12.34,
"charge_id": "<string>",
"reason": "requested_by_customer",
"meta": {}
}
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({
amount: 12.34,
charge_id: '<string>',
reason: 'requested_by_customer',
meta: {}
})
};
fetch('https://developersandbox-api.flutterwave.com/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://developersandbox-api.flutterwave.com/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([
'amount' => 12.34,
'charge_id' => '<string>',
'reason' => 'requested_by_customer',
'meta' => [
]
]),
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://developersandbox-api.flutterwave.com/refunds"
payload := strings.NewReader("{\n \"amount\": 12.34,\n \"charge_id\": \"<string>\",\n \"reason\": \"requested_by_customer\",\n \"meta\": {}\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://developersandbox-api.flutterwave.com/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 12.34,\n \"charge_id\": \"<string>\",\n \"reason\": \"requested_by_customer\",\n \"meta\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developersandbox-api.flutterwave.com/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 \"amount\": 12.34,\n \"charge_id\": \"<string>\",\n \"reason\": \"requested_by_customer\",\n \"meta\": {}\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"id": "<string>",
"amount_refunded": 12.34,
"meta": {},
"reason": "requested_by_customer",
"status": "new",
"charge_id": "chg_VnUihmASmF",
"created_datetime": "<string>"
}
}{
"status": "failed",
"error": {
"type": "REQUEST_NOT_VALID",
"code": "10400",
"message": "Request is not valid",
"validation_errors": [
{
"field_name": "amount",
"message": "must not be null"
}
]
}
}{
"status": "failed",
"message": "UNAUTHORIZED",
"error": {
"type": "UNAUTHORIZED",
"code": "10401",
"message": "unauthorized"
}
}{
"status": "failed",
"message": "<string>",
"error": {
"type": "FORBIDDEN",
"code": "10403",
"message": "Forbidden"
}
}{
"status": "failed",
"message": "<string>",
"error": {
"type": "RESOURCE_CONFLICT",
"code": "10409",
"message": "Resource conflict"
}
}Refunds
Create a refund
Create a refund
POST
/
refunds
Create a refund
curl --request POST \
--url https://developersandbox-api.flutterwave.com/refunds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 12.34,
"charge_id": "<string>",
"reason": "requested_by_customer",
"meta": {}
}
'import requests
url = "https://developersandbox-api.flutterwave.com/refunds"
payload = {
"amount": 12.34,
"charge_id": "<string>",
"reason": "requested_by_customer",
"meta": {}
}
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({
amount: 12.34,
charge_id: '<string>',
reason: 'requested_by_customer',
meta: {}
})
};
fetch('https://developersandbox-api.flutterwave.com/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://developersandbox-api.flutterwave.com/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([
'amount' => 12.34,
'charge_id' => '<string>',
'reason' => 'requested_by_customer',
'meta' => [
]
]),
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://developersandbox-api.flutterwave.com/refunds"
payload := strings.NewReader("{\n \"amount\": 12.34,\n \"charge_id\": \"<string>\",\n \"reason\": \"requested_by_customer\",\n \"meta\": {}\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://developersandbox-api.flutterwave.com/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 12.34,\n \"charge_id\": \"<string>\",\n \"reason\": \"requested_by_customer\",\n \"meta\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developersandbox-api.flutterwave.com/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 \"amount\": 12.34,\n \"charge_id\": \"<string>\",\n \"reason\": \"requested_by_customer\",\n \"meta\": {}\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"data": {
"id": "<string>",
"amount_refunded": 12.34,
"meta": {},
"reason": "requested_by_customer",
"status": "new",
"charge_id": "chg_VnUihmASmF",
"created_datetime": "<string>"
}
}{
"status": "failed",
"error": {
"type": "REQUEST_NOT_VALID",
"code": "10400",
"message": "Request is not valid",
"validation_errors": [
{
"field_name": "amount",
"message": "must not be null"
}
]
}
}{
"status": "failed",
"message": "UNAUTHORIZED",
"error": {
"type": "UNAUTHORIZED",
"code": "10401",
"message": "unauthorized"
}
}{
"status": "failed",
"message": "<string>",
"error": {
"type": "FORBIDDEN",
"code": "10403",
"message": "Forbidden"
}
}{
"status": "failed",
"message": "<string>",
"error": {
"type": "RESOURCE_CONFLICT",
"code": "10409",
"message": "Resource conflict"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
A unique identifier to track this operation. It must be between 12 and 255 characters in length.
Required string length:
12 - 255A unique identifier to prevent duplicate requests. It must be between 12 and 255 characters in length.
Required string length:
12 - 255Body
application/json
A refund of a previously created charge
Amount of the refund
Required range:
x >= 0.01Example:
12.34
ID of the charge to refund
Reason for the refund
Available options:
duplicate, fraudulent, requested_by_customer, expired_uncaptured_charge Example:
"requested_by_customer"
Show child attributes
Show child attributes
Was this page helpful?
⌘I