Skip to main content
The Generic Connector for Formance Connectivity provides a way to connect your Formance Stack with Financial Service Providers that are not natively supported by Formance. Formance Connectivity interacts with the remote Financial Service Provider through the Generic Connector in two directions: The Generic Connector handles two directions of communication with the Financial Service Provider:
  • Data polling (read): Periodically fetches accounts, balances, transactions, and beneficiaries from the PSP
  • Payment initiation (write): Sends payout and transfer requests to the PSP on behalf of Formance

Integration with the Financial Service Provider

The Generic Connector interacts with the Financial Service Provider by sending requests formatted according to the Generic Connector API specifications and expecting responses formatted according to the same specifications. The full machine-readable spec is available as an OpenAPI definition. As a consequence, it is necessary to create a service on your side that will interact with the Financial Service Provider and expose the data with the expected format. The typical deployment of the Generic Connector is as follows:

Polling mechanism

The Generic Connector uses a state-based approach for polling payment data efficiently.

How it works

  1. The connector stores the timestamp of the last successful data retrieval
  2. In subsequent polls, it uses this timestamp to fetch only new or updated data
  3. The UpdatedAtFrom query parameter is passed in API calls to your service
  4. This parameter indicates that only transactions from that specific point in time should be returned

Data storage and updates

The system doesn’t fetch all data fresh every time it polls. Instead:
  • Each batch of data received is stored
  • The internal state is updated with the latest timestamp of the data received
  • In the next polling cycle, the updated timestamp is used to fetch only new or changed data

Benefits

This polling method offers several advantages:
  • Reduced data transfer: Only fetches new or updated information
  • Minimized load: Reduces strain on both Formance and your API
  • No duplicates: Ensures the database stays up-to-date without duplicating existing data
When setting up the Generic Connector, ensure that your API can handle and respond correctly to the UpdatedAtFrom query parameter. This allows the system to efficiently retrieve only the necessary data during each polling cycle.

Authentication

When instantiating the Generic Connector, you will need to pass an API key that will be used to authenticate the requests to your service. The Generic Connector will send requests with the API key in the Authorization header so that your service can authenticate the requests. Example:
Authorization: Bearer <API_KEY>

Polling endpoints

Your integration service must expose the following GET endpoints for the Generic Connector to poll data from the PSP.
OperationMethodPathDescription
List accountsGET/accountsFetch internal accounts
Get account balancesGET/accounts/{accountId}/balancesFetch balances for a specific account
List beneficiariesGET/beneficiariesFetch external accounts (payout destinations)
List transactionsGET/transactionsFetch payment transactions
All list endpoints support the following query parameters:
ParameterTypeDefaultDescription
pageSizeinteger100Number of items per page (minimum 1).
pageinteger1Page number (minimum 1).
sortstringSort order (e.g., createdAt:asc).
createdAtFromdate-timeReturn items created after this timestamp. Used by /accounts and /beneficiaries.
updatedAtFromdate-timeReturn items updated after this timestamp. Used by /transactions.

Account response

{
  "id": "acc_123",
  "accountName": "Main Operating Account",
  "createdAt": "2025-01-10T08:00:00Z",
  "metadata": {
    "region": "eu-west"
  }
}
FieldTypeRequiredDescription
idstringYesUnique account identifier on the PSP. Becomes the account reference in Formance.
accountNamestringYesHuman-readable name for the account.
createdAtstringYesRFC 3339 timestamp.
metadataobjectNoArbitrary key-value pairs.

Balance response

Returned by GET /accounts/{accountId}/balances:
{
  "id": "bal_001",
  "accountID": "acc_123",
  "at": "2025-03-15T10:30:00Z",
  "balances": [
    {
      "amount": "150000",
      "currency": "USD/2"
    },
    {
      "amount": "500000000",
      "currency": "BTC/8"
    }
  ]
}
FieldTypeRequiredDescription
idstringYesUnique balance snapshot identifier.
accountIDstringYesThe account this balance belongs to. Must match a known account id.
atstringYesRFC 3339 timestamp of when the balance was captured.
balancesarrayYesList of balances, one per currency.
Each item in the balances array has the following fields:
FieldTypeRequiredDescription
amountstringYesAmount in minor units as an integer string (e.g., "150000" for $1,500.00 with precision 2).
currencystringYesAsset in UMN format (e.g., "USD/2", "BTC/8").

Beneficiary response

