Connectors

Register, list, update, and delete payment provider connectors — the credential sets that link each merchant to its PSPs and power Tokeflow's routing.

A connector is one configured credential set for one payment service provider (PSP). Connecting the same provider twice — say, a test-mode and a live-mode credential set, or one account per country — produces two independent connectors. Everything downstream of setup speaks in connectors, not providers: routing profiles reference connectors, and every attempt in a transaction's timeline records the connector_id it ran through.

Tokeflow orchestrates charges across your connectors; it does not process or settle funds. The connector is where you hand Tokeflow the provider credentials it needs to submit charges on your behalf — and where you wire up the provider's webhooks so asynchronous events (PIX confirmations, chargebacks, refund updates) flow back in.

Credentials are write-only. They are validated, encrypted, and stored on creation, and they never appear in any API response. The connector object exposes has_webhook_secret — a boolean — rather than the secret itself. To rotate credentials, PATCH the connector with a new credentials object.

How a connector comes to life

Use GET /payment-providers to discover which providers are available to connect and the auth methods each one supports, create the connector, then point your routing at it.

The connector object

FieldTypeDescription
idstringConnector ID, prefixed conn_.
merchant_idstringOwning merchant, prefixed mrc_.
provider_slugstringPayment provider slug (e.g. provider_a, provider_b, provider_c, provider_d, provider_e). See Supported providers.
payment_provider_idstringID of the payment provider behind this connector. Use it with GET /payment-providers/:provider_id to read the provider's details, even after the provider stops being listed as active.
namestringYour label for this credential set (e.g. "Provider A BRL").
country_codestring | nullISO 3166-1 alpha-2 country code. Null for non-country-specific providers.
auth_methodstringAuthentication method (api_key for V1).
is_test_modebooleanWhether this is a test-mode connector.
is_activebooleanWhether the connector is active. See Active and inactive connectors.
created_atstringCreation timestamp (ISO 8601 UTC).
webhook_urlstring | nullThe URL to configure in your PSP dashboard so provider events reach Tokeflow. Treat it as a credential — it carries a per-connector token in its query string. See Handle webhook_url as a secret.
has_webhook_secretbooleanWhether inbound provider webhooks can be verified — either a webhook_secret is stored, or the provider signs with a key already in credentials (some providers sign with the account secret key, so their connectors report true without a webhook_secret).
configobject | nullOptional non-sensitive per-connector config. Null when no overrides are set. See Connector config.

Connector config

config holds non-sensitive, per-connector overrides:

FieldTypeDescription
card_brandsarrayNarrows the card brands surfaced to the Bridge SDK for this connector. Must be a subset of the provider's default_supported_card_brands. When config is null (no overrides), the SDK falls back to the provider default.
installments_enabledboolean | nullThe merchant's installments choice for this connector, within the provider's installment_config. Unset (or null to clear): API charges that request installments are accepted, but the checkout does not offer them. true: installments are also offered at checkout. false: installment charges are refused on this connector. A provider whose installment_config has no entry for the payment method never takes installments, whatever this flag says.

On update, each key is merged independently: pass an empty array or omit card_brands to clear the brand override, and pass installments_enabled: null to return it to unset.

Active and inactive connectors

An inactive connector (is_active: false) is skipped by routing evaluation and is rejected as a routing profile's default connector by PATCH /routing/profiles/:id/default-connector. Deactivating is the safe way to take a credential set out of rotation without deleting it.

When Tokeflow takes a payment provider out of service, its connectors can still be renamed, have their credentials rotated, and be turned off — but a connector that is off cannot be turned back on (400) while the provider is inactive.

Refused credentials

If a provider starts refusing a connector's API credentials — a key that was revoked, rotated or restricted on the provider's side — Tokeflow confirms the refusal against the provider before acting on it. Once confirmed, subscription renewals routed to that connector are put on a billing hold instead of being declined and dunned. Save new credentials with PATCH and the hold is released; changing only the webhook_secret does not release it.

