Examples
Practical examples showing common operations with the Felloh C# SDK. Each example assumes you have already created a client instance.
Client Setup
using Felloh;
using var client = new FellohClient(new FellohConfig
{
PublicKey = Environment.GetEnvironmentVariable("FELLOH_PUBLIC_KEY")!,
PrivateKey = Environment.GetEnvironmentVariable("FELLOH_PRIVATE_KEY")!,
});
Bookings
Create a booking, then list and retrieve bookings. Amounts should be in the lowest currency denomination (e.g. pence for GBP).
Create a Booking
var created = await client.Bookings.CreateAsync(new CreateBookingParams
{
Organisation = "org-id",
BookingReference = "REF-001",
CustomerName = "James Dean",
Email = "james@example.com",
Currency = "GBX",
GrossAmount = 100000,
DepartureDate = "2025-08-01",
ReturnDate = "2025-08-15",
});
Console.WriteLine($"Booking ID: {created.Data.Id}");
List & Search Bookings
var bookings = await client.Bookings.ListAsync(new ListBookingsParams
{
Organisation = "org-id",
Keyword = "james@example.com",
Take = 20,
});
Console.WriteLine($"Found {bookings.Meta.Count} bookings");
Update a Booking
await client.Bookings.UpdateAsync("booking-id", new UpdateBookingParams
{
CustomerName = "Jane Dean",
DepartureDate = "2025-09-01",
});
Delete a Booking
await client.Bookings.DeleteAsync("booking-id");
Booking Components
Add and remove components (e.g. flights, hotels) on a booking.
Add a Component
var component = await client.BookingComponents.CreateAsync(
"booking-id",
new CreateBookingComponentParams
{
Supplier = "supplier-id",
Amount = 50000,
Currency = "GBX",
BookingReference = "REF-001",
DestinationAir = "AMS",
Type = "flights",
});
Remove a Component
await client.BookingComponents.DeleteAsync("booking-id", "component-id");
Transactions
List transactions, issue refunds, and manage pre-authorisations.
List Transactions
var transactions = await client.Transactions.ListAsync(new ListTransactionsParams
{
Organisation = "org-id",
Statuses = new[] { "COMPLETE" },
DateFrom = "2025-01-01",
DateTo = "2025-12-31",
});
Refund a Transaction
// Amount in lowest denomination (e.g. pence)
await client.Transactions.RefundAsync("transaction-id", new RefundTransactionParams
{
Amount = 5000,
Description = "Customer requested refund",
});
Complete Pre-Auth
// Capture held funds on a pre-authorised transaction
await client.Transactions.CompleteAsync("transaction-id");
Reverse Pre-Auth
// Release held funds on a pre-authorised transaction
await client.Transactions.ReverseAsync("transaction-id");
Re-assign to Different Booking
await client.Transactions.ReassignAsync("transaction-id", new ReassignTransactionParams
{
BookingId = "new-booking-id",
});
Payment Links
Create payment links to send to customers for card or open banking payments.
Create a Payment Link
var link = await client.PaymentLinks.CreateAsync(new CreatePaymentLinkParams
{
CustomerName = "John Doe",
Email = "john@example.com",
Organisation = "org-id",
Amount = 50000,
Type = "CARD",
BookingId = "booking-id",
OpenBankingEnabled = true,
CardEnabled = true,
Description = "Holiday deposit",
Currency = "GBX",
});
Assign a Payment Link to a Booking
await client.PaymentLinks.AssignAsync("payment-link-id", new AssignPaymentLinkParams
{
Organisation = "org-id",
CustomerName = "John Doe",
Email = "john@example.com",
BookingReference = "REF-002",
});
Ecommerce Sessions
Create ecommerce sessions for use with the browser-side JavaScript SDK.
Create an Ecommerce Session
var session = await client.Ecommerce.CreateAsync(new CreateEcommerceParams
{
CustomerName = "Jane Smith",
Email = "jane@example.com",
Organisation = "org-id",
Amount = 75000,
BookingId = "booking-id",
OpenBankingEnabled = true,
CardEnabled = true,
});
// Pass session ID to the browser SDK
Console.WriteLine($"Ecommerce ID: {session.Data.Id}");
Customers
Create and list customer records.
Create a Customer
var customer = await client.Customers.CreateAsync(new CreateCustomerParams
{
Organisation = "org-id",
CustomerName = "Jane Smith",
Email = "jane@example.com",
Address1 = "123 High Street",
City = "London",
County = "Greater London",
PostCode = "SW1A 1AA",
});
Search Customers
var customers = await client.Customers.ListAsync(new ListCustomersParams
{
Organisation = "org-id",
Keyword = "jane@example.com",
});
Refunds
List pending refunds and authorise or decline them.
List and Authorise Refunds
var refunds = await client.Refunds.ListAsync(new ListRefundsParams
{
Organisation = "org-id",
});
// Authorise a pending refund
await client.Refunds.AuthoriseAsync("authorisation-code");
// Or decline it
await client.Refunds.DeclineAsync("authorisation-code");
Scheduled Payments
Manage stored-card (MOTO) payments and generate customer approval links.
Fetch Available Tokens
// Get stored card tokens for a booking
var tokens = await client.ScheduledPayments.AvailableTokensAsync(
"booking-id"
);
foreach (var token in tokens.Data)
{
Console.WriteLine($"{token.Id} - {token.CardholderName}");
}
Create a Scheduled Payment
var payment = await client.ScheduledPayments.CreatePaymentAsync(
"booking-id",
new CreateScheduledPaymentParams
{
Token = "token-id",
Amount = 25000,
Date = "2025-09-01", // optional: schedule for future
});
Generate an Approval Link
var approval = await client.ScheduledPayments.ApprovalLinkAsync(
"booking-id",
new ApprovalLinkParams
{
Amount = 25000,
Token = "token-id",
});
Console.WriteLine($"Send to customer: {approval.Data.Url}");
Credit Notes
Create credit notes and assign them to bookings.
Create and Assign a Credit Note
var note = await client.CreditNotes.CreateAsync(new CreateCreditNoteParams
{
Organisation = "org-id",
CustomerName = "James Dean",
Amount = 15000,
Currency = "GBX",
});
// Assign to a booking
await client.CreditNotes.AssignAsync(note.Data.Id, new AssignCreditNoteParams
{
Organisation = "org-id",
CustomerName = "James Dean",
Email = "james@example.com",
BookingReference = "REF-003",
});
Suppliers & Beneficiaries
Manage suppliers for booking components and beneficiary bank accounts for disbursements.
Suppliers
// Create a supplier
var supplier = await client.Suppliers.CreateAsync(new CreateSupplierParams
{
Organisation = "org-id",
SupplierName = "Felloh Airlines",
});
// List suppliers
var suppliers = await client.Suppliers.ListAsync(new ListSuppliersParams
{
Organisation = "org-id",
Keyword = "airlines",
});
Beneficiaries
// Create a beneficiary bank account
var beneficiary = await client.Beneficiaries.CreateAsync(new CreateBeneficiaryParams
{
Organisation = "org-id",
AccountName = "Felloh Travel Ltd",
AccountNumber = "12345678",
SortCode = "112233",
});
// Activate a beneficiary
await client.Beneficiaries.ActivateAsync("beneficiary-id");
Organisations & API Keys
List accessible organisations and manage API keys programmatically.
Organisations
var orgs = await client.Organisations.ListAsync();
foreach (var org in orgs.Data)
{
Console.WriteLine($"{org.Id} {org.Name}");
}
API Keys
// Create a new API key pair
var key = await client.ApiKeys.CreateAsync(new CreateApiKeyParams
{
Organisation = "org-id",
Name = "Production Server",
});
// Store these securely — secret_key is only returned once
Console.WriteLine($"Public: {key.Data.PublicKey}");
Console.WriteLine($"Secret: {key.Data.SecretKey}");
// Delete a key
await client.ApiKeys.DeleteAsync("key-id");
Logging
Pass a Logger callback to observe every HTTP request made by the SDK.
Each LogEntry includes:
- Name
Method- Type
- string
- Description
HTTP method (GET, POST, PUT, DELETE).
- Name
Url- Type
- string
- Description
Full request URL including query string.
- Name
StatusCode- Type
- int?
- Description
HTTP status code, or
nullif the request failed before receiving a response.
- Name
DurationMs- Type
- long
- Description
Request duration in milliseconds.
- Name
Attempt- Type
- int
- Description
Retry attempt number (0 for the first attempt).
Request Logging
using var client = new FellohClient(new FellohConfig
{
PublicKey = "your-public-key",
PrivateKey = "your-private-key",
Logger = entry => Console.WriteLine(
$"{entry.Method} {entry.Url} → "
+ $"{entry.StatusCode} ({entry.DurationMs}ms) "
+ $"[attempt {entry.Attempt}]"
),
});
