Create a Refund
curl --request POST \
--url https://api.flutterwave.com/v3/charges/{flw_ref}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "100"
}
'import requests
url = "https://api.flutterwave.com/v3/charges/{flw_ref}/refund"
payload = { "amount": "100" }
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: '100'})
};
fetch('https://api.flutterwave.com/v3/charges/{flw_ref}/refund', 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.flutterwave.com/v3/charges/{flw_ref}/refund",
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' => '100'
]),
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://api.flutterwave.com/v3/charges/{flw_ref}/refund"
payload := strings.NewReader("{\n \"amount\": \"100\"\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://api.flutterwave.com/v3/charges/{flw_ref}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flutterwave.com/v3/charges/{flw_ref}/refund")
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\": \"100\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Charge refunded",
"data": {
"id": 4973363,
"tx_ref": "YOUR_UNIQUE_REFERENCE",
"flw_ref": "FLW-MOCK-PREAUTH-bde14443c3f233d11c5f574acc120399",
"device_fingerprint": "N/A",
"amount": 100,
"charged_amount": 100,
"app_fee": 5.8,
"merchant_fee": 0,
"processor_response": "Approved",
"auth_model": "NOAUTH",
"currency": "NGN",
"ip": "54.75.161.64",
"narration": "FLW-PBF CARD Transaction ",
"status": "successful",
"auth_url": "N/A",
"payment_type": "card",
"plan": null,
"fraud_status": "ok",
"charge_type": "preauth",
"created_at": "2024-03-18T10:18:56.000Z",
"account_id": 20937,
"customer": {
"id": 2373852,
"phone": null,
"fullName": "Anonymous customer",
"customertoken": null,
"email": "developers@flutterwavego.com",
"createdAt": "2024-03-18T10:18:56.000Z",
"updatedAt": "2024-03-18T10:18:56.000Z",
"deletedAt": null,
"AccountId": 20937
},
"card": {
"first_6digits": "537728",
"last_4digits": "7450",
"issuer": "MASTERCARD JSB PROBUSINESSBANK CREDITGOLD",
"country": "RU",
"type": "MASTERCARD",
"expiry": "09/31"
}
}
}{
"status": "error",
"message": "Error: Cannot refund non-existent/unauthorized transaction",
"data": null
}Preauthorization
Create a Refund
Partially or fully initiate a refund on a preauth charge
POST
/
charges
/
{flw_ref}
/
refund
Create a Refund
curl --request POST \
--url https://api.flutterwave.com/v3/charges/{flw_ref}/refund \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "100"
}
'import requests
url = "https://api.flutterwave.com/v3/charges/{flw_ref}/refund"
payload = { "amount": "100" }
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: '100'})
};
fetch('https://api.flutterwave.com/v3/charges/{flw_ref}/refund', 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.flutterwave.com/v3/charges/{flw_ref}/refund",
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' => '100'
]),
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://api.flutterwave.com/v3/charges/{flw_ref}/refund"
payload := strings.NewReader("{\n \"amount\": \"100\"\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://api.flutterwave.com/v3/charges/{flw_ref}/refund")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"100\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flutterwave.com/v3/charges/{flw_ref}/refund")
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\": \"100\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"message": "Charge refunded",
"data": {
"id": 4973363,
"tx_ref": "YOUR_UNIQUE_REFERENCE",
"flw_ref": "FLW-MOCK-PREAUTH-bde14443c3f233d11c5f574acc120399",
"device_fingerprint": "N/A",
"amount": 100,
"charged_amount": 100,
"app_fee": 5.8,
"merchant_fee": 0,
"processor_response": "Approved",
"auth_model": "NOAUTH",
"currency": "NGN",
"ip": "54.75.161.64",
"narration": "FLW-PBF CARD Transaction ",
"status": "successful",
"auth_url": "N/A",
"payment_type": "card",
"plan": null,
"fraud_status": "ok",
"charge_type": "preauth",
"created_at": "2024-03-18T10:18:56.000Z",
"account_id": 20937,
"customer": {
"id": 2373852,
"phone": null,
"fullName": "Anonymous customer",
"customertoken": null,
"email": "developers@flutterwavego.com",
"createdAt": "2024-03-18T10:18:56.000Z",
"updatedAt": "2024-03-18T10:18:56.000Z",
"deletedAt": null,
"AccountId": 20937
},
"card": {
"first_6digits": "537728",
"last_4digits": "7450",
"issuer": "MASTERCARD JSB PROBUSINESSBANK CREDITGOLD",
"country": "RU",
"type": "MASTERCARD",
"expiry": "09/31"
}
}
}{
"status": "error",
"message": "Error: Cannot refund non-existent/unauthorized transaction",
"data": null
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Example:
"FLW-MOCK-PREAUTH-bde14443c3f233d11c5f574acc120399"
Body
application/json
Response
OK
Show child attributes
Show child attributes
Example:
{ "id": 4973363, "tx_ref": "YOUR_UNIQUE_REFERENCE", "flw_ref": "FLW-MOCK-PREAUTH-bde14443c3f233d11c5f574acc120399", "device_fingerprint": "N/A", "amount": 100, "charged_amount": 100, "app_fee": 5.8, "merchant_fee": 0, "processor_response": "Approved", "auth_model": "NOAUTH", "currency": "NGN", "ip": "54.75.161.64", "narration": "FLW-PBF CARD Transaction ", "status": "successful", "auth_url": "N/A", "payment_type": "card", "plan": null, "fraud_status": "ok", "charge_type": "preauth", "created_at": "2024-03-18T10:18:56.000Z", "account_id": 20937, "customer": { "id": 2373852, "phone": null, "fullName": "Anonymous customer", "customertoken": null, "email": "developers@flutterwavego.com", "createdAt": "2024-03-18T10:18:56.000Z", "updatedAt": "2024-03-18T10:18:56.000Z", "deletedAt": null, "AccountId": 20937 }, "card": { "first_6digits": "537728", "last_4digits": "7450", "issuer": "MASTERCARD JSB PROBUSINESSBANK CREDITGOLD", "country": "RU", "type": "MASTERCARD", "expiry": "09/31" } }
Was this page helpful?
⌘I