{
  "id": "ben_456",
  "createdAt": "2025-02-20T14:00:00Z",
  "ownerName": "Acme Supplier Inc.",
  "metadata": {
    "bankCountry": "FR"
  }
}
FieldTypeRequiredDescription
idstringYesUnique beneficiary identifier on the PSP. Becomes an external account reference in Formance.
createdAtstringYesRFC 3339 timestamp.
ownerNamestringYesName of the beneficiary.
metadataobjectNoArbitrary key-value pairs.

Transaction response

{
  "id": "txn_789",
  "relatedTransactionID": "txn_100",
  "createdAt": "2025-03-15T10:30:00Z",
  "updatedAt": "2025-03-15T10:35:00Z",
  "currency": "USD/2",
  "scheme": "visa",
  "type": "PAYIN",
  "status": "SUCCEEDED",
  "amount": "50000",
  "sourceAccountID": "acc_123",
  "destinationAccountID": "acc_456",
  "metadata": {
    "orderId": "order_42"
  }
}
id
string
required
Unique transaction identifier on the PSP. Becomes the payment reference in Formance.
Identifier of a related transaction (e.g., the original transaction for a refund). Mapped as the parent reference in Formance.
createdAt
string
required
RFC 3339 timestamp of creation.
updatedAt
string
required
RFC 3339 timestamp of last update. Used by the connector for incremental polling.
currency
string
required
Asset in UMN format (e.g., "USD/2").
scheme
string
Payment scheme (e.g., visa, mastercard, sepa).
type
string
required
Transaction type (see transaction types below).
status
string
required
Transaction status (see transaction statuses below).
amount
string
required
Amount in minor units as an integer string.
sourceAccountID
string
Source account identifier.
destinationAccountID
string
Destination account identifier.
metadata
object
Arbitrary key-value pairs.

Transaction types

The type field is mapped to Formance payment types:
PSP TypeFormance TypeDescription
PAYINPay-inIncoming payment (e.g., customer payment)
PAYOUTPayoutOutgoing payment to an external account
TRANSFERTransferInternal transfer between accounts
OTHEROtherAny other transaction type

Transaction statuses

The status field is mapped to Formance payment statuses. This is the full lifecycle status set that captures transactions in any state during polling:
PSP StatusFormance StatusDescription
PENDINGPendingAwaiting processing
SUCCEEDEDSucceededCompleted successfully
FAILEDFailedFailed
CANCELLEDCancelledCancelled
EXPIREDExpiredExpired
REFUNDEDRefundedRefunded
REFUNDED_FAILURERefund failedRefund attempt failed
REFUND_REVERSEDRefund reversedRefund was reversed
DISPUTEDisputeUnder dispute
DISPUTE_WONDispute wonDispute resolved in merchant’s favor
DISPUTE_LOSTDispute lostDispute resolved against merchant
AUTHORISATIONAuthorisationAuthorized but not yet captured
CAPTURECaptureCaptured
CAPTURE_FAILEDCapture failedCapture attempt failed
OTHEROtherAny other status
Any unrecognized status value is also mapped to OTHER.

Identifier mapping

Understanding how identifiers flow between your PSP, the Generic Connector, and Formance is critical for reconciliation and payment initiation.

Polling: PSP to Formance

When the Generic Connector polls data from your integration service, identifiers are mapped as follows:
PSP fieldFormance fieldDescription
Account.idAccount referenceThe PSP account ID becomes the Formance internal account reference.
Account.accountNameAccount nameDisplayed in Formance as the account name.
Beneficiary.idExternal account referenceThe PSP beneficiary ID becomes the Formance external account reference.
Beneficiary.ownerNameExternal account nameDisplayed in Formance as the external account name.
Transaction.idPayment referenceThe PSP transaction ID becomes the Formance payment reference.
Transaction.relatedTransactionIDPayment parent referenceLinks related transactions (e.g., a refund to its original payment).
Transaction.sourceAccountIDPayment source accountMust match a previously polled account or beneficiary id.
Transaction.destinationAccountIDPayment destination accountMust match a previously polled account or beneficiary id.

Payment initiation: Formance to PSP

When Formance initiates a payout or transfer, the identifier flow reverses. The Generic Connector sends the original PSP identifiers back to your service:
Formance fieldPSP request fieldDescription
Transfer initiation referenceidempotencyKeyFormance’s unique reference for this initiation. Your service must use this for idempotency.
Source account referencesourceAccountIdThe PSP account id that was originally polled from your service.
Destination account referencedestinationAccountIdThe PSP account or beneficiary id that was originally polled from your service.
The response then establishes the link back:
PSP response fieldFormance fieldDescription
idPayment referenceThe PSP-generated payment ID, used to track this payment in Formance.
idempotencyKeyPayment parent referenceLinks the resulting payment back to the Formance transfer initiation.
The account identifiers used in payment initiation requests are the same id values your service returned during polling. Ensure your integration service can accept these IDs in payout and transfer requests to route payments correctly on the PSP.

