Skip to content

Integrations

The Integration framework provides a standardized way to connect external services (payment gateways, shipping providers, SMS services, etc.) to Fullfinity.

Integrations follow a provider-agnostic architecture:

┌─────────────────────────────────────────────────────────────────┐
│ CORE MODULES │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ invoicing │ │ sales │ │ portal │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
│ │ │ │ │
│ └────────────────┼────────────────┘ │
│ ▼ │
│ ┌────────────────────────────────┐ │
│ │ integrations (base) │ │
│ │ - Integration model │ │
│ │ - IntegrationMapper model │ │
│ └────────────────┬───────────────┘ │
│ │ │
│ ┌────────────────┼────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │payment_stripe│ │shipping_ups │ │ sms_twilio │ │
│ │(integration) │ │(integration)│ │(integration)│ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────────────────────────────────┘

The base Integration model in the integrations module:

class Integration(Model):
_verbose_name = "Integration"
name = Char(description="Integration Name", max_length=100, required=True)
description = Text(description="Description")
image = File(description="Image")
# An Integration is a SHARED record (one row per provider, not per company).
# Everything company-specific — credentials, `enabled`, journal/fee accounts — is
# `company_scoped`, so each company plugs its own values into the same record.
# Hence there is NO `company` FK.
enabled = Boolean(description="Enabled", default=False, company_scoped=True)
module = ManyToOne("Module", related_name="integrations", on_delete="SET NULL")
state = Selection(
choices=["Installed", "Not Installed", "Enabled"],
calculate="get_state",
store=False,
)
integration_category = Selection( # the catalogue shelf — nothing else
choices=[
"Online Payment", "Banking", "Accounting", "Shipping", "Sales Channels",
"Marketing", "Communication", "Storage", "Sign-In", "Automation", "AI", "Other",
],
description="Category",
)
provides = ManyToMany("IntegrationKind", ...) # what kind of provider it is, for code
cron_sync_method = Char(description="Cron Sync Method", max_length=100)
last_synced_date = Datetime(description="Last Synced On")
FieldDescription
nameHuman-readable integration name
enabledWhether the integration is active
moduleReference to the Module that provides this integration
integration_categoryWhich catalogue heading it is listed under — see Integration Categories (set from the module manifest)
providesThe kinds of provider it is (payments, shipping, …) — what code looks providers up by. See Provider kinds (set from the module manifest)
cron_sync_methodMethod name for scheduled sync jobs

state is a calculated (non-stored) Selection. A @Model.calculate method runs against the whole recordset, so iterate self and assign each record (assigning self.state = … raises CalculateAssignmentError):

@Model.calculate("module", "enabled")
async def get_state(self):
"""State is computed from module installation + enabled flag."""
for record in self:
record.state = "Not Installed"
if record.module and record.module.state == "Installed":
record.state = "Installed"
if record.enabled:
record.state = "Enabled"

Integration modules declare their category in manifest.yaml:

name: Stripe Payments
identifier: payment_stripe
version: '1.0'
publisher: Your Company
requires_engine: 1
category: module_category_integrations
integration_category: Online Payment # The catalogue heading (a choice on Integration)
provides: [payments] # The kind of provider it is — what code looks up
description: Accept payments via Stripe
dependencies:
- online_payment # Backbone module dependency
icon: CreditCard
image: /static/img/stripe_logo.png
static_paths:
- img
integration_release: # Required: see below
status: Ready
# ...

Key manifest fields for integrations:

FieldDescription
categoryAlways module_category_integrations for integration modules
integration_categoryThe catalogue heading it lists under: one of the fixed integration_category choices (see Integration Categories) — required
providesThe kinds of provider it is, as a list of codes (see Provider kinds) — required for a provider an interface module looks up
dependenciesMust include the backbone module
imageLogo shown in integration list — required; the install is refused without it
integration_releaseRelease declaration: verified and listed (Ready) or kept out of the catalog (Withdrawn) — required, see below