Creating or updating a routing profile does not currently validate is_active — a profile can end up with an inactive default connector. Charges routed to that profile then fail at resolution time. When you deactivate a connector, repoint any profile that uses it as a default.


Endpoints

All connector endpoints are scoped under the merchant path. With an Organization key, merchant_id selects the target merchant; with a Merchant key, it must be the key's own merchant.

POST/api/v1/merchants/:merchant_id/connectors

OrgMerchant

Auth: Organization key or Merchant key (matching merchant_id in the path). Scope: connectors:write.

Registers a PSP credential set for the merchant. Credentials are validated against the provider and stored encrypted. Use GET /payment-providers to list the providers available to connect and the auth methods each one supports.

Request fields

FieldTypeRequiredDescription
provider_slugstringYesOne of provider_a, provider_b, provider_c, provider_d, provider_e.
namestringYesConnector name, max 100 characters.
is_test_modebooleanYesWhether this connector is in test mode.
credentialsobjectYesProvider-specific credentials. See The credentials object.
auth_methodstringYesOne of api_key, oauth2. Check GET /payment-providers for the methods each provider supports.
country_codestringNoISO 3166-1 alpha-2 country code. Omit for non-country-specific providers.
is_activebooleanNoWhether the connector is active on creation. Defaults to true.
webhook_secretstringNoPSP webhook signing secret for verifying inbound webhooks. Format depends on the provider — Provider A uses whsec_…; Provider B expects a stringified JSON object {"username":"…","password":"…"} used for HTTP Basic Auth verification; some providers expect the access token you set on the webhook in their dashboard, and some need none at all — see Provider-specific credentials.
configobjectNoOptional non-sensitive per-connector config. See Connector config.

The credentials object

The shape of credentials depends on the connected provider. Some providers take a single API key; others take an access token plus a country, or an OAuth client_id/client_secret pair. Send exactly the fields your provider requires — unknown keys are refused, and Tokeflow encrypts the values at rest and never returns them in full. The key's environment must match is_test_mode: a live key on a test-mode connector (or the reverse) is rejected before anything is stored. The provider slugs and their exact credential requirements are listed for your enabled providers in the Tokeflow Dashboard.

Provider-specific credentials

The exact credentials fields, the webhook_secret format and any extra payer data a provider needs are shown for your enabled providers in the Tokeflow Dashboard, and the Tokeflow team can confirm them for a provider you are about to enable. Three patterns cover the catalog:

Patterncredentialswebhook_secret
Single API key{ "api_key": "…" } — a test-mode key on a test connector, a live key otherwise.The signing secret or the access token you configure on the provider's webhook; Tokeflow verifies each delivery against it.
Secret key that also signs webhooks{ "secret_key": "…", "public_key": "…" } — public_key optional.Not used. Tokeflow verifies deliveries with credentials.secret_key, has_webhook_secret reports true, and rotating the key rotates the signature check with it.
Access token, or OAuth pair, plus country{ "access_token": "…", "country": "…" } or { "client_id": "…", "client_secret": "…", "country": "…" }.Provider-specific; see the Dashboard.

Whatever the pattern, register the connector's webhook_url in the provider's own dashboard, and send payer_ip and a complete customer on card charges for providers that require them — see Supported providers.

Example request

curl -X POST https://api.tokeflow.com/api/v1/merchants/mrc_123/connectors \
  -H "Authorization: Bearer sk_live_org_…" \
  -H "Content-Type: application/json" \
  -d '{
    "provider_slug": "provider_a",
    "name": "Provider A BRL",
    "country_code": "BR",
    "is_test_mode": false,
    "auth_method": "api_key",
    "credentials": { "api_key": "sk_live_provider_key" },
    "webhook_secret": "whsec_9c41f2ab…",
    "config": { "card_brands": ["visa", "mastercard"] }
  }'

Example response — 201 Created