Payment initiation

Payment initiation support for the Generic Connector is available as of Payments v3.2.
In addition to polling data, the Generic Connector can initiate outbound payments through your integration service. This enables two types of payment initiation:
  • Payout: Transfer funds from an internal account to an external account (e.g., paying out to a vendor’s bank account)
  • Transfer: Move funds between two internal accounts (e.g., moving funds between wallets)
When a payout or transfer is initiated through Formance, the Generic Connector sends a POST request to your integration service, which then executes the payment on the Financial Service Provider.

Endpoints your service must implement

Your integration service needs to expose two additional endpoints to support payment initiation:
OperationMethodPathDescription
Create payoutPOST/payoutsInitiate a payout to an external account
Create transferPOST/transfersInitiate an internal transfer between accounts
Both endpoints receive a JSON request body and must return a JSON response with the created payment details.

Request format

The request body for both POST /payouts and POST /transfers shares the same structure:
{
  "idempotencyKey": "unique-request-id",
  "amount": "10000",
  "currency": "USD/2",
  "sourceAccountId": "acc_123",
  "destinationAccountId": "ben_456",
  "description": "Payment description",
  "metadata": {
    "key": "value"
  }
}
FieldTypeRequiredDescription
idempotencyKeystringYesUnique identifier for the request. Retries with the same key must return the existing payment instead of creating a duplicate.
amountstringYesAmount in minor units as an integer string (e.g., "10000" for $100.00 with precision 2).
currencystringYesAsset in UMN format (e.g., "USD/2", "BTC/8").
sourceAccountIdstringYesPSP account id of the source account (originally polled via GET /accounts).
destinationAccountIdstringYesPSP account or beneficiary id of the destination. For payouts, this is typically a beneficiary id (polled via GET /beneficiaries). For transfers, this is an account id.
descriptionstringNoHuman-readable description of the payment.
metadataobjectNoArbitrary key-value pairs attached to the payment.

Response format

Your service must return an HTTP 201 response with the created payment details:
{
  "id": "psp_payout_789",
  "idempotencyKey": "unique-request-id",
  "amount": "10000",
  "currency": "USD/2",
  "sourceAccountId": "acc_123",
  "destinationAccountId": "ben_456",
  "description": "Payment description",
  "status": "PENDING",
  "createdAt": "2025-03-15T10:30:00Z",
  "metadata": {
    "key": "value"
  }
}
FieldTypeRequiredDescription
idstringYesPSP-generated unique identifier for the payment. Becomes the payment reference in Formance.
idempotencyKeystringYesThe idempotency key from the request. Used to link this payment back to the Formance transfer initiation.
amountstringYesAmount in minor units (integer string).
currencystringYesAsset in UMN format.
sourceAccountIdstringYesSource account identifier.
destinationAccountIdstringYesDestination account identifier.
descriptionstringNoPayment description.
statusstringYesInitial status of the payment (see below).
createdAtstringYesRFC 3339 timestamp of when the payment was created.
updatedAtstringNoRFC 3339 timestamp of the last status update.
metadataobjectNoKey-value pairs attached to the payment.

Initial status

For the creation response, the typical statuses are:
StatusDescription
PENDINGThe PSP accepted the request and the payment is being processed.
SUCCEEDEDThe payment completed immediately (synchronous processing).
FAILEDThe payment was rejected by the PSP.
The full set of transaction statuses (e.g., CANCELLED, EXPIRED, REFUNDED) is supported and will be mapped correctly, but these lifecycle statuses are typically observed later through polling via GET /transactions rather than in the initial creation response.

Idempotency

Your integration service must implement idempotency on the idempotencyKey field. If a request arrives with an idempotencyKey that has already been processed, your service should return the existing payment rather than creating a duplicate. This is critical because Formance may retry failed requests.
Failing to implement idempotency correctly can result in duplicate payments being created on the PSP.

Error handling

If your service encounters an error, return an appropriate HTTP error status code with a JSON body:
{
  "Title": "Payment failed",
  "Detail": "Insufficient funds in source account"
}
The Generic Connector will propagate the error back to Formance, and the transfer initiation will be marked as FAILED. You can then retry the initiation through the Formance API.