Skip to Content
Documentation
Technical ReferenceREST API

Gateway selection

Keep a gateway out of the default pool with Use by default, give collections and products their own gateway lists, and see how FloPay works out the gateways a checkout, a saved card and a renewal may use, with the refused-checkout error, the save warnings and the renewal failure reason.

Gateway selection

Gateway selection decides which of your gateways a product may be paid on. Each gateway has a Use by default setting that puts it in your client default pool, and each collection and product can carry its own gateway list. FloPay works out the gateways a product may use from those settings, and limits every checkout to the gateways all of its products allow. Routing then chooses between the gateways that are left, exactly as before. See Allowed gateway set in the routing guide.

Nothing changes until you change a setting: Use by default is on for every existing gateway, and no collection or product has a list until you save one.

Endpoints

These fields are on the merchant endpoints you already use, with the same authentication:

ResourceWriteReadFields
GatewayPATCH /v1/settings/gateways/{id}GET /v1/settings/gateways/{id}, GET /v1/settings/gatewaysuseByDefault
CollectionPOST /v1/collections, PATCH /v1/collections/{uuid}GET /v1/collections/{uuid}, GET /v1/collectionsgatewayIds, effectiveGatewayIds, decidedBy
ProductPOST /v1/products, PATCH /v1/products/{uuid}GET /v1/products/{uuid}, GET /v1/productsgatewayIds, effectiveGatewayIds, decidedBy

Writes that change a selection also return gatewaySelectionWarnings (see Save warnings). Through FloPay MCP, the same changes need explicit confirmation as high-risk actions: see Gateway selection changes.

Use by default

Use by default is a setting on each gateway, useByDefault in the gateway settings API. It decides whether the gateway is in your client default pool: the gateways that every collection and product without its own gateway list may use. The default pool holds your gateways in the environment of the request that have Use by default on.

  • Existing gateways: the setting is on for every existing gateway. A gateway that never had it set reads true.
  • Turning it off: send "useByDefault": false on PATCH /v1/settings/gateways/{id} to keep the gateway out of the default pool. The gateway stays active, and a collection or product can still list it.
  • Leaving it alone: omitting the field from an update leaves the stored value unchanged.
  • Reads: GET /v1/settings/gateways/{id} and each item of GET /v1/settings/gateways include useByDefault.
  • Warnings: an update that sends useByDefault returns gatewaySelectionWarnings. An update that does not send it carries no warnings for it.

Gateway lists

Collections and products take an optional gatewayIds list of gateway ids on create (POST /v1/collections, POST /v1/products) and on update (PATCH /v1/collections/{uuid}, PATCH /v1/products/{uuid}).

  • Set: send an array of gateway ids to set the list. The products it applies to may then use only those gateways.
  • Replace: a list replaces the set the collection or product would otherwise inherit. It never adds to it: a product that lists one gateway may use that gateway only, even when its collections or the default pool allow more. An update that sends a list replaces the stored list as a whole.
  • Clear: send [] or null to clear the list, so the collection or product inherits again.
  • Leaving it alone: omitting gatewayIds from an update leaves the stored list unchanged.
  • Reads: a collection or product with no list of its own reads back "gatewayIds": null.
curl -X PATCH https://api.flopay.com/v1/products/$PRODUCT_UUID \
  -H "Authorization: Bearer $FLOPAY_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "gatewayIds": ["5b0f9d3e-2c4a-4e8b-9f1d-7a6c3e2b1d40"]
  }'

Inheritance and intersection

Reads of a collection or product return its own list in gatewayIds, the gateways it may actually use in effectiveGatewayIds, and the level that decided them in decidedBy.

For a product, FloPay uses the product's own list, else the intersection of the lists set on its collections, else the client default pool.

decidedByWheneffectiveGatewayIds
productThe product has its own list.That list.
collectionThe product has no list, and at least one of its collections has one.The intersection of its collections' lists.
clientNeither the product nor its collections have a list.The client default pool.

For a collection, effectiveGatewayIds is its own list, else the client default pool, and decidedBy is collection or client.

An intersection can be the empty set. A product in two collections whose lists share no gateway may use no gateway at all, and a checkout for it is refused (see Refused checkout). The save warnings report that product when you save the change.

{
  "gatewayIds": null,
  "effectiveGatewayIds": ["5b0f9d3e-2c4a-4e8b-9f1d-7a6c3e2b1d40"],
  "decidedBy": "collection"
}

A checkout applies a second intersection, across its products: see The checkout allowed set.

Invalid gateway lists