{
  "id": "conn_9f2b71",
  "merchant_id": "mrc_123",
  "provider_slug": "provider_a",
  "payment_provider_id": "pp_1a2b3c",
  "name": "Provider A BRL",
  "country_code": "BR",
  "auth_method": "api_key",
  "is_test_mode": false,
  "is_active": true,
  "created_at": "2026-01-15T12:30:00Z",
  "webhook_url": "https://api.tokeflow.com/webhooks/connectors/conn_9f2b71?token=whsec_…",
  "has_webhook_secret": true,
  "config": { "card_brands": ["visa", "mastercard"] }
}

Finish the job in the provider's dashboard. Copy the returned webhook_url into your PSP's webhook settings, and set webhook_secret here to the signing secret the provider gives you — that is how Tokeflow verifies that inbound provider events are genuine.

Handle webhook_url as a secret

The returned webhook_url authenticates the provider's callbacks with a token embedded in its query string. Anyone holding that URL can post events to your connector, so give it the same handling as an API key:

  • Paste it only into the provider's own webhook configuration, over HTTPS.
  • Never put it in a ticket, a chat message, a screenshot, a log line, or a client-side bundle.
  • If it leaks, rotate it by re-registering the connector, then update the URL in the provider's dashboard.

GET/api/v1/merchants/:merchant_id/connectors

OrgMerchant

Auth: Organization key or Merchant key (matching merchant_id in the path). Scope: connectors:read.

Returns a paginated list of the merchant's payment provider connectors.

Query parameters

FieldTypeRequiredDescription
pagenumberNoPage number, 1-indexed (default 1, min 1).
limitnumberNoItems per page (default 20, min 1, max 100).

Example request

curl -G https://api.tokeflow.com/api/v1/merchants/mrc_123/connectors \
  -H "Authorization: Bearer sk_live_org_…" \
  --data-urlencode "page=1" \
  --data-urlencode "limit=20"

Example response — 200 OK

{
  "data": [
    {
      "id": "conn_9f2b71",
      "merchant_id": "mrc_123",
      "provider_slug": "provider_a",
      "payment_provider_id": "pp_1a2b3c",
      "name": "Provider A BRL",
      "country_code": "BR",
      "auth_method": "api_key",
      "is_test_mode": false,
      "is_active": true,
      "created_at": "2026-01-15T12:30:00Z",
      "webhook_url": "https://api.tokeflow.com/webhooks/connectors/conn_9f2b71?token=whsec_…",
      "has_webhook_secret": true,
      "config": { "card_brands": ["visa", "mastercard"] }
    },
    {
      "id": "conn_4d8ea0",
      "merchant_id": "mrc_123",
      "provider_slug": "provider_b",
      "name": "Provider B sandbox",
      "country_code": "BR",
      "auth_method": "api_key",
      "is_test_mode": true,
      "is_active": true,
      "created_at": "2026-01-10T09:15:00Z",
      "webhook_url": "https://api.tokeflow.com/webhooks/connectors/conn_4d8ea0?token=whsec_…",
      "has_webhook_secret": true,
      "config": null
    }
  ],
  "meta": {
    "page": 1,
    "limit": 20,
    "total": 2,
    "total_pages": 1,
    "has_next": false,
    "has_prev": false
  }
}

GET/api/v1/merchants/:merchant_id/connectors/:connector_id

OrgMerchant

Auth: Organization key or Merchant key (matching merchant_id in the path). Scope: connectors:read.

Retrieves a single connector. Returns the connector object.

Example request

curl https://api.tokeflow.com/api/v1/merchants/mrc_123/connectors/conn_9f2b71 \
  -H "Authorization: Bearer sk_live_org_…"

Example response — 200 OK

{
  "id": "conn_9f2b71",
  "merchant_id": "mrc_123",
  "provider_slug": "provider_a",
  "payment_provider_id": "pp_1a2b3c",
  "name": "Provider A BRL",
  "country_code": "BR",
  "auth_method": "api_key",
  "is_test_mode": false,
  "is_active": true,
  "created_at": "2026-01-15T12:30:00Z",
  "webhook_url": "https://api.tokeflow.com/webhooks/connectors/conn_9f2b71?token=whsec_…",
  "has_webhook_secret": true,
  "config": { "card_brands": ["visa", "mastercard"] }
}

A 404 (not_found_error) is returned if the connector does not exist or does not belong to the merchant.


PATCH/api/v1/merchants/:merchant_id/connectors/:connector_id

OrgMerchant

Auth: Organization key or Merchant key (matching merchant_id in the path). Scope: connectors:write.

Partially updates a connector — credentials, label, or enabled state. Only the fields below can be changed; all are optional.

Request fields

FieldTypeRequiredDescription
namestringNoConnector name, max 100 characters.
is_activebooleanNoWhether the connector is active. See Active and inactive connectors before deactivating. Re-activating is refused with 400 while the connector's payment provider is inactive.
credentialsobjectNoUpdated provider credentials — validated and re-encrypted. Same shape rules as on create. New credentials also release any billing hold placed because the provider refused the previous ones.
webhook_secretstringNoPSP webhook signing secret. Same provider-specific format as on create.
configobjectNoPer-connector config, merged key by key. Pass an empty card_brands array, or omit card_brands, to clear the brand override; pass installments_enabled: null to return installments to unset. See Connector config.

Example request — rotate credentials and rename

curl -X PATCH https://api.tokeflow.com/api/v1/merchants/mrc_123/connectors/conn_9f2b71 \
  -H "Authorization: Bearer sk_live_org_…" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Provider A BRL prod",
    "credentials": { "api_key": "sk_live_provider_key_rotated" }
  }'

Example response — 200 OK

{
  "id": "conn_9f2b71",
  "merchant_id": "mrc_123",
  "provider_slug": "provider_a",
  "payment_provider_id": "pp_1a2b3c",
  "name": "Provider A BRL prod",
  "country_code": "BR",
  "auth_method": "api_key",
  "is_test_mode": false,
  "is_active": true,
  "created_at": "2026-01-15T12:30:00Z",
  "webhook_url": "https://api.tokeflow.com/webhooks/connectors/conn_9f2b71?token=whsec_…",
  "has_webhook_secret": true,
  "config": { "card_brands": ["visa", "mastercard"] }
}

A 404 (not_found_error) is returned if the connector does not exist or does not belong to the merchant.


DELETE/api/v1/merchants/:merchant_id/connectors/:connector_id

OrgMerchant

Auth: Organization key or Merchant key (matching merchant_id in the path). Scope: connectors:write.

Removes the connector. It must not be referenced by any routing node or be a routing profile's default connector — repoint those first.

Example request

curl -X DELETE https://api.tokeflow.com/api/v1/merchants/mrc_123/connectors/conn_4d8ea0 \
  -H "Authorization: Bearer sk_live_org_…"

Response codes

CodeWhen
204 No ContentThe connector was deleted. No response body.
400 Bad RequestThe connector is still referenced by a routing node or is a profile's default connector.
404 Not FoundConnector not found.

If you only want to stop routing charges through a credential set, deactivate it with PATCH (is_active: false) instead of deleting — the connector and its history stay intact, and you can re-enable it later.


Errors

Every error uses the standard envelope. The most common cases for this resource:

HTTPtypeTypical cause
400validation_errorInvalid or incomplete credentials for the provider, or a delete blocked because the connector is still referenced by routing.
401authentication_errorMissing or invalid API key.
403authorization_errorKey lacks the required scope, or a Merchant key targeting another merchant's path.
404not_found_errorConnector (or merchant) not found or not owned by the caller.
429rate_limit_errorRate limit exceeded — back off exponentially.

See Errors for the full envelope and type catalog.

On this page