You never create the Integration record yourself. The catalog is generated from these manifest keys: every module in the module_category_integrations category gets exactly one row, keyed by the module identifier, refreshed on every install, update and uninstall. Two consequences worth designing around:

  • Your provider is listed before it is installed. That is how a user installs it — they find your logo and description in the catalog and press Install. So the row exists while your module’s code does not; anything reading the catalog must treat state as the source of truth, not mere existence.
  • name, description, image, cron_sync_method, integration_category and provides are refreshed from the manifest on each of those events. Edit them in the manifest, not on the record — a value written to those fields is overwritten on the next module operation. Everything else (credentials, enabled, provider settings your model adds) is yours and is never touched.

Declaring the release: integration_release

Section titled “Declaring the release: integration_release”

A provider is listed the moment its module is on disk, so nothing distinguishes a finished connector from one that has never been run against the vendor’s current API — until a customer’s payment never confirms. Every integration module therefore declares where it stands, and ./fullfinity-server check --only integrations (part of the default check, and of app-store intake via --module) fails without it:

integration_release:
status: Ready
verified_on: '2026-11-23'
api: Stripe REST API (Stripe-Version 2026-11-18.endive)
docs: https://docs.stripe.com/api
inbound: [Signed webhook] # any of: Signed webhook, OAuth callback, Polled — [] for none
tests:
happy_path: tests/test_stripe_against_mock.py::StripeAgainstMockTest::test_checkout_round_trip
inbound_verification: tests/test_stripe_provider.py::StripeWebhookTest::test_a_forged_signature_is_rejected
failure_modes:
- tests/test_stripe_against_mock.py::StripeAgainstMockTest::test_a_declined_checkout_reads_as_failed
  • api and docs name what was verified: the API and its version, and the https:// reference it was checked against. Re-verify (and move verified_on) when the vendor versions or sunsets what you call.
  • tests are references, not prose. Each is <file>::<Class>::<test_method>, relative to your module (a value may be a list). The gate resolves every one; rename or delete a test and the build fails rather than leaving a claim pointing at nothing. happy_path and failure_modes (a decline, an HTTP error, a timeout) are always required.
  • inbound_verification is required when inbound names Signed webhook or OAuth callback. It must be the test that rejects a forged, unsigned or wrong-state request — an accept-only test proves nothing about the attack. Polled means you only call out and need no such test.
  • status: Withdrawn with a reason (what is missing, what would bring it back) keeps the provider out of the catalog: no row is created, and a stale one is removed. A database that already installed it keeps its row so the admin can still see and uninstall it. The code stays, so returning it is one line.

Create a model that inherits from Integration:

from fullfinity.engine.base import *
class MyServiceIntegration(Model):
"""Extends Integration with MyService-specific fields."""
__inherit__ = "Integration"
# Provider-specific credential fields. Every provider's fields land on the ONE shared
# Integration model, so prefix them with your provider: a bare `api_key` would be the
# same column as every other provider's `api_key`. Secrets use Encrypted.
# Test vs Live is the shared `integration_mode` field; don't add your own.
my_service_api_key = Encrypted(
description="API Key",
hint="Your MyService API key",
company_scoped=True, # Stored per-company
)
my_service_account_id = Char(
max_length=255,
description="Account ID",
company_scoped=True,
)
async def _is_my_service(self) -> bool:
"""Check if this integration is MyService."""
await self.fetch_related("module")
return self.module and self.module.identifier == "my_service"
async def enable_integration(self):
"""Validate credentials before enabling."""
if await self._is_my_service():
if not self.my_service_api_key:
raise UserError("Please enter your API Key before enabling.")
await super().enable_integration()

Integration methods use a detection pattern to only process their own integrations:

async def some_method(self, *args, **kwargs):
# Check if this integration is ours
if not await self._is_my_service():
return await super().some_method(*args, **kwargs)
# Handle our integration-specific logic
...

This pattern allows multiple integration modules to extend the same backbone.

Give every private helper a provider-unique name (_my_service_base_url, not _base_url). All __inherit__ fragments of Integration compose into one class, so two providers that both define _base_url share ONE method: the last one composed answers for every provider, and the other provider’s requests silently go to the wrong host.

integration_category is the catalogue shelf — the heading a person browses the Integrations app under — and nothing else. No code asks it what a provider can do (that is provides), so a heading can be renamed or merged without any payment, carrier or bank-feed lookup noticing. The list is fixed on the Integration model:

CategoryWhat is filed there
Online PaymentPayment gateways (Stripe, PayPal, Razorpay, Adyen, Mollie, Square, Authorize.Net)
BankingBank feed aggregators (Plaid, TrueLayer, Basiq, Salt Edge; GoCardless is withdrawn)
AccountingTax filing (HMRC Making Tax Digital), sales tax calculation (Stripe Tax), exchange rates, e-invoice networks
ShippingCarriers (DHL, FedEx, UPS, Royal Mail)
Sales ChannelsMarketplaces that import orders and publish listings (Amazon)
MarketingSearch, social and outreach data sources
CommunicationMailboxes and calendars (Gmail, Microsoft 365, Zoom), SMS and WhatsApp (Twilio)
StorageFile storage services
Sign-InIdentity providers
AutomationWorkflow and automation services
AIAI assistants and the MCP server
OtherAnything that fits none of the above

Pick the closest one, or Other — never add a category. The catalogue lists every integration on disk, installed or not, and a choice contributed by a module’s own _selection_add exists only once that module is installed: until then its integration is listed under no heading, which is exactly while someone is browsing for it. For the modules shipped with Fullfinity, ./fullfinity-server check --only integrations fails on a category outside the list, on a catalogue module that declares none, and on any _selection_add to integration_category.

A third-party module may still add its own category with _selection_add = {"integration_category": ["Your Category"]} on its Integration extension — the gate does not scan it — but its integration then shows uncategorized until the module is installed. Using a listed category avoids that.

Code that chooses between interchangeable providers — the payment step, a carrier picker, the bank-feed sync, the messaging composer, e-invoice transmission — asks what kind of provider an integration is, not where it is shelved. A module declares that in its manifest:

provides: [payments] # a list: one integration may be several kinds

and the integration registry links it to the record’s provides relation (an IntegrationKind per kind) on every install, update and uninstall. The kinds are a closed vocabulary, seeded by the integrations module:

KindLooked up by
paymentsonline_payment — checkout, the portal’s Pay Now, payment links, POS card/QR tenders
shippingshipping_carrier — carrier pickers on shipping methods and deliveries, rating, labels
bank_feedbank_feed — the provider picker on a bank connection, the daily sync
messagingmessaging — SMS/WhatsApp channels in the composer
e_invoicingeinvoice — the Access Point that transmits an e-invoice

A kind exists because some code asks for it, so a kind is added only in the same change as the code that looks providers of it up — never “for later”. Ask for providers through one helper on Integration, or the relation in a Q-expression:

Integration = get_model("Integration")
gateways = await Integration.providers("payments") # enabled, for the company in force
everything = await Integration.providers("payments", enabled_only=False)
if await integration.does_provide("shipping"):
...
filter: Q(provides__code='payments') & Q(enabled=True) # a picker's scope

An unknown kind raises (ConfigurationError) — a typo’d kind is a bug in code, and answering it with “no providers” would hide it for good. A record no manifest backs (a test fixture, a provider created through the API) is given its kinds directly: provides=await Integration.provides_commands("payments").

Two notes for interface authors:

  • A visible: rule cannot read provides__code. Form rules are evaluated in the browser, which cannot walk a to-many relation, so a form that reacts to the kind exposes a non-stored Boolean computed from does_provide (online_payment ships is_payment_provider, shipping_carrier ships is_shipping_carrier) and keys the rule on that.
  • Implementing a kind’s hook requires declaring the kind. A provider that implements create_payment_session, supports_shipping, supports_bank_feed, supports_messaging or send_einvoice but leaves provides out answers for its own record and is found by no lookup. check --only integrations fails it, and fails a provides value — or a kind named in providers(...), does_provide(...) or Q(provides__code=...) — that is not shipped.

Test vs Live endpoints, and the sandbox override

Section titled “Test vs Live endpoints, and the sandbox override”

Every category resolves its provider’s host the same way — there is no per-category mode field. Integration declares:

Field / methodWhat it is
integration_modeSelection(["Test", "Live"]), company_scoped — one company can pilot in Test while another runs Live against the same shared record
sandbox_urlChar, company_scoped — send this provider’s requests somewhere else entirely. Test mode only
await api_base_url(test_url, live_url)The host to call: the vendor’s own, or the sandbox override. Refuses a Live integration in a database that is not live
await refuse_unless_live()Raise a clear message when this database must not reach the provider — for a provider with no test environment
supports_test_modeComputed Boolean — whether this provider distinguishes the two environments at all. Backs the two controls on the form

Resolve every request’s host through api_base_url; never branch on integration_mode yourself. That is what makes the override reach your provider, and what guarantees a Live integration can never be redirected:

MYVENDOR_TEST = "https://sandbox.myvendor.com"
MYVENDOR_LIVE = "https://api.myvendor.com"
async def _myvendor_base_url(self) -> str:
return await self.api_base_url(MYVENDOR_TEST, MYVENDOR_LIVE)

It is also what keeps your provider to the live database: in a copy of a database (a staging copy, a restored backup) a Live integration is refused here with a message telling the user to switch to Test mode, before any request is built. See Live and Copy Databases.

A vendor with one host for both networks passes the same URL twice — await self.api_base_url(MYVENDOR_API, MYVENDOR_API). Many vendors pick the network from the API key rather than the hostname, so this looks redundant; it is not. It is the only reason the sandbox override can reach that provider, which is what lets you develop against a mock with no account at all.

Going Live with a Sandbox URL still stored is refused at the write, not ignored at the call — so nobody transacts for real against a stub believing otherwise.

Developing against a mock instead of a sandbox

Section titled “Developing against a mock instead of a sandbox”

Most vendors gate sandbox access behind an account you cannot get quickly — a merchant account, a developer signup, sometimes a regulated-entity onboarding. The Sandbox URL lets you build and verify a provider with no vendor credentials at all: run a small HTTP mock of the vendor’s API (a few routes returning the vendor’s documented responses), set its URL as the integration’s Sandbox URL (Test mode), and drive the app normally.

Fullfinity’s bundled carriers, payment gateways and bank feeds are developed against mocks of exactly this kind. They are part of Fullfinity’s own test tooling, not the distribution, so write one for your vendor. Give it a way to return the vendor’s own error envelope and to delay a response (for timeout handling), plus whatever states matter to your category — a payment refused on a 200 response, a lapsed bank consent, an account with nothing to report.

Build your mock’s responses from the vendor’s published schema, not from what your provider happens to read. A mock that mirrors the provider’s assumptions confirms the provider agrees with itself; it cannot catch a field you invented. Building the bundled mocks from the vendors’ own API references is how they caught a Stripe field that no longer exists, and an endpoint constant that swallowed its own path.

A Sandbox URL is a BASE, and the provider appends its own path to it. Two consequences:

  • Pass a host to api_base_url, never a full endpoint. Folding the path into the constant means the override replaces it wholesale and every request lands on the bare host.
  • A query-string knob does not survive being driven through a provider — it would land mid-path. To put a whole flow in a state, start a second mock already in it.

Each bundled provider ships an *_against_mock.py test that drives its real HTTP path against its mock in CI; do the same in your module’s tests/. Those tests can catch a wrong path, a wrong amount unit or a reversed sign; the transport-patched tests beside them cannot, by construction.

Bank feeds have one assertion worth copying: the five aggregators disagree about the amount sign — Plaid sends positive for money out, the others are already statement convention — and fetch_bank_transactions must normalise to positive-is-money-in whatever the vendor sends. A provider that copies another’s handling produces a ledger where every deposit is a withdrawal, reconciles to exactly the wrong number, and raises nothing.

fetch_bank_transactions also returns the account’s booked balance in the same convention (negative when the account is owed, e.g. a card) — after each sync it is held against the statements and any difference is shown on the feed account. A provider that reports corrections to transactions it already sent returns them as modified (the transaction as it now stands) and removed (the withdrawn ids): an imported line nobody has acted on follows the correction, while a matched or reconciled one is left as it is and listed on the account for someone to reverse deliberately.

Each transaction’s external_id is the dedupe key, so it must be unique and stable for the life of the transaction: the aggregator’s own id, never a bank-supplied reference that can be missing, shared by two movements, or reissued between pending and booked (that goes in reference, where the accountant sees it). Choose wrongly and the feed either merges two real movements into one line or imports one movement twice — silently, either way.

If your provider changes which id it keys on, return the id(s) an earlier version used as previous_ids (an optional list of strings) on each transaction. A line already imported under one of them is recognised instead of imported again, and re-keyed to the new external_id, so the old id is free afterwards. A previous id is never claimed while another transaction in the same pull answers to it, and two transactions that share a previous id (two movements the bank gave one reference) each import on their own once the first has claimed the stored line.

That stored line may have been built from the other transaction — keyed on the shared id, an earlier version kept whichever arrived first and skipped the rest as duplicates. So the claimed line takes the claiming transaction’s amount and date while nobody has acted on it (a settled line is never rewritten), the id it was claimed from is kept on the mapping (IntegrationMapper.previous_remote_id), and every other transaction naming that id — in the same pull or a later one — is noted under Bank Changes to Review on the bank-feed account, naming the line and both transactions, so someone checks what the line was reconciled against:

bank_id = txn.get("transactionId") # the bank's, optional, not unique
external_id = txn.get("internalTransactionId") or bank_id # the aggregator's own
return {
"external_id": external_id,
"reference": bank_id or external_id,
"previous_ids": [bank_id] if bank_id and bank_id != external_id else [],
# …date, amount, currency, description, counterparty, pending
}

supports_test_mode is False by default: a Test/Live switch that changes no endpoint is a dead control, and showing one is worse than showing none. A category interface opts in by overriding the compute, narrowing to its own records and delegating the rest:

@Model.calculate()
async def calc_supports_test_mode(self):
await super().calc_supports_test_mode() # never skip this — several modules extend
await self.fetch_related("provides") # one compute, and skipping it discards
for record in self: # whatever the others decided
if await record.does_provide("shipping"):
record.supports_test_mode = True

The Mode and Sandbox URL fields are already on integration_form_view, gated on this compute — you do not add them to the form yourself.

For syncing data with external systems, use IntegrationMapper:

class IntegrationMapper(Model):
_verbose_name = "Integration Mapper"
local_id = Char(description="Document ID", max_length=255, required=True)
remote_id = Char(description="Remote ID", max_length=255, required=True)
integration = ManyToOne("Integration", related_name="mappings", on_delete="CASCADE")
model = Char(description="Model", max_length=255, required=True)

Example usage:

# Store mapping after creating remote resource
async def sync_contact(self, contact):
# Create in remote system
remote_customer = await self._my_service_create_customer(contact)
# Store mapping
IntegrationMapper = get_model("IntegrationMapper")
await IntegrationMapper.create(
integration=self.id,
model="Contact",
local_id=str(contact.id),
remote_id=remote_customer["id"],
)
# Look up remote ID
async def get_remote_id(self, contact):
IntegrationMapper = get_model("IntegrationMapper")
mapping = await IntegrationMapper.filter(
integration=self.id,
model="Contact",
local_id=str(contact.id),
).first()
return mapping.remote_id if mapping else None

For scheduled synchronization, name the method in manifest.yaml (it is copied onto the record with the other manifest keys; never set it as a class attribute, which would shadow the shared field):

cron_sync_method: sync_my_service

The integrations cron calls that method once per run, at class level. enabled and your credentials are company_scoped, so the method loops the companies it serves and re-reads the record inside each one:

class MyServiceIntegration(Model):
__inherit__ = "Integration"
async def sync_my_service(cls):
"""Cron job: Sync data with MyService, for every company that enabled it."""
Integration = get_model("Integration")
for company in await get_model("Company").filter(active=True).all():
with as_company(company.id):
# Read inside the scope: company_scoped values resolve when fetched.
integration = await Integration.filter(
identifier="my_service", enabled=True,
).first()
if integration:
await integration._my_service_sync()
async def _my_service_sync(self):
"""Perform actual sync logic."""
# Fetch updates from external service
# Update local records
await self.update(last_synced_date=utc_now())

Add provider-specific fields to Integration form:

Give the inheriting view its own identifier and point inherited_view: at the base view. Patch it with arch.operations (an add action targeting a stable node, position, and the value to insert). Gate each field on the record’s own identifier Char plus its state — the module relation’s fields never reach the client, so Q(module__identifier=…) cannot be used in a visible: clause. Credential fields use the PasswordInput widget.

views/my_service_views.yaml
- data_type: UiView
name: My Service Integration Form Extension
identifier: my_service_integration_form_extension
type: Form
model: Integration
inherited_view: integration_form_view
arch:
operations:
- action: add
target:
anchor: integration_description_col
field: description
position: after
value:
type: field
name: my_service_account_id
properties:
visible: Q(identifier='my_service') & Q(state__neq='Not Installed')
- action: add
target:
anchor: integration_description_col
field: my_service_account_id
position: after
value:
type: field
name: my_service_api_key
properties:
widget: PasswordInput
visible: Q(identifier='my_service') & Q(state__neq='Not Installed')

A provider whose connect is a hosted sign-in (a bank, a tax authority) opens it in a new tab — return {"type": "url", "url": ..., "target": "_blank"} from the connect button’s method — and has it redirect back to a public route of your module. Two rules for that route:

  • It is reached without a session, so resolve the record — by an id in the path, or by the stored nonce itself when the provider only redirects to one fixed, pre-registered address (many do: the redirect URI must match one entered in their console exactly, so show that address read-only on your form) — and prove the return belongs to the attempt your user started with a single-use nonce you stored when the sign-in began and passed as the OAuth state. Compare in constant time, burn it before calling the provider, and answer a missing record exactly like a mismatch. For an OAuth redirect, use the shared helper rather than writing your own: issue_state(owner, purpose, **payload) (from fullfinity.modules.integrations.oauth_state) stores what the callback needs server-side for ten minutes and returns (state, code_challenge) for PKCE (S256); consume_state(owner, purpose, state) redeems it once, for the user who started it, and returns the payload with its verifier. Pass your module identifier as owner, and safe_return_url(url) to keep the post-consent redirect on this site.
  • End on the shared result page rather than your own markup:
from fullfinity.modules.integrations.result_page import close_tab_page
return close_tab_page(t("Connected"), t("Close this tab and return to the app."), True)

Some authorities require every API call to carry details of the person making it — HMRC’s fraud prevention headers are the case in point. For each signed-in request the framework records them in the request context, read with get_request_ctx(key) from fullfinity.engine.middleware:

KeyValue
client_ipThe user’s public address as the server resolved it (honouring trusted proxies only)
client_portTheir source port: the socket’s, or — behind a trusted proxy — the one the proxy states in X-Client-Port
client_seen_atWhen, as yyyy-MM-ddThh:mm:ss.sssZ
client_reportWhat the browser reports about itself on a method call: device_id (persistent per browser), user_agent, screens (width, height, scaling_factor, colour_depth), window (width, height), timezone_offset (minutes east of UTC) — or None
client_multi_factorThe second factor the session was opened with: [{type, timestamp, unique_reference}], empty if none

These are the client’s own word and are for passing on, never for a decision. Pass nothing you could not collect — an authority that asks for a value wants it left out, not invented. Behind your own reverse proxy, the server must trust it and it must state the port:

  • set FORWARDED_ALLOW_IPS in the server’s environment to the proxy’s address (or * when the proxy is the only thing that can reach the server’s port) — otherwise every user appears to come from the proxy;
  • forward the client’s port in X-Client-Port, overwriting anything the client sent (Caddy: header_up X-Client-Port {remote_port}; nginx: proxy_set_header X-Client-Port $remote_port;).

If a CDN sits in front of that proxy, the proxy sees the CDN’s port, not the client’s: have the CDN set X-Client-Port instead (Cloudflare: a request-header Transform Rule setting it to cf.edge.client_port) and pass that header through unchanged.

  1. Use company_scoped=True for credential fields to store per-company
  2. Validate credentials in enable_integration() before allowing enable
  3. Use the detection pattern (_is_my_service()) in all override methods
  4. Store mappings for synced records to avoid duplicates
  5. Handle API errors gracefully with user-friendly messages
  6. Log sync operations for debugging