Refunds

This object represents a refund on a transaction.

The Supplier Object

{
"amount": 90,
"status": {
"id": "PENDING_AUTHORISATION"
},
"authorisation_code": "19b6698d-d614-45e0-ae90-6a3ea0662431",
"authorised_at": null,
"organisation": {
"id": "X000",
"name": "Felloh"
},
"completed_at": null,
"transaction": {
"id": "62132923-778d-45e0-a9bd-648913eeafdf",
"amount": 100,
"message": "Transaction succeeded",
"created_at": "2023-08-01T10:19:10.904Z",
"completed_at": "2023-08-01T10:20:17.000Z",
"currency": "GBX",
"provider_reference": "ASFEHYVVAEOSDCJIFUNZJVZURTWTILCSOBGLZMAE.prod01-vm-tx05",
},
"created_at": "2023-09-25T10:14:52.237Z"
}

amountstring

The amount that the refund is for.

status.idstring

The status of the refund, all statuses can be retrieved using the enums endpoint.

authorisation_codestring

A unique code, used to identify a refund.

authorised_atdatetime

The datetime at which the refund was authorised.

organisationobject

The organisation object that the refund is linked to.

completed_atdatetime

The datetime at which the refund was completed.

transactionobject

An object containing a compact transaction object that the refund is linked to.

created_atdatetime

The datetime t which the refund request was created.


Fetch all

POST/agent/refunds

import axios from 'axios';
const response = await axios(
{
method: 'post',
url: 'https://api.felloh.com/agent/refunds',
data: {
organisation: 'X9876',
skip: 10,
take: 20
},
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function searchSuppliers($token, $organization, $skip, $take) {
$url = "https://api.felloh.com/agent/refunds";
$client = new Client();
$response = $client->post($url, [
'json' => [
'organisation' => $organization,
'skip' => $skip,
'take' => $take,
],
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => "Bearer $token",
],
]);
return $response->getBody();
}
$token = "<YOUR TOKEN HERE>";
$organization = 'X9876';
$skip = 10;
$take = 20;
$response = searchSuppliers($token, $organization, $skip, $take);
import requests
import json
def post_agent_refunds(data, access_token):
api_url = 'https://api.felloh.com/agent/refunds'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
response = requests.post(api_url, data=json.dumps(data), headers=headers)
response.raise_for_status()
return response.text
data = {
'organisation': 'X9876',
'skip': 10,
'take': 20
}
response_data = post_agent_refunds(data, '<YOUR TOKEN HERE>')
print(response_data)
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var response = await PostAgentRefunds(new
{
organisation = "X9876",
skip = 10,
take = 20
}, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> PostAgentRefunds(object data, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = "https://api.felloh.com/agent/refunds";
client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json");
var httpResponse = await client.PostAsync(apiUrl, content);
httpResponse.EnsureSuccessStatusCode();
return await httpResponse.Content.ReadAsStringAsync();
}
}
}

RESPONSE

{
"data": [
{
"amount": 90,
"status": {
"id": "PENDING_AUTHORISATION"
},
"authorisation_code": "19b6698d-d614-45e0-ae90-6a3ea0662431",
"authorised_at": null,
"organisation": {
"id": "X000",
"name": "Felloh"
},
"completed_at": null,
"transaction": {
"id": "62132923-778d-45e0-a9bd-648913eeafdf",
"amount": 100,
"message": "Transaction succeeded",
"created_at": "2023-08-01T10:19:10.904Z",
"completed_at": "2023-08-01T10:20:17.000Z",
"currency": "GBX",
"provider_reference": "ASFEHYVVAEOSDCJIFUNZJVZURTWTILCSOBGLZMAE.prod01-vm-tx05",
},
"created_at": "2023-09-25T10:14:52.237Z"
},
{
"amount": 100,
"status": {
"id": "COMPLETED"
},
"authorisation_code": "8004d669-2875-45b6-a2ce-d08ae79029ae",
"authorised_at": "2023-09-22T15:32:21.251Z",
"organisation": {
"id": "X000",
"name": "Felloh"
},
"completed_at": "2023-09-22T15:32:21.251Z",
"transaction": {
"id": "d090d15b-2632-4375-a66f-afa278b61ae7",
"amount": 100,
"message": "Transaction succeeded",
"created_at": "2023-08-01T12:56:57.764Z",
"completed_at": "2023-08-01T12:57:23.000Z",
"currency": "GBX",
"provider_reference": "QPDAQHYSIMDKKYRYJVVQQPDAQHYSIMDKKYRYJVVQ.prod01-vm-tx11",
},
"created_at": "2023-09-22T14:10:37.136Z"
}
],
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6",
"count": 2
}
}

This endpoint retrieves all refunds. Refunds are sorted by created date.

HTTP Method

POST

HTTP Endpoint

PRODhttps://api.felloh.com/agent/refunds

SANDBOXhttps://sandbox.felloh.com/agent/refunds

Payload

ParameterRequiredTypeDescription
organisationtruestringThe organisation ID that you want to fetch refunds for. You can find the organisation that you have access to by using the List all organisations method.
skipfalseIntegerSee pagination section for details
takefalseIntegerSee pagination section for details

Response

Returns an array of Refund Objects


Authorise a refund

GET/agent/refunds/357ad3f2-5cc4-4098-bb17-191104aacee5/authorise

import axios from 'axios';
const authroisationCode = '8004d669-2875-45b6-a2ce-d08ae79029ae';
const response = await axios(
{
method: 'get',
url: `https://api.felloh.com/agent/refunds/${authroisationCode}/authorise`,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function authoriseRefund($token, $authroisationCode) {
$url = "https://api.felloh.com/agent/refunds/${authroisationCode}/authorise";
$client = new Client();
$response = $client->get($url, [
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => "Bearer $token",
],
]);
$data = json_decode($response->getBody(), true);
return $data;
}
$token = "<YOUR TOKEN HERE>";
$authroisationCode = '8004d669-2875-45b6-a2ce-d08ae79029ae';
$response = authoriseRefund($token, $authroisationCode);
import requests
def get_agent_refund_authorise(authorisation_code, access_token):
api_url = f'https://api.felloh.com/agent/refunds/{authorisation_code}/authorise'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
response = requests.get(api_url, headers=headers)
response.raise_for_status()
return response.text
authorisation_code = '8004d669-2875-45b6-a2ce-d08ae79029ae'
response_data = get_agent_refund_authorise(authorisation_code, '<YOUR TOKEN HERE>')
print(response_data)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string authorisationCode = "8004d669-2875-45b6-a2ce-d08ae79029ae";
var response = await GetAgentRefundAuthorise(authorisationCode, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> GetAgentRefundAuthorise(string authorisationCode, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = $"https://api.felloh.com/agent/refunds/{authorisationCode}/authorise";
client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var httpResponse = await client.GetAsync(apiUrl);
httpResponse.EnsureSuccessStatusCode();
return await httpResponse.Content.ReadAsStringAsync();
}
}
}

RESPONSE

{
"data": {},
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6",
"count": 1
}
}

This endpoint allows a user to authorise a refund. This endpoint is only available to users with the refund:approve permission.

HTTP Method

GET

HTTP Endpoint

PRODhttps://api.felloh.com/agent/refunds/<AUTHORISATION CODE>/authorise

SANDBOXhttps://sandbox.felloh.com/agent/refunds/<AUTHORISATION CODE>/authorise

Payload

ParameterRequiredTypeDescription
authroisationCodetruestringThe authorisation code of the refund that you want to authorise.

Response

Returns an empty 200 response if successful


Decline a refund

GET/agent/refunds/357ad3f2-5cc4-4098-bb17-191104aacee5/decline

import axios from 'axios';
const authroisationCode = '8004d669-2875-45b6-a2ce-d08ae79029ae';
const response = await axios(
{
method: 'get',
url: `https://api.felloh.com/agent/refunds/${authroisationCode}/decline`,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function declineRefund($token, $authroisationCode) {
$url = "https://api.felloh.com/agent/refunds/${authroisationCode}/decline";
$client = new Client();
$response = $client->get($url, [
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => "Bearer $token",
],
]);
$data = json_decode($response->getBody(), true);
return $data;
}
$token = "<YOUR TOKEN HERE>";
$authroisationCode = '8004d669-2875-45b6-a2ce-d08ae79029ae';
$response = declineRefund($token, $authroisationCode);
import requests
def get_agent_refund_decline(authorisation_code, access_token):
api_url = f'https://api.felloh.com/agent/refunds/{authorisation_code}/decline'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
response = requests.get(api_url, headers=headers)
response.raise_for_status()
return response.text
authorisation_code = '8004d669-2875-45b6-a2ce-d08ae79029ae'
response_data = get_agent_refund_decline(authorisation_code, '<YOUR TOKEN HERE>')
print(response_data)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
string authorisationCode = "8004d669-2875-45b6-a2ce-d08ae79029ae";
var response = await GetAgentRefundDecline(authorisationCode, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> GetAgentRefundDecline(string authorisationCode, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = $"https://api.felloh.com/agent/refunds/{authorisationCode}/decline";
client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var httpResponse = await client.GetAsync(apiUrl);
httpResponse.EnsureSuccessStatusCode();
return await httpResponse.Content.ReadAsStringAsync();
}
}
}

RESPONSE

{
"data": {},
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6",
"count": 1
}
}

This endpoint allows a user to decline a refund. This endpoint is only available to users with the refund:approve permission.

HTTP Method

GET

HTTP Endpoint

PRODhttps://api.felloh.com/agent/refunds/<AUTHORISATION CODE>/decline

SANDBOXhttps://sandbox.felloh.com/agent/refunds/<AUTHORISATION CODE>/decline

Payload

ParameterRequiredTypeDescription
authroisationCodetruestringThe authorisation code of the refund that you want to decline.

Response

Returns an empty 200 response if successful