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, checkout, provider_d).
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 a webhook signing secret is configured for verifying inbound provider webhooks.
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. It currently supports one:

FieldTypeDescription
card_brandsarrayNarrows the card brands surfaced to the Bridge SDK for this connector. When config is null (no overrides), the SDK falls back to the provider's default_supported_card_brands.

On update, pass an empty array or omit card_brands to clear the override and fall back to the PSP default.

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.

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, checkout, provider_d.
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.
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 the fields your provider requires — Tokeflow encrypts them at rest and never returns them in full. The provider slugs and their exact credential requirements are listed for your enabled providers in the Tokeflow Dashboard.

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 response201 Created

{
  "id": "conn_9f2b71",
  "merchant_id": "mrc_123",
  "provider_slug": "provider_a",
  "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 response200 OK

{
  "data": [
    {
      "id": "conn_9f2b71",
      "merchant_id": "mrc_123",
      "provider_slug": "provider_a",
      "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 response200 OK

{
  "id": "conn_9f2b71",
  "merchant_id": "mrc_123",
  "provider_slug": "provider_a",
  "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.
credentialsobjectNoUpdated provider credentials — validated and re-encrypted. Same shape rules as on create.
webhook_secretstringNoPSP webhook signing secret. Same provider-specific format as on create.
configobjectNoPer-connector config. Pass an empty card_brands array, or omit card_brands, to clear the override and fall back to the PSP default.

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 response200 OK

{
  "id": "conn_9f2b71",
  "merchant_id": "mrc_123",
  "provider_slug": "provider_a",
  "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