A list may name only your own gateways, in the same environment as the request. A list that names a gateway belonging to another merchant, a gateway in the other environment, or an unknown id gets a 400 whose message names each rejected gateway, and nothing is saved.

The checkout allowed set

When a checkout's products are attached, FloPay works out its allowed set: the intersection of the effective sets of the checkout's catalog products. Lines without a catalog product are ignored, and a checkout with no catalog product uses the client default pool. A checkout created without its products works the set out when the products are attached.

The checkout's deciding level is the most restrictive level that contributed: product, else collection, else client.

The set and its level are stored on the checkout and kept for the life of the checkout. They are never recomputed: later edits to products, collections or Use by default do not change a checkout that already exists.

The allowed set filters routing before priority, traffic split and failover: FloPay first removes every gateway outside the set, then applies the usual eligibility rules, the country and currency ranking, your preference order, the new-card traffic split and failover to the gateways that are left. Routing inside the set is unchanged, and an empty set allows no gateway. The same set limits the gateways advertised for PayPal and wallets, so a provider with no allowed gateway is not offered.

Refused checkout

When a product or collection list decided the allowed set and no gateway in it can serve the checkout's currency and country, FloPay refuses the checkout with HTTP 400 and type no_common_gateway. The response can also carry conflictingProducts: the products whose lists leave no common gateway, each with its id and name. The field is additive and optional, so read it when it is present.

The refusal happens when the products are attached, before any payment attempt, so nothing is charged. Checkout reads can carry the same type and conflictingProducts in autoProcessingError.

A set that the client default pool decided keeps the usual result when no gateway is eligible. A saved-card (Auto) checkout or a merchant-initiated payment is never refused this way: it still records the set and the level.

To fix a refusal, add a gateway that can serve the currency and country to the conflicting lists, clear one of the lists, or sell the products in separate checkouts.

Saved cards and upsells

The allowed set also decides which saved cards are offered and where they are charged. A portable saved card, one FloPay can prepare on another of your gateway accounts, is charged on an allowed gateway even when it was first saved on a gateway outside the set. A saved card that can be charged only on an account outside the allowed set is not offered. An upsell follows the same rule and is charged only on an allowed gateway.

Save warnings

Writes that change a gateway selection return gatewaySelectionWarnings next to the saved resource, in the same style as the statement descriptor save warnings. FloPay works the warnings out before it saves, and they never block the save: the change is saved either way.

  • Collection and product create and update responses always carry the array.
  • PATCH /v1/settings/gateways/{id} carries it only when the request sends useByDefault.
  • POST /v1/settings/gateways/{id}/deactivate carries it too, and the deactivation is never blocked.

The array is an empty array ([]) when the request changes no gateway selection, when nothing is worth warning about, or when the check could not run. Each entry has a kind:

kindWhat it meansFields
product_without_gatewayA product is left with no allowed gateway.productId, productName
subscription_impactActive subscriptions whose next renewal moves to another gateway, counted in rerouted, or can't be charged on any allowed gateway, counted in stranded.rerouted, stranded
currency_without_off_session_gatewayA currency that active subscriptions use is left with no allowed off-session gateway.currency
sole_gateway_deactivatedA deactivated gateway is the only gateway that a collection or product lists.gatewayId, gatewayName, subject (collection or product), subjectId, subjectName

A stranded subscription is not charged at its next renewal: see Renewal failure reason.

Deciding level on payments

FloPay records the checkout's deciding level, product, collection or client, on the checkout, and copies it onto each payment and each payment attempt made in that checkout, including failover and capture attempts. It tells you which level limited the gateways a payment could use. A checkout created before the release has no stored set and routes as it did before, and its payments and attempts record null.

Renewal failure reason

Renewals and dunning retries follow the product's current selection, not a snapshot taken at checkout. FloPay works out the product's effective set again each time a renewal runs, so a change you save applies from the next renewal.

When no allowed gateway can charge the subscription's card, nothing is attempted: no charge is sent to any gateway, and FloPay records the failure reason no_allowed_gateway. The subscription then enters normal dunning. Its card-update link lets the customer put a new card on an allowed gateway, so a later retry can charge it.

In the recovery read (SubscriptionRecovery_list in FloPay MCP), such a round has preDispatchCause no_allowed_gateway, and recoveryGuidance points to update_payment_method. See Renewals and gateway selection in the subscriptions guide.

One client, one merchant entity

One Flo client is one merchant entity. The default pool, the gateway lists and the allowed set never reach across clients: a list can name only the client's own gateways, and a payment never moves to another client's gateway. A business that runs several merchant entities, each with its own gateway accounts, uses one Flo client for each.

On this page