Transactions

This object represents a customer's transaction (completed, pending and failed). These can be undertaken within our system or yours.

An example transaction object

{
"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c",
"amount": 1000,
"currency": "GBX",
"booking": {
"id": "9a33a74f-1e3e-595d-b89f-9da87d289e05",
"email": "tom@felloh.org",
"customer_name": "Tom Jones",
"booking_reference": "FEL-123456",
"departure_date": null,
"return_date": null,
"created_at": "2021-11-17T15:10:37.589Z"
},
"organisation": {
"id": "X000",
"name": "Felloh"
},
"status": "COMPLETE",
"method": "ONLINE",
"type": "CARD",
"payment_link": {
"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c",
"amount": 1000,
"customer_name": "Tom Jones",
"description": "Deposit for Bali",
"success_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/success",
"failure_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/failure",
"cancel_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/cancel",
"expires_at": "2021-12-17T15:10:37.589Z",
"created_at": "2021-11-17T15:10:37.589Z"
},
"metadata": {
"card_type": "DEBIT",
"bin_type": "PERSONAL",
"payment_brand": "MASTER",
"issuing_country": "GB",
"currency": "GBP",
"last_four_digits": "4397",
"cardholder_name": "Tom Jones",
"created_at": "2021-11-17T15:11:37.581Z"
},
"surcharge": {
"amount": 21,
"currency": "GBX"
},
"provider_reference": "vmtest-12313211413-ab",
"completed_at": "2021-11-17T15:11:37.581Z",
"created_at": "2021-11-17T15:11:37.581Z"
}

An example compact transaction object

{
"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c",
"amount": 1000,
"currency": "GBX",
"status": "COMPLETE",
"method": "ONLINE",
"type": "CARD",
"completed_at": "2021-11-17T15:11:37.581Z",
"created_at": "2021-11-17T15:11:37.581Z"
}

idstring

Unique identifier for the object.

amountnumber

The amount of the transaction

currencystring

The currency of the transaction | see currency documentation

bookingobject

The booking object that the transaction is linked to.

organisationobject

The organisation object that the transaction is linked to.

statusstring

The status of the payment

statusstring

The method that was used to take payment

statusstring

The type of payment method that was used

payment_linkobject

The payment link object that was used to create the transaction.

metadata.card_typestring

The card type that the charge was for, can be CREDIT or DEBIT

metadata.bin_typestring

The bin type of the card, can be PERSONAL or COMMERCIAL

metadata.payment_brandstring

The brand of the card that payment was taken on. Most common values are MASTER, AMEX or VISA

metadata.issuing_countrystring

Issuing country of card in ISO 3166 format

metadata.last_four_digitsstring

The last four digits of the payment card

metadata.cardholder_namestring

The name of the cardholder

provider_referencestring

The payment providers reference for the transaction

completed_atdatetime

The datetime at which the transaction object was completed (payment taken).

created_atdatetime

The datetime at which the transaction object was created within our systems

surcharge.amountnumber

The total value of surcharges on the transaction (this will only be available if you have surcharging enabled)

surcharge.currencystring

The currency of surcharges on the transaction, (this will only be available if you have surcharging enabled)


Fetch all

POST/agent/transactions

import axios from 'axios';
const response = await axios(
{
method: 'post',
url: 'https://api.felloh.com/agent/transactions',
data: {
organisation: 'X9876',
keyword: 'james.dean@gmail.com',
date_from: '2020-02-01',
date_to: '2021-05-10',
skip: 10,
take: 20,
statuses: ['COMPLETE', 'PENDING']
},
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function getTransactions($token, $organization, $keyword, $dateFrom, $dateTo, $skip, $take, $statuses) {
$url = "https://api.felloh.com/agent/transactions";
$client = new Client();
$response = $client->post($url, [
'json' => [
'organisation' => $organization,
'keyword' => $keyword,
'date_from' => $dateFrom,
'date_to' => $dateTo,
'skip' => $skip,
'take' => $take,
'statuses' => $statuses,
],
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => "Bearer $token",
],
]);
return $response->getBody();
}
$token = "<YOUR TOKEN HERE>";
$organization = 'X9876';
$keyword = 'james.dean@gmail.com';
$dateFrom = '2020-02-01';
$dateTo = '2021-05-10';
$skip = 10;
$take = 20;
$statuses = ['COMPLETE', 'PENDING'];
$response = getTransactions($token, $organization, $keyword, $dateFrom, $dateTo, $skip, $take, $statuses);
import requests
import json
def post_agent_transactions(data, access_token):
api_url = 'https://api.felloh.com/agent/transactions'
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',
'keyword': 'james.dean@gmail.com',
'date_from': '2020-02-01',
'date_to': '2021-05-10',
'skip': 10,
'take': 20,
'statuses': ['COMPLETE', 'PENDING']
}
response_data = post_agent_transactions(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 PostAgentTransactions(new
{
organisation = "X9876",
keyword = "james.dean@gmail.com",
date_from = "2020-02-01",
date_to = "2021-05-10",
skip = 10,
take = 20,
statuses = new[] { "COMPLETE", "PENDING" }
}, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> PostAgentTransactions(object data, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = "https://api.felloh.com/agent/transactions";
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();
}
}
}

JSON RESPONSE Defined by type parameter being NULL or 'json'

{
"data": {
"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c",
"amount": 1000,
"currency": "GBX",
"booking": {
"id": "9a33a74f-1e3e-595d-b89f-9da87d289e05",
"email": "tom@felloh.org",
"customer_name": "Tom Jones",
"booking_reference": "FEL-123456",
"departure_date": null,
"return_date": null,
"created_at": "2021-11-17T15:10:37.589Z"
},
"organisation": {
"id": "X000",
"name": "Felloh",
},
"status": "COMPLETE",
"method": "ONLINE",
"type": "CARD",
"payment_link": {
"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c",
"amount": 1000,
"customer_name": "Tom Jones",
"description": "Deposit for Bali",
"success_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/success",
"failure_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/failure",
"cancel_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/cancel",
"expires_at": "2021-12-17T15:10:37.589Z",
"created_at": "2021-11-17T15:10:37.589Z"
},
"metadata": {
"card_type": "DEBIT",
"bin_type": "PERSONAL",
"payment_brand": "MASTER",
"issuing_country": "GB",
"currency": "GBP",
"last_four_digits": "4397",
"cardholder_name": "Tom Jones",
"created_at": "2021-11-17T15:11:37.581Z"
},
"surcharge": {
"amount": 21,
"currency": "GBX"
},
"provider_reference": "vmtest-12313211413-ab",
"completed_at": "2021-11-17T15:11:37.581Z",
"created_at": "2021-11-17T15:11:37.581Z"
},
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6",
"count": 1
}
}

CSV RESPONSE Defined by type parameter being 'csv'

{
"data": {
"url": "https://agent-data-production-reports.s3.eu-west-2.amazonaws.com/02803bec-dddf-4f3e-902d-ef0e42a856af.csv"
},
"errors": [],
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "02803bec-dddf-4f3e-902d-ef0e42a856af",
"count": 184
}
}

This endpoint retrieves all transactions. Transactions are sorted by creation date, with the most recent transactions coming first.

HTTP Method

POST

HTTP Endpoint

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

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

Payload

ParameterRequiredTypeDescription
organisationtruestringThe organisation ID that you want to fetch transactions for. You can find the organisation that you have access to by using the List all organisations method.
keywordfalsestringA customer name booking reference that you want to filter by.
skipfalseIntegerSee pagination section for details
takefalseIntegerSee pagination section for details
show-child-organisationsfasleBooleanWhether to also show transactions for any of the requested organisations child organisations
typefaslestringCan be 'csv' or 'json', defaults to json
date_fromfalsedateThe date that you want to get transactions from, in ISO 8601 format
date_tofalsedateThe date that you want to get transactions to, in ISO 8601 format
statusesfalsearrayAn array of statuses can be provided if you wish to filter by transaction status. If this is not provided, the query will default to exlucde abandoned and pending transactions. A full list of transaction statuses can be found by using the enums endpoint

Response

Returns an array of Transaction Objects


Fetch one

GET/agent/transactions/226009ab-ffe9-4c80-922b-982e8e7849f8

import axios from 'axios';
const transactionID = '226009ab-ffe9-4c80-922b-982e8e7849f8';
const response = await axios(
{
method: 'get',
url: `https://api.felloh.com/agent/transactions/${transactionID}`,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function getTransaction($token, $transactionID) {
$url = "https://api.felloh.com/agent/transactions/$transactionID";
$client = new Client();
$response = $client->get($url, [
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => "Bearer $token",
],
]);
return $response->getBody();
}
$token = "<YOUR TOKEN HERE>";
$transactionID = '226009ab-ffe9-4c80-922b-982e8e7849f8';
$response = getTransaction($token, $transactionID);
import requests
def get_agent_transaction(transaction_id, access_token):
api_url = f'https://api.felloh.com/agent/transactions/{transaction_id}'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
response = requests.get(api_url, headers=headers)
response.raise_for_status()
return response.text
transaction_id = '226009ab-ffe9-4c80-922b-982e8e7849f8'
response_data = get_agent_transaction(transaction_id, '<YOUR TOKEN HERE>')
print(response_data)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var transactionID = "226009ab-ffe9-4c80-922b-982e8e7849f8";
var response = await GetAgentTransaction(transactionID, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> GetAgentTransaction(string transactionID, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = $"https://api.felloh.com/agent/transactions/{transactionID}";
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": {
"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c",
"amount": 1000,
"currency": "GBX",
"booking": {
"id": "9a33a74f-1e3e-595d-b89f-9da87d289e05",
"email": "tom@felloh.org",
"customer_name": "Tom Jones",
"booking_reference": "FEL-123456",
"departure_date": null,
"return_date": null,
"created_at": "2021-11-17T15:10:37.589Z"
},
"organisation": {
"id": "X000",
"name": "Felloh"
},
"status": "COMPLETE",
"method": "ONLINE",
"type": "CARD",
"payment_link": {
"id": "b5e1bd24-7379-4d27-b4d8-07120fefc25c",
"amount": 1000,
"customer_name": "Tom Jones",
"description": "Deposit for Bali",
"success_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/success",
"failure_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/failure",
"cancel_url": "https://pay.felloh.com/b5e1bd24-7379-4d27-b4d8-07120fefc25c/cancel",
"expires_at": "2021-12-17T15:10:37.589Z",
"created_at": "2021-11-17T15:10:37.589Z"
},
"metadata": {
"card_type": "DEBIT",
"bin_type": "PERSONAL",
"payment_brand": "MASTER",
"issuing_country": "GB",
"currency": "GBP",
"last_four_digits": "4397",
"cardholder_name": "Tom Jones",
"created_at": "2021-11-17T15:11:37.581Z"
},
"surcharge": {
"amount": 21,
"currency": "GBX"
},
"provider_reference": "vmtest-12313211413-ab",
"completed_at": "2021-11-17T15:11:37.581Z",
"created_at": "2021-11-17T15:11:37.581Z"
},
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6"
}
}

This endpoint allows you to retrieve a single transactions

HTTP Method

GET

HTTP Endpoint

PRODhttps://api.felloh.com/agent/transactions/<TRANSACTION ID>

SANDBOXhttps://sandbox.felloh.com/agent/transactions/<TRANSACTION ID>

Path Parameters

ParameterRequiredTypeDescription
transaction_idtrueUUIDThe transaction id that you wish to retrieve

Response

Returns a Transaction Object


Generate a refund

POST/agent/transactions/226009ab-ffe9-4c80-922b-982e8e7849f8/refund

import axios from 'axios';
const transactionID = '226009ab-ffe9-4c80-922b-982e8e7849f8';
const amount = 90;
const response = await axios(
{
method: 'post',
url: `https://api.felloh.com/agent/transactions/${transactionID}/refund`,
data: { amount },
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function createPaymentLinks($token, $amount) {
$url = "https://api.felloh.com/agent/transactions/226009ab-ffe9-4c80-922b-982e8e7849f8/refund";
$data = [
'amount' => $amount,
];
$client = new Client();
$response = $client->post($url, [
'json' => $data,
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => "Bearer $token",
],
]);
$data = json_decode($response->getBody(), true);
return $data;
}
$token = "<YOUR TOKEN HERE>";
$response = createPaymentLinks($token, 90);
import requests
import json
def post_agent_transaction_refund(transaction_id, amount, access_token):
api_url = f'https://api.felloh.com/agent/transactions/{transaction_id}/refund'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
data = {'amount': amount}
response = requests.post(api_url, data=json.dumps(data), headers=headers)
response.raise_for_status()
return response.text
transaction_id = '226009ab-ffe9-4c80-922b-982e8e7849f8'
refund_amount = 90
response_data = post_agent_transaction_refund(transaction_id, refund_amount, '<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 transactionID = "226009ab-ffe9-4c80-922b-982e8e7849f8";
var amount = 90;
var response = await PostAgentTransactionRefund(transactionID, amount, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> PostAgentTransactionRefund(string transactionID, int amount, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = $"https://api.felloh.com/agent/transactions/{transactionID}/refund";
client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var data = new { amount };
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": {},
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6",
"count": 1
}
}

This endpoint generates a refund request, this will then need to be authorised by a member of your organisation that has the sufficent roles to authorise it.

HTTP Method

POST

HTTP Endpoint

PRODhttps://api.felloh.com/agent/transactions/<TRANSACTION ID>/refund

SANDBOXhttps://sandbox.felloh.com/agent/transactions/<TRANSACTION ID>/refund

Payload

ParameterRequiredTypeDescription
amounttruestringThe amount of the transaction that you wish to refund in the lowest denomination of the currency (for GBX it is pence, for USX it is cents)

Response

Returns a Refund Object


Complete a pre-authorised transaction

GET/agent/transactions/226009ab-ffe9-4c80-922b-982e8e7849f8/complete

import axios from 'axios';
const transactionID = '226009ab-ffe9-4c80-922b-982e8e7849f8';
const response = await axios(
{
method: 'get',
url: `https://api.felloh.com/agent/transactions/${transactionID}/complete`,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function completeTransaction($token, $amount) {
$url = "https://api.felloh.com/agent/transactions/226009ab-ffe9-4c80-922b-982e8e7849f8/complete";
$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>";
$response = completeTransaction($token);
import requests
def get_complete_agent_transaction(transaction_id, access_token):
api_url = f'https://api.felloh.com/agent/transactions/{transaction_id}/complete'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
response = requests.get(api_url, headers=headers)
response.raise_for_status()
return response.text
transaction_id = '226009ab-ffe9-4c80-922b-982e8e7849f8'
response_data = get_complete_agent_transaction(transaction_id, '<YOUR TOKEN HERE>')
print(response_data)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var transactionID = "226009ab-ffe9-4c80-922b-982e8e7849f8";
var response = await GetCompleteAgentTransaction(transactionID, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> GetCompleteAgentTransaction(string transactionID, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = $"https://api.felloh.com/agent/transactions/{transactionID}/complete";
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 you to complete a pre-authorised transaction

HTTP Method

GET

HTTP Endpoint

PRODhttps://api.felloh.com/agent/transactions/<TRANSACTION ID>/complete

SANDBOXhttps://sandbox.felloh.com/agent/transactions/<TRANSACTION ID>/complete

Response

Returns an empty 200 response if successful


Reverse a pre-authorised transaction

GET/agent/transactions/226009ab-ffe9-4c80-922b-982e8e7849f8/reverse

import axios from 'axios';
const transactionID = '226009ab-ffe9-4c80-922b-982e8e7849f8';
const response = await axios(
{
method: 'get',
url: `https://api.felloh.com/agent/transactions/${transactionID}/reverse`,
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function reverseTransaction($token, $amount) {
$url = "https://api.felloh.com/agent/transactions/226009ab-ffe9-4c80-922b-982e8e7849f8/reverse";
$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>";
$response = reverseTransaction($token);
import requests
def get_reverse_agent_transaction(transaction_id, access_token):
api_url = f'https://api.felloh.com/agent/transactions/{transaction_id}/reverse'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
response = requests.get(api_url, headers=headers)
response.raise_for_status()
return response.text
transaction_id = '226009ab-ffe9-4c80-922b-982e8e7849f8'
response_data = get_reverse_agent_transaction(transaction_id, '<YOUR TOKEN HERE>')
print(response_data)
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var transactionID = "226009ab-ffe9-4c80-922b-982e8e7849f8";
var response = await GetReverseAgentTransaction(transactionID, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> GetReverseAgentTransaction(string transactionID, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = $"https://api.felloh.com/agent/transactions/{transactionID}/reverse";
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 you to reverse a pre-authorised transaction

HTTP Method

GET

HTTP Endpoint

PRODhttps://api.felloh.com/agent/transactions/<TRANSACTION ID>/reverse

SANDBOXhttps://sandbox.felloh.com/agent/transactions/<TRANSACTION ID>/reverse

Response

Returns an empty 200 response if successful


Re-assign a transaction

POST/agent/transactions/226009ab-ffe9-4c80-922b-982e8e7849f8/re-assign

import axios from 'axios';
const transactionID = '226009ab-ffe9-4c80-922b-982e8e7849f8';
const newBookingID = 'b7c259ba-d356-4263-912f-c6c4e29155ec';
const response = await axios(
{
method: 'post',
url: `https://api.felloh.com/agent/transactions/${transactionID}/re-assign`,
data: {
booking_id: newBookingID,
},
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer <YOUR TOKEN HERE>`,
},
},
);
use GuzzleHttp\Client;
function createPaymentLinks($token, $transactionID, $newBookingID) {
$url = "https://api.felloh.com/agent/transactions/{$transactionID}/re-assign";
$data = [
'booking_id' => $newBookingID,
];
$client = new Client();
$response = $client->post($url, [
'json' => $data,
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => "Bearer $token",
],
]);
$data = json_decode($response->getBody(), true);
return $data;
}
$token = "<YOUR TOKEN HERE>";
$transactionID = "226009ab-ffe9-4c80-922b-982e8e7849f8";
$newBookingID = "b7c259ba-d356-4263-912f-c6c4e29155ec";
$response = createPaymentLinks($token, $transactionID, $newBookingID);
import requests
def post_reassign_transaction(transaction_id, new_booking_id, access_token):
api_url = f'https://api.felloh.com/agent/transactions/{transaction_id}/re-assign'
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {access_token}'
}
data = {
'booking_id': new_booking_id
}
response = requests.post(api_url, json=data, headers=headers)
response.raise_for_status()
return response.text
transaction_id = '226009ab-ffe9-4c80-922b-982e8e7849f8'
new_booking_id = 'b7c259ba-d356-4263-912f-c6c4e29155ec'
response_data = post_reassign_transaction(transaction_id, new_booking_id, '<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 transactionID = "226009ab-ffe9-4c80-922b-982e8e7849f8";
var newBookingID = "b7c259ba-d356-4263-912f-c6c4e29155ec";
var response = await PostReassignTransaction(transactionID, newBookingID, "<YOUR TOKEN HERE>");
Console.WriteLine(response);
}
static async Task<string> PostReassignTransaction(string transactionID, string newBookingID, string accessToken)
{
using (HttpClient client = new HttpClient())
{
string apiUrl = $"https://api.felloh.com/agent/transactions/{transactionID}/re-assign";
client.DefaultRequestHeaders.Add("Content-Type", "application/json");
client.DefaultRequestHeaders.Add("Authorization", $"Bearer {accessToken}");
var data = new { booking_id = newBookingID };
var json = Newtonsoft.Json.JsonConvert.SerializeObject(data);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var httpResponse = await client.PostAsync(apiUrl, content);
httpResponse.EnsureSuccessStatusCode();
return await httpResponse.Content.ReadAsStringAsync();
}
}
}

RESPONSE

{
"data": {
"booking": {
"id": "b7c259ba-d356-4263-912f-c6c4e29155ec",
"email": "tom@felloh.org",
"customer_name": "Tom Jones",
"booking_reference": "FEL-123456",
"departure_date": null,
"return_date": null,
"created_at": "2021-11-17T15:10:37.589Z"
},
"transaction": {
"id": "226009ab-ffe9-4c80-922b-982e8e7849f8",
"amount": 1000,
"currency": "GBX",
"status": "COMPLETE",
"method": "ONLINE",
"type": "CARD",
"provider_reference": "vmtest-12313211413-ab",
"completed_at": "2021-11-17T15:11:37.581Z",
"created_at": "2021-11-17T15:11:37.581Z"
}
},
"errors": {},
"meta": {
"code": 200,
"reason": "OK",
"message": "The request was successful",
"request_id": "cdd40f5c-9d82-44c2-92e3-b5d2cad364f6",
"count": 1
}
}

This endpoint allows you to re-assign a transaction from one booking to another

HTTP Method

POST

HTTP Endpoint

PRODhttps://api.felloh.com/agent/transactions/<TRANSACTION ID>/re-assign

SANDBOXhttps://sandbox.felloh.com/agent/transactions/<TRANSACTION ID>/re-assign

Response

Returns an array containing the Transaction Object and the new booking object