# FlowPayra Lite documentation Source: https://docs.flowpayra.com/en/ --- # Introduction URL: https://docs.flowpayra.com/en/start/introduction/ FlowPayra Lite is a self-hosted, self-custodial crypto payment system that a merchant deploys on its own infrastructure. One deployment serves one business. Payers pay from their own wallets at the checkout, and a smart contract moves the funds straight to the addresses the merchant registered, within the same on-chain transaction. The system never holds the funds. ## Who it is for - Merchants who want to receive crypto directly at their own wallet addresses, without a third-party custodian. - Businesses that split a single payment between several recipients (platform, vendor, sales channel and so on). - Teams able to run one server process and a PostgreSQL database. For multi-merchant or custodial requirements, see the [Enterprise edition](#enterprise-edition). ## What it does | Feature | Description | |---|---| | One-time payments | The business system creates an order through the API, or an admin creates a payment link in the console; the payer picks a token and a network at the checkout and pays | | Subscriptions | The payer approves a capped allowance once; each period is then charged automatically according to the plan. Trials and an immediate first charge are supported | | Atomic splits | An order, or each subscription charge, can be split by ratio or by "fixed amount + ratio" between up to 10 payees, in the same on-chain transaction | | Refunds | Full or partial refunds of a confirmed payment are started in the console, sent from the receiving wallet back to the payer address, and booked once verified on chain | | Gas sponsorship | Per chain, an admin chooses whether payers pay the network fee or the system's hot wallet sponsors it; with sponsorship the payer only signs | | Risk address screening | Optional payer screening against the merchant list, imported files, URL feeds, the OFAC SDN list and third-party risk providers; payee addresses are checked at registration and daily afterwards | | Console | Orders, subscriptions, refunds, payees and split rules, chains and tokens, gas and hot wallet, risk controls, alerts, reports, team and audit log | | API and webhooks | A REST business API (described in OpenAPI), HMAC-signed webhooks, an event stream, and a separate test mode (Sandbox) | The checkout and the console are available in Simplified Chinese and English, in light and dark themes. ## The self-custody model - **Funds only move through contracts.** A payment calls the merchant's own payment contracts (the merchant contracts), which distribute the tokens to the payee addresses within that transaction. Neither the database nor the server touches the money. - **None of the keys the system holds can move payer or merchant funds.** - Quote signer key: signs every quote and subscription terms; its address is embedded in the merchant contracts. If it leaks, the damage is limited to forged quotes and subscription cancellations; it cannot transfer funds. - Hot wallet: holds a small amount of native coin, used to sponsor gas and to send subscription charges. - Master key: encrypts sensitive settings in the database (RPC URLs, webhook secrets, email addresses and so on) and lives only in the server configuration or environment. - **Refunds do not pass through the system either.** The receiving wallet sends the refund straight back to the payer address; the system verifies and records it. The boundaries of each key and the contract security design are described in [Security model](/en/security/model/). ## Components FlowPayra Lite is a single binary, `flowpayra-lite`, plus PostgreSQL (15 or later). The checkout and console front ends, the contract code and the database migrations are compiled into the binary. | Component | Role | |---|---| | Checkout | The pages payers use: `/pay/{orderId}` (one-time payment), `/pay/sub/{id}` (subscription), `/my/subscriptions` (My subscriptions), `/help` (payment help) | | API | The business API (`/v1/…`), the checkout API and the console API | | Indexer | One per chain; reads the merchant contracts' events, books payments once confirmed and handles chain reorganisations | | Keeper | Sends each subscription charge and on-chain cancellation according to the plan | | Relayer | With gas sponsorship, submits the transactions payers have signed, from the hot wallet | | Notifier | Delivers webhooks, emails and alerts | | Console | Served at `/admin/`; can be bound to its own listener | | PostgreSQL | Stores orders, subscriptions, configuration and events | By default every role runs in one process; multi-instance deployments can split roles, see [Deployment](/en/start/deployment/). ## Supported networks and tokens | Category | Scope | |---|---| | EVM mainnets | Ethereum, BNB Smart Chain, Polygon, Avalanche C-Chain, Arbitrum One, OP Mainnet, Base, X Layer, Linea, Scroll, Gnosis, Celo, Arc, Robinhood Chain | | Other networks | TRON, Solana | | Testnets | The public testnets of the networks above (Sepolia, Base Sepolia, TRON Nile, Solana Devnet and others) | | Custom networks | Admins can add other EVM-compatible networks from the console | | Tokens | Default stablecoins USDT, USDC, DAI, PYUSD and EURC; each network's native coin; custom tokens listed by an admin | The full list, confirmations and token requirements are in [Networks and tokens](/en/checkout/networks-and-tokens/); wallet coverage is in [Wallet support](/en/checkout/wallets/). :::note The contracts and the Solana program have been reviewed internally. The shared contracts are deployed on six EVM mainnets (Ethereum, BNB Smart Chain, Base, X Layer, Arc and Robinhood Chain) and on the Sepolia, Arc testnet, TRON Nile and Solana Devnet test networks. The reviews and the addresses are listed in [Security reviews](/en/security/audits/). ::: ## Enterprise edition FlowPayra Lite targets the single-merchant, self-custodial case. Multi-merchant and custodial scenarios are served by the [FlowPayra Enterprise edition](https://enterprise.flowpayra.com). ## Next steps - [Quickstart](/en/start/quickstart/): complete a first payment locally or on a testnet. - [Deployment](/en/start/deployment/): Docker deployment, configuration, backups and upgrades. - [Integration guide](/en/developers/integration/): from creating an order to receiving webhooks. --- # Quickstart URL: https://docs.flowpayra.com/en/start/quickstart/ This page offers two paths: - **Path A: the local devnet.** One command starts local chains, the database and seed data. Chains, tokens, payees and a default split rule are ready, so this is the fastest way to see the whole flow. - **Path B: a public testnet.** Start the system with Docker and configure the chain, token, quote signer key, merchant contracts, payee and split rule in the console, step by step, exactly as for a live deployment. Neither path involves real funds. ## Path A: the local devnet ### What you need Run from the source repository, with these tools installed: | Tool | Used for | |---|---| | Rust (cargo) | Building and running `flowpayra-lite` | | Foundry (`anvil`, `forge`, `cast`) | The local EVM chains and contract deployment | | Docker (Compose v2) | PostgreSQL, Toxiproxy, Mailpit | | `jq`, `curl` | Used by the start script | | Node 22, Solana CLI (optional) | Only for the local TRON and Solana chains; without them those two families are skipped and the EVM part is unaffected | Set `DEVNET_FAMILIES=evm` to start the EVM chains only. ### 1. Start the system ```sh make devnet # start the chains and services, deploy contracts, seed data; prints the live and test API keys source devnet/.state/server.env # devnet database, master key, quote signer key and hot wallet (public test keys) cargo run -p flowpay-server -- serve # the server: http://localhost:8080 ``` When `make devnet` finishes, the following is in place: - Two local EVM chains: Devnet L1 (chain ID 31337) and Devnet L2 (chain ID 31338, set to gas sponsorship); local TRON and Solana chains too when their tools are installed. - The merchant contracts and mock tokens (USDC, USDT, DAI and others) on each chain. - Three payees and a default split rule. - A live and a test API key, saved in `devnet/.state/api-key` and `devnet/.state/test-api-key`. :::caution Every key the devnet uses is a public test key. Use them on the local environment only. ::: ### 2. Create an admin and sign in to the console In another terminal (after `source devnet/.state/server.env` there as well), create the first admin. The password needs at least 12 characters: ```sh FLOWPAY_ADMIN_PASSWORD='…' cargo run -p flowpay-server -- admin create --username ops --role admin ``` Open `http://localhost:8080/admin/` and sign in with the username and password. The first sign-in sets up a second factor: a passkey, a security key or Google Authenticator. The system then generates 10 single-use recovery codes; store them safely. :::note Locally, open the console at `http://localhost:8080`, not at an IP address: browsers do not accept an IP address as a passkey site. ::: ### 3. Review the seeded configuration After signing in, the seed data is visible on these pages and works without changes: - **Chains & tokens**: the local chains that were started and their tokens. - **Payees & rules**: the registered payees, the address checks per chain, and the default split rule. ### 4. Create a payment link On the **Orders** page choose **New payment**, enter the amount and currency, and choose **Create payment link**. An order number is generated when left blank. An order can also be created through the API; the `checkout_url` in the response is the payment link: ```sh curl -X POST localhost:8080/v1/orders \ -H "Authorization: Bearer $(cat devnet/.state/api-key)" \ -H "Idempotency-Key: o-1" \ -H 'content-type: application/json' \ -d '{"merchant_order_no":"A-1","amount":"100.00","currency":"USD"}' ``` ### 5. Pay 1. Prepare a browser wallet: import the devnet payer account (account 1 of the standard Anvil mnemonic, funded with every mock token and test ETH; the account list is in `devnet/README.md` in the repository) and add a custom network: RPC `http://127.0.0.1:8545`, chain ID `31337` (Devnet L1), or RPC `http://127.0.0.1:8546`, chain ID `31338` (Devnet L2). 2. Open the payment link, choose a token and a network, press the pay button and connect the wallet. 3. Confirm in the wallet. On Devnet L2, tokens marked **Gas-free** only need a signature; the system's hot wallet sends the transaction. ### 6. See it confirmed Once the payment reaches the required confirmations, the checkout shows **Payment complete**, the order's status in the console's **Orders** page becomes **Confirmed**, and the business system receives the `order.paid` webhook (when an endpoint is configured). When finished, `make devnet-down` stops everything and discards the data. ## Path B: a public testnet The steps below use Sepolia. Testnets accept **test mode** orders only, so switch the console to **Test** before creating the payment link, or use a test API key (`fpk_test_…`). ### What you need - Docker (Compose v2) and the source repository. - Foundry's `cast`, to create the keystore file of the quote signer key. - A Sepolia RPC URL (https). - A browser wallet holding a little Sepolia ETH, to deploy the merchant contracts; and a wallet holding test tokens to pay with (for example Circle's test USDC on Sepolia, available from Circle's faucet). ### 1. Start the system ```sh docker build -t flowpayra-lite . docker run --rm flowpayra-lite keygen # generate the master key (32 bytes, hex) cp deploy/.env.example deploy/.env # fill in FLOWPAY_SECRETS__MASTER_KEY, FLOWPAY_SIGNER_PASSWORD, FLOWPAY_PUBLIC_URL cast wallet new deploy/keys quote-signer.json # new quote signer keystore; its password is FLOWPAY_SIGNER_PASSWORD docker compose --env-file deploy/.env up -d --build ``` For a trial on one machine, leave `FLOWPAY_PUBLIC_URL` at `http://localhost:8080`. Each setting is explained in [Deployment](/en/start/deployment/). ### 2. Create an admin and sign in ```sh docker compose --env-file deploy/.env exec -e FLOWPAY_ADMIN_PASSWORD='…' app flowpayra-lite admin create --username alice ``` Open `http://localhost:8080/admin/`, sign in, and set up a second factor when prompted. ### 3. Quote signer key The configured keystore is imported on the first start and becomes the active quote signer key; its address is shown on the **Quote signer keys** page. Alternatively, choose **Generate a key** on that page to have the server generate one. The quote signer key's address is embedded in the merchant contracts, so the key must exist before the contracts are deployed. ### 4. Add a chain In **Chains & tokens** choose **Add chain**, pick the chain family and enter the RPC URL. The console probes the node first and fills in the chain ID, name, native coin, network type, block time, confirmations and block explorer. Sepolia is a built-in network and is marked as a testnet automatically. A new chain is added disabled. ### 5. Deploy the merchant contracts Open the chain's **Contracts** checklist. The deployment proxy, Permit2, the FlowPay factory and the implementation contracts are shared per network, and the checklist only shows their status; the merchant deploys only its own Router and Subscriptions contracts: 1. Connect a browser wallet and send the deployment transactions the checklist asks for. The deployer has no rights over the contracts. 2. When every item is in place, choose **Verify and record** (step-up verification required). The system compares each contract's on-chain bytecode with the released version and records the addresses. 3. Enable the chain once verification has passed. The command-line equivalent and notes for other networks are in [Chains and contracts](/en/console/chains-and-contracts/). ### 6. List a token In the chain's token list choose **Add token**, enter the token contract address and choose **Probe and add**. The system reads the token's symbol, decimals and authorization capabilities; fee-on-transfer and rebasing tokens are refused. A probed token is added unlisted; list it after review. ### 7. Register a payee and a default split rule 1. In **Payees & rules** choose **Register payee** and enter a name and a receiving address. The address takes effect once it passes the blocklist checks. 2. Under **Split rules**, create a **New split rule**, add payees and set their ratios (ratios must total 100%, and the first member is a ratio member: the primary payee), then **Make default**. With a single recipient, a rule holding that one payee at 100% is enough. See [Payees and split rules](/en/console/payees-and-splits/). ### 8. Create a payment link and pay 1. Switch the mode in the top bar from **Live** to **Test**. 2. On the **Orders** page choose **New payment**, enter the amount and **Create payment link**. The page notes "Test mode: this link accepts testnet payments only." 3. Open the link with the wallet holding test tokens, choose a token and network, and pay. The checkout shows a **Test mode** mark on test orders. 4. Once the payment reaches the required confirmations, the checkout shows **Payment complete** and the order's status in the console (in test mode) becomes **Confirmed**. ## Next steps - [Deployment](/en/start/deployment/): HTTPS, keys, backups and upgrades. - [Payment flow](/en/checkout/payment-flow/): every step the payer sees at the checkout. - [Integration guide](/en/developers/integration/) and [Test mode (Sandbox)](/en/developers/sandbox/): connecting a business system. - [Gas and hot wallets](/en/console/gas-and-hot-wallets/): turning on gas sponsorship. --- # Deployment URL: https://docs.flowpayra.com/en/start/deployment/ A production deployment of FlowPayra Lite is the single binary `flowpayra-lite` plus PostgreSQL 15 or later. The checkout and console front ends, the contract code and the database migrations are compiled into the binary, so building the image needs neither Node nor Foundry. ## Checklist 1. Build the image; generate the master key and the quote signer key. 2. Fill in `deploy/.env` and the configuration file, and start the services. 3. Put an HTTPS reverse proxy in front and set `public_url`. 4. Create the first admin and sign in to the console. 5. Per chain, deploy the merchant contracts and list tokens; configure the hot wallet if needed. 6. Set up backups, health checks and monitoring. ## Docker image ```sh docker build -t flowpayra-lite . # multi-stage build; the runtime image is based on debian:bookworm-slim docker run --rm flowpayra-lite keygen # generate the master key (32 bytes, hex) ``` - The container runs as the non-root user `flowpay` (uid 10001) and listens on `0.0.0.0:8080`; its `HEALTHCHECK` probes `/healthz`. - The configuration file is `/etc/flowpay/config.toml` (named by the `FLOWPAY_CONFIG` environment variable; the file may be absent). - Any setting can be overridden by a `FLOWPAY_*` environment variable, nested keys joined with `__`, for example `FLOWPAY_DATABASE__URL`. - Keystore files are mounted read-only at `/etc/flowpay/keys`; their passwords are read from environment variables. - The default command is `serve`, which runs every role. ## docker compose The repository's `docker-compose.yml` contains the app and `postgres:16`: the database uses the `pgdata` volume, is reachable only on the compose network, and must be healthy before the app starts. `deploy/config.docker.toml` is mounted as `/etc/flowpay/config.toml`; `deploy/.env` and the files in `deploy/keys/` stay out of version control. ```sh cp deploy/.env.example deploy/.env # fill in the variables below cast wallet new deploy/keys quote-signer.json # new quote signer keystore (or: cast wallet import … -k deploy/keys -i for an existing key) docker compose --env-file deploy/.env up -d --build ``` Variables in `deploy/.env`: | Variable | Description | |---|---| | `FLOWPAY_SECRETS__MASTER_KEY` | The master key; required | | `FLOWPAY_SIGNER_PASSWORD` | Password of `deploy/keys/quote-signer.json` | | `FLOWPAY_RELAYER_PASSWORD` | Password of `deploy/keys/hot-wallet.json`, when the hot wallet is enabled | | `FLOWPAY_PUBLIC_URL` | The HTTPS address payers and admins reach | | `FLOWPAY_HTTP_PORT` | Host port the app is published on; default 8080 | | `FLOWPAY_KEYS_DIR` | Directory holding the keystores; default `./deploy/keys` | | `POSTGRES_PASSWORD` | Password of the bundled database | | `FLOWPAY_IMAGE` | Set it to use a registry image, and start with `--no-build` | ## Configuration essentials Every option is listed in `config.example.toml` in the repository. The following matter in production. ### Addresses ```toml listen = "0.0.0.0:8080" public_url = "https://pay.example.com" # trusted_proxies = ["127.0.0.1"] ``` - `public_url` is the address payers reach this deployment at. Checkout links are built from it, and it is the console's passkey (WebAuthn) site. Production needs an HTTPS domain. - `trusted_proxies` lists the reverse proxies in front of the server, as exact IP addresses. Their `X-Forwarded-For` gives the client IP used for the help form's rate limits and the audit log; leave it empty when clients connect directly. ### A separate listener for the console ```toml [admin] # listen = "10.0.0.5:8081" # public_url = "https://admin.example.internal" ``` - By default the console shares the public listener. With `listen` set, the console (`/admin` and `/admin/api`) is served only on that address, for example an internal interface or a separate port; the public listener answers 404 for `/admin`. The console listener serves only the console and `/healthz`. - Set `admin.public_url` when admins open the console at an address other than `public_url`. It is the console's passkey site and the link in admin notification emails. :::caution Passkeys are bound to the site's host name. Settle `public_url` or `admin.public_url` before admins enroll passkeys. ::: ### Database ```toml [database] url = "postgres://flowpay:flowpay@127.0.0.1:5432/flowpay" max_connections = 10 migrate_on_start = true ``` `max_connections` is the pool shared by API requests and background queries. Background roles elect a leader with PostgreSQL advisory locks, and each lock sits on a dedicated connection outside the pool: up to 7 per instance, plus 1 per indexed chain. Size PostgreSQL's own `max_connections` for at least instances × (pool size + 7 + chains), with headroom. For example, 2 instances and 3 chains: 2 × (10 + 7 + 3) = 40. ### Master key ```toml [secrets] # master_key = "" # previous_master_keys = [] ``` - The master key is a 32-byte hex key that encrypts every sensitive value in the database: RPC URLs, webhook secrets, email addresses, the stored quote signer keys and credentials. Generate it with `flowpayra-lite secrets keygen` (or `flowpayra-lite keygen`, which prints the key only). - It stays in the configuration or the environment, never in the database. Prefer the environment variable `FLOWPAY_SECRETS__MASTER_KEY`. - Without the master key that data cannot be decrypted. Keep it separately from database backups: pipe it from the configuration straight into a password manager or an encrypted file, never showing it in a terminal, then check the copy with `flowpayra-lite secrets check-backup` (reads the copy from standard input, never prints the key), which opens the encrypted data in the database with it. - `previous_master_keys` is used only while rotating the master key, for decryption. Rotation is done from the console's **Master key** page. ### Quote signer key ```toml [quote_signer] keystore = "/etc/flowpay/keys/quote-signer.json" password_env = "FLOWPAY_SIGNER_PASSWORD" ``` - Production uses an Ethereum JSON keystore, with its password in the named environment variable. - The configured key joins the keyring on the first start (stored in the database, encrypted under the master key) as the active key. Afterwards, take an offline backup with `flowpayra-lite signer export` and keep the backup file and its password apart. - The quote signer key's address is embedded in the merchant contracts. Replacing the key means deploying new merchant contracts for the new key, from the console's **Quote signer keys** page or with `flowpayra-lite signer …`. - Solana chains use a separate ed25519 quote signer key, generated on the **Quote signer keys** page or with `flowpayra-lite signer generate --scheme ed25519`. #### KMS (optional) The quote signer key can also live in AWS KMS or Google Cloud KMS; this is off by default. Enable it and add a connection in the signing backends / KMS section of the console's **Quote signer keys** page, or with the `flowpayra-lite kms …` commands. - AWS KMS: key spec `ECC_SECG_P256K1`; credentials are an access key or the server environment (environment variables, an ECS / EKS task role, an EC2 instance role). - Google Cloud KMS: algorithm `EC_SIGN_SECP256K1_SHA256`; credentials are a service account key file or the metadata server. - Keys in a KMS cannot be exported; their backup is the cloud provider's responsibility. KMS supports secp256k1 keys only (EVM and TRON chains); the hot wallet remains a local key. ### Hot wallet (optional) ```toml [relayer] # keystore = "/etc/flowpay/keys/hot-wallet.json" # password_env = "FLOWPAY_RELAYER_PASSWORD" replace_after_secs = 90 min_balance_wei = "0" ``` The hot wallet sponsors gas and sends subscription charges: configure it, and fund it with a small amount of native coin, when using gas sponsorship or subscriptions. It must differ from the quote signer key and should hold only a small balance. Solana chains have a separate `solana_keystore` option. See [Gas and hot wallets](/en/console/gas-and-hot-wallets/). ### Other settings | Setting | Description | |---|---| | `[orders] default_ttl_secs` | Default order lifetime; 1800 seconds | | `[orders] quote_ttl_secs` | Quote validity; 600 seconds | | `[metrics] token` | Enables `/metrics` when set (see below) | | `[mail] dns_server` | DNS server for the console's sender-domain checks (SPF, DKIM, DMARC) | | `[log] json` | `true` writes one JSON object per line, for log collectors | | `[diag] enabled` | The wallet diagnostic page `/diag/`; keep `false` in production | The WalletConnect projectId is not in the configuration file; it is entered in the console, see [Wallet support](/en/checkout/wallets/). ## Reverse proxy and HTTPS The server speaks plain HTTP. Put a reverse proxy (Caddy, nginx or similar) in front to terminate TLS and forward requests to it. ### What the server needs | Item | Requirement | |---|---| | `public_url` | The HTTPS address of the checkout and the API (`FLOWPAY_PUBLIC_URL` with docker compose). The server builds links from it; it does not read the `Host` or `X-Forwarded-Proto` headers | | `trusted_proxies` | The proxy's IP address as the server sees it. Entries are exact IP addresses, not ranges. Only connections from these addresses have their `X-Forwarded-For` header read, so the proxy must set that header | | Request size | Most requests are limited to 64 KB by the server. The payment help form accepts up to about 16 MB (three screenshots of 5 MB each), and a risk list import in the console up to 24 MB. Caddy sets no limit of its own; with nginx, raise `client_max_body_size` (1 MB by default) accordingly | | Protocol | Ordinary HTTP requests and responses only; the server has no WebSocket endpoints. A request that takes longer than 30 seconds is ended by the server with `408` | | Page rewriting | The content security policy of the HTML pages (checkout, console, payment help and so on) allows scripts from the site itself only (the payment help page also allows the human verification service that is turned on), and the pages are sent with `Cache-Control: no-transform`. Proxies and CDNs that honour the header, such as Cloudflare, therefore leave the pages unchanged (no injected analytics beacon, Rocket Loader or email obfuscation). The proxy should not remove the header or inject scripts into the pages; the browser would block such scripts | With docker compose the proxy on the host reaches the container through the Docker network, so the address the server sees is that network's gateway, not `127.0.0.1` (the commented example in `deploy/config.docker.toml` is `172.18.0.1`; `docker network inspect` shows the actual gateway). Set `FLOWPAY_HTTP_PORT` to change the host port the public listener is published on. ### One hostname By default the console shares the public listener (port 8080): one hostname serves the checkout, the API and the console, which is at `https://pay.example.com/admin/`. ``` pay.example.com { reverse_proxy 127.0.0.1:8080 } ``` ### Two hostnames To serve the checkout and API at `pay.example.com` and the console at `admin.example.com`, give the console its own listener. There is no default console port; 8081 is used here. ```toml listen = "0.0.0.0:8080" public_url = "https://pay.example.com" trusted_proxies = ["127.0.0.1"] # with docker compose: the Docker network's gateway [admin] listen = "0.0.0.0:8081" public_url = "https://admin.example.com" ``` With docker compose, make these changes in `deploy/config.docker.toml` (`public_url` comes from `FLOWPAY_PUBLIC_URL`), and publish the console port by adding it to the `ports` of the `app` service in `docker-compose.yml`: ```yaml ports: - "${FLOWPAY_HTTP_PORT:-8080}:8080" - "127.0.0.1:8081:8081" ``` The Caddy configuration then has one site per listener: ``` pay.example.com { reverse_proxy 127.0.0.1:8080 } admin.example.com { reverse_proxy 127.0.0.1:8081 } ``` - Caddy obtains the certificates and sets `X-Forwarded-For` itself. With nginx, add `proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;` to each `location`. - The console is at `https://admin.example.com/admin/`. The console listener serves only `/admin`, `/admin/api` and `/healthz`; the public listener answers 404 for `/admin`. - `/readyz` and `/metrics` are on the public listener. - The console listener can instead be bound to an internal address (for example `listen = "10.0.0.5:8081"`) and reached without a public hostname; `admin.public_url` is then the internal address admins open. ## The first admin ```sh docker compose --env-file deploy/.env exec -e FLOWPAY_ADMIN_PASSWORD='…' app flowpayra-lite admin create --username alice ``` The password needs at least 12 characters. On the first sign-in the admin sets up a second factor (a passkey, a security key or Google Authenticator), and the system generates 10 single-use recovery codes. Further members are added on the console's **Team** page. An admin who has lost every factor can be reset on the server: ```sh flowpayra-lite admin reset --username alice --new-password ``` The command clears all of the account's factors; with `--new-password` it resets the password too. See [Admins and passkeys](/en/console/admins-and-passkeys/). ## After the first start 1. **Each chain**: add the chain in the console's **Chains & tokens** page, deploy and verify the merchant contracts through the **Contracts** checklist, then enable the chain. The command-line equivalent takes two steps: `flowpayra-lite deploy all --rpc --signer ` (the paying key comes from the environment variable `FLOWPAY_DEPLOYER_KEY`) deploys the contracts, sending transactions only and writing nothing to the database; then `flowpayra-lite signer verify --address --chain ` verifies and records them. Give `--chain` for a chain that is not enabled yet: without it, `signer verify` covers only enabled chains. 2. **Tokens**: list tokens on each chain; their capabilities are probed on listing. 3. **RPC endpoints**: at least 2 endpoints per chain are recommended, one of them `wss`, for lower booking latency. 4. **Hot wallet**: configure and fund it for gas sponsorship or subscriptions. These steps are covered in [Chains and contracts](/en/console/chains-and-contracts/). ## Roles `serve` runs every role by default. Multi-instance deployments can split them with `--role`, for example `serve --role api` and `serve --role indexer,notifier,expirer,relayer`. | Role | Responsibility | |---|---| | `api` | The business API, the checkout and the console. Stateless; scales horizontally | | `indexer` | One per chain: reads the merchant contracts' events, books payments once confirmed, handles reorganisations | | `notifier` | Delivers webhooks, emails and alerts | | `expirer` | Scheduled work such as order expiry, refund re-checks and list imports | | `relayer` | Sends sponsored transactions from the hot wallet; the keeper (subscription charges and on-chain cancellations) runs with this role | Background roles elect a leader through PostgreSQL advisory locks, so only one instance does the work at a time; when the leader is lost, another instance takes over within about 10 seconds. ## Health checks and metrics | Endpoint | Purpose | |---|---| | `/healthz` | Process liveness only; use it for container liveness probes | | `/readyz` | Checks the database and returns 503 when it is unavailable; also reports the RPC status of each enabled chain, WalletConnect and the quote signer key. A problem in those reports as `degraded` without a 503, which suits load balancers | | `/metrics` | Prometheus metrics: order states, webhook and email queues, chain heights and indexing lag, RPC endpoint health and latency, open alerts, WalletConnect | `/metrics` is off by default. Set `[metrics] token` (16 characters or more, or the environment variable `FLOWPAY_METRICS__TOKEN`) to enable it; scrapers must send `Authorization: Bearer `. ```sh curl -fsS localhost:8080/healthz curl -fsS localhost:8080/readyz ``` Read logs with `docker compose logs app`; the example configuration writes JSON lines. ## Backups ```sh docker compose --env-file deploy/.env exec -T postgres pg_dump -U flowpay flowpay > flowpay.sql ``` - In production, enable PostgreSQL WAL archiving for point-in-time recovery. - On-chain data can be restored by the indexer rescanning from the block the contracts were deployed at. - Keep these **apart from each other**: database backups, the master key, and the offline backups of the quote signer keys (JSON keystores: the secp256k1 key for EVM and TRON, the ed25519 key for Solana) and their passwords. - After a master key rotation, keep the old master key until the oldest database backup that may still be restored has expired; those backups are encrypted under it. ## Upgrades 1. Back up the database. 2. Update the code, rebuild the image and restart: ```sh git pull && docker compose --env-file deploy/.env up -d --build ``` With a registry image, set `FLOWPAY_IMAGE` and add `--no-build`. 3. Database migrations run automatically at startup (`migrate_on_start = true`). ## Related pages - [Security model](/en/security/model/): the boundaries of each key. - [Chains and contracts](/en/console/chains-and-contracts/): adding chains and deploying the merchant contracts. - [Admins and passkeys](/en/console/admins-and-passkeys/): admins, roles and second factors. --- # Payment flow URL: https://docs.flowpayra.com/en/checkout/payment-flow/ The checkout is the page where the payer completes a payment. Creating an order returns a payment link (`checkout_url`, at `/pay/{orderId}`); opening it brings the payer to the checkout. Subscription links (`/pay/sub/{id}`) follow the same flow. ## Page layout On screens 861 pixels wide or more, the whole checkout page is in the brand color: the order summary is on the left and the payment card on the right, the two centered together at a fixed width that does not grow with the screen. From the top, the summary shows the merchant name, the description and the amount, then the order number, the time left and the payee (the merchant's name). The language switch is at the top right of the page, and the footer links are at the foot of the payment card. On phones and other narrow screens, the summary becomes a brand band at the top (the order number and the time left on one line, without the payee), with the language switch at its top right, the payment panel below it and the footer last. ### The subscription page Subscription links (`/pay/sub/{id}`) use the same layout, and the summary shows the subscription's terms: - The plan name with a **Subscription** badge and the amount per period (such as "10.00 USDC / 30 days"); a **Free for N days** badge when the plan has a trial; and the plan description. - A charge timeline: today → the first charge → each period after that, N periods in total. For a plan charged at once, **Today** reads "First charge {amount}"; with a trial it reads "Trial starts, nothing charged" and the first charge follows the trial; for a plan change it reads "Nothing charged now" and the first charge comes when the new plan starts. Once a wallet is connected and the terms are quoted, the timeline shows the date of the first charge. - The link **Already subscribed? Manage or cancel in My subscriptions**, which leads to [My subscriptions](#my-subscriptions). In the payment card, the note "You approve a capped allowance once; each period is charged automatically. Cancel any time." sits in a light box before a wallet is connected. Once the terms are quoted, the **Authorization** box shows the allowance cap (the amount per period × the periods, plus the wallet's other open subscriptions in the token, which share the allowance) and the consent checkbox, which must be ticked before subscribing. The main button reads **Connect wallet to subscribe**, then **Subscribe · {amount} {token}**; it reads **Start free trial** for a plan with a trial and **Confirm plan change** for a plan change. On phones, the summary shows the periods, the trial and the first charge on one line, without the timeline, the badges or the My subscriptions link. ## Step 1: choose a token and a network The same token usually exists on several chains, so the checkout asks for the **Token** first and the **Network** second. Both can be chosen before a wallet is connected; the network decides which kind of wallet pays (EVM, TRON or Solana). - **Token**: when the order names the tokens it accepts, they are listed in that order. A few tokens show as segmented buttons; more become a dropdown (a second-level page on phones). - **Network**: listed in the order the merchant set in the console. The first 3 are shown and the rest sit under **More**, which has a search box when there are many. - **Default selection**: when the payer's browser wallet is on a supported network, that network is selected; otherwise the first one. - **A single option**: when the order accepts one token or one network only, that field is shown as read-only text. - **No balances**: many payers scan and pay with a mobile wallet whose balance cannot be read beforehand, so the checkout shows no balances and does not sort by them. Network options may carry these marks: | Mark | Meaning | |---|---| | Gas-free | The merchant sponsors the network fee for this token on this network; the payer only signs | | Current | The network the connected wallet is on | | Needs a TRON wallet / Needs a Solana wallet | The network belongs to another chain family and needs that kind of wallet | Which tokens and networks appear depends on the merchant's configuration; see [Networks and tokens](/en/checkout/networks-and-tokens/). ## Step 2: connect a wallet Pressing the main button, **Pay {amount} {token}**: - **Desktop**: opens the wallet picker. The left side lists **Installed** browser extension wallets and **More wallets**; the right side shows a QR code for mobile wallets to scan. - **Phone system browser**: a wallet list slides up from the bottom; choosing one opens the checkout inside that wallet's app. - **In-wallet browser**: connects automatically, with no wallet picker. - **Connected before**: the connection is restored on the next visit and the button pays directly. Once connected, the payment panel shows the wallet's name and address, with **Switch wallet**. Selecting another network of the same chain family makes an EVM wallet follow; TRON and Solana wallets are switched by the payer inside the wallet. How each wallet connects is described in [Wallet support](/en/checkout/wallets/). ## Step 3: pay A line under the main button summarises what the payment authorizes: who is paid, the amount and the network. After the payer presses pay, the system picks the authorization method that fits the token and the wallet, and the payer only confirms in the wallet: - **Signature methods** (EIP-3009, EIP-2612 permit, Permit2): one signature, for the order amount and for this order only. - **Approve, then pay**: for tokens without signature authorization, an approval transaction is sent first, then the payment. - **Native coins**: paid directly from the wallet. - **Gas sponsorship**: on routes marked **Gas-free** the payer only signs; the system submits the transaction and the merchant covers the network fee. While paying, the main button shows the progress: 1. "Confirm in the wallet" 2. "Submitting transaction" 3. "Confirming n/N" Once the transaction is sent, the page remembers it: after a refresh, or on returning from the wallet app, it keeps tracking the transaction and does not ask for a second payment. ### Messages the payer may see | Situation | What the checkout does | |---|---| | Confirmation cancelled in the wallet | Restores the main button and shows "Wallet confirmation cancelled" | | Not enough of the token | Shows the missing amount and suggests another token or network with enough balance | | Not enough for the network fee | Shows how much native coin is missing and suggests a gas-free network | | The wallet did not switch network | Names the network the wallet is on; nothing is signed | | The transaction failed | Shows "The transaction did not go through; the order is still unpaid" and allows another attempt | | The quote expired | The main button becomes **Refresh quote** | | The wallet address did not pass risk screening | Asks the payer to use another wallet or contact the merchant; the reason is not shown | ## Step 4: confirmation When the payment reaches the confirmations the network requires, the checkout shows the result page: **Payment complete**, the amount, the order number, the network, the payer address and the transaction hash. When the order has a return URL, the page offers **Return to merchant**. :::note The result page and the return parameters only show the outcome to the payer. Merchants should ship or activate on the status reported by the webhook or the order query API; see the [Integration guide](/en/developers/integration/). ::: ## Order states How order states map to what the payer sees: | Order status | Meaning | Checkout | |---|---|---| | `pending` | Awaiting payment | The payment panel | | `paid_unconfirmed` | A payment was seen on chain; confirmations not yet reached | "Confirming" | | `paid` | The payment reached the required confirmations | "Payment complete" | | `duplicate_paid` | Another payment reached the required confirmations | Still shown as paid; the merchant refunds the extra payment | | `expired` | Not paid in time | "This order has expired", with a hint to return to the merchant | | `reverted` | A confirmed payment disappeared in a chain reorganisation | — | | `partially_refunded` / `refunded` | Refunded in part or in full | — | For an order that can no longer be paid, the checkout shows "This order has expired" or "This order is closed". Orders expire after 30 minutes by default (the merchant can change this); the order summary shows the time left. A payment that arrives after expiry is still booked. ## Receipt email When the merchant has receipts turned on, an **Email (optional)** field appears above the main button. A payer who fills it in receives a payment receipt once the payment is confirmed, with the item, amount and token, network, transaction hash, order number and payment time. When the business system supplied an email with the order, the page simply states where the receipt will go. The merchant can make the field optional or hide it. The receipt is written in the checkout language in use when the address was entered. ## Language and themes - **Language**: the checkout is available in Simplified Chinese and English, switchable at the top right. The business system can set the language per order with `locale` (`zh-CN` or `en`). - **Theme**: the checkout has a light and a dark theme and follows the system by default. The merchant can set it to follow the system, light or dark in the console under **Merchant & checkout → Checkout appearance**; the link parameter `?theme=light` or `?theme=dark` takes precedence. ## Test mode Test orders and test subscriptions show a **Test mode** mark beside the merchant name; other pages, such as the result page, show a ribbon at the top. Test orders are paid on testnets only and move no real funds. See [Test mode (Sandbox)](/en/developers/sandbox/). ## Footer and payment help The checkout footer shows **Privacy** and **Terms** (when the merchant has set them) and **Payment help**, plus the merchant's support email when one is set. **Payment help** opens the help form (`/help?order=…`). The order number, the connected wallet address and the language are carried over from the checkout. | Field | Notes | |---|---| | Order number | Filled in when the form is opened from the checkout | | Issue type | Paid but not credited, Payment failed, Duplicate payment, Subscription charge issue, Other | | Transaction hash | Optional; when given, the system looks the payment up automatically | | Payer address | Optional | | Email | Required; the outcome is sent to it | | Description | Required; up to 2000 characters | | Screenshots | Optional; up to 3, each up to 5 MB (PNG, JPEG, WebP or GIF) | Submitting creates a ticket number (such as `T-20261027-0001`) and sends a confirmation to the email given. The merchant handles the ticket in the console's **Tickets** page and replies by email. ## My subscriptions Subscription payers manage their subscriptions themselves at `/my/subscriptions`. There are two ways to sign in: - **Wallet signature**: sign a sign-in message with the paying wallet to see the subscriptions that address pays for. - **Receipt email**: enter the address that receives subscription receipts; the system sends a single-use sign-in link, valid for 30 minutes. Once signed in: | Action | Notes | |---|---| | Pause / Resume | Available when the plan allows it | | Cancel subscription | Takes effect immediately; no further charges are made | | Change payment method | Move to another wallet, token or network; charge dates and the periods already charged stay the same | | Change receipt email | Change where receipts are sent | | Revoke allowance | Revoke the token allowance given to the payment contract, from the wallet | | Charge history | See the charge of each period | Subscription receipt emails carry a "manage subscription" link to this page. Configuring subscriptions is covered in [Subscriptions](/en/console/subscriptions/). --- # Wallet support URL: https://docs.flowpayra.com/en/checkout/wallets/ The checkout picks the connection method that fits the payer's environment: a desktop browser uses an extension wallet or a QR code, a phone's system browser opens the wallet app, and an in-wallet browser connects directly. The payer only chooses a wallet and does not need to know about channels. ## Three environments | Environment | How the wallet connects | |---|---| | Desktop browser | An installed browser extension wallet connects directly; a mobile wallet connects by scanning a QR code | | Phone system browser (Safari, Chrome and so on) | After the payer selects a wallet, the checkout opens inside that wallet app's browser; a wallet without an open-in-wallet link connects through WalletConnect | | A wallet app's in-app browser | The checkout recognises the wallet and connects automatically, with no wallet picker | ## The wallet list The wallet list follows the family of the selected network: EVM wallets for an EVM network, and the matching family's wallets for a TRON or Solana network. ### Order The default list consists of, in order: 1. **Last used**: the wallet the payer used last on this device. It is recorded per network family and stored in the payer's browser. 2. **Detected**: every wallet detected in the current browser. 3. **Popular**: wallets in the popular order, until the default list holds 5 wallets. 4. **WalletConnect**: when enabled, always at the end of the default list. The remaining wallets are placed under **More wallets** and can be searched by name. The default popular order of each family is listed below. The first 5 are shown when no wallet was used before and none is detected. | Network family | Default popular order | |---|---| | EVM | **MetaMask, OKX Wallet, Binance Wallet, Trust Wallet, Coinbase Wallet**, Bitget Wallet, TokenPocket, imToken, Phantom, Rabby, SafePal, Bybit Wallet, Rainbow, Uniswap Wallet, Zerion, Gate Wallet, Kraken Wallet | | TRON | **TronLink, OKX Wallet, TokenPocket, Bitget Wallet, imToken**, Trust Wallet, Binance Wallet, SafePal, Bybit Wallet | | Solana | **Phantom, Solflare, Backpack, OKX Wallet, Bitget Wallet**, Trust Wallet, MetaMask, Binance Wallet, Coinbase Wallet, Jupiter, TokenPocket, Bybit Wallet | The merchant can arrange the popular order per family; see **Checkout wallet order** in [Merchant and checkout](/en/console/merchant-and-checkout/). ### Desktop The picker lists wallets on the left and shows how the selected wallet connects on the right: - A wallet labelled **Installed** connects directly; the right side asks the payer to confirm in the wallet. - A wallet labelled **Scan** connects when its mobile app scans the QR code on the right. When WalletConnect is enabled and the wallet supports it, the code is a WalletConnect pairing code: the payer approves the connection on the phone and continues the payment on the desktop. Otherwise it is the checkout link: the wallet opens the checkout in its in-app browser and the payment is completed on the phone. The payer can switch between the two codes on the right. - A wallet labelled **Direct** connects through its wallet SDK; see "Wallet SDKs" below. ### Phone Each wallet in the sheet is labelled with how it connects: - **Open**: the checkout opens in that wallet app's in-app browser. - **Connect**: the wallet connects through WalletConnect, and its app is opened directly. - **Installed**: the wallet is present in the current browser and connects directly. **Copy checkout link** is available at the bottom of the sheet. ## Support matrix In the tables, "Extension" is a desktop browser extension (injected), "Scan" means the mobile app scans the QR code shown on the desktop, and "Open in wallet" is the jump from a phone's system browser into the wallet app's in-app browser. Every wallet listed also connects directly when the checkout is opened inside its app's browser. ### EVM networks | Wallet | Desktop | Phone | |---|---|---| | MetaMask | Extension, Scan | Open in wallet | | OKX Wallet | Extension, Scan | Open in wallet | | Binance Wallet | Extension, Scan | Open in wallet | | Trust Wallet | Extension, Scan | Open in wallet | | Coinbase Wallet | Extension, Scan | Open in wallet | | Bitget Wallet | Extension, Scan | Open in wallet | | TokenPocket | Extension, Scan | Open in wallet | | imToken | Scan | Open in wallet | | Phantom | Extension, Scan | Open in wallet | | Rabby | Extension, Scan | WalletConnect | | SafePal | Extension, Scan | Open in wallet | | Bybit Wallet | Extension, Scan | Open in wallet | | Rainbow | Extension, Scan | Open in wallet | | Uniswap Wallet | Extension, Scan | WalletConnect | | Zerion | Extension, Scan | WalletConnect | | Gate Wallet | Extension, Scan | WalletConnect | | Kraken Wallet | Scan | WalletConnect | - **Any EVM browser extension that supports EIP-6963 appears automatically** under **Detected** in the wallet picker, whether or not it is in the table. - Other mobile wallets connect through WalletConnect. - A wallet whose Phone column reads WalletConnect also pairs through WalletConnect when scanned from the desktop, so it requires WalletConnect to be enabled. ### TRON networks | Wallet | Desktop | Phone | |---|---|---| | TronLink | Extension, Scan | Open in wallet | | OKX Wallet | Extension, Scan | Open in wallet | | TokenPocket | Extension, Scan | Open in wallet | | Bitget Wallet | Extension, Scan | Open in wallet | | imToken | Scan | Open in wallet | | Trust Wallet | Extension, Scan | Open in wallet | | Binance Wallet | Extension, Scan | Open in wallet | | SafePal | Extension, Scan | Open in wallet | | Bybit Wallet | Extension, Scan | Open in wallet | TRON wallets that are not listed connect through WalletConnect. ### Solana networks | Wallet | Desktop | Phone | |---|---|---| | Phantom | Extension, Scan | Open in wallet | | Solflare | Extension, Scan | Open in wallet | | Backpack | Extension, Scan | Open in wallet | | OKX Wallet | Extension, Scan | Open in wallet | | Bitget Wallet | Extension, Scan | Open in wallet | | Trust Wallet | Extension, Scan | Open in wallet | | MetaMask | Extension, Scan | Open in wallet | | Binance Wallet | Extension, Scan | Open in wallet | | Coinbase Wallet | Extension, Scan | Open in wallet | | Jupiter | Extension, Scan | WalletConnect | | TokenPocket | Extension, Scan | Open in wallet | | Bybit Wallet | Extension, Scan | Open in wallet | - **Any Solana wallet that implements the Wallet Standard appears automatically**, whether or not it is in the table. - Solana wallets that are not listed connect through WalletConnect. - The MetaMask mobile app supports Solana mainnet only. - The system builds Solana transactions in the legacy format where possible, so wallets that support only legacy transactions (such as TokenPocket) can sign them; a transaction that would exceed the size limit, for example with many payees, is built as a v0 transaction. :::note If a wallet app does not open from its link, use **Copy checkout link** and paste the link into the wallet's browser, or use WalletConnect. ::: ## Connection channels The checkout offers several independent connection channels. WalletConnect depends on an external relay service, so it is never the only channel: when the relay is down, the others keep working. ### Injected wallets Desktop browser extensions and wallet apps' in-app browsers inject a wallet interface into the page, and the checkout talks to it directly. This channel is entirely local and depends on no external service. - EVM: wallets are discovered through EIP-6963, with support for each wallet's own injected object. - TRON: TronLink and the TRON interfaces other wallets inject are recognised. - Solana: wallets are discovered through the Wallet Standard. ### Open in wallet In a phone's system browser, once the payer picks a wallet, the checkout hands the current page to the wallet app through that wallet's link. The page reopens in the wallet's in-app browser and connects as an injected wallet. This channel does not depend on WalletConnect. The sheet also offers **Copy checkout link**, for pasting the link into a wallet's browser or Discover tab by hand. ### QR code of the checkout link The desktop wallet picker can show a QR code of the current checkout link. Scanning it with a mobile wallet app's scanner opens the same checkout in the wallet's in-app browser, where the payer completes the payment on the phone. This channel does not depend on WalletConnect either. - Without WalletConnect, the right side of the picker shows this code directly. - With WalletConnect enabled, the payer selects a mobile wallet and then **Scan to open the checkout instead**; a wallet that does not support WalletConnect uses this code directly. ### Wallet SDKs (when enabled) On desktop, when the MetaMask, OKX Wallet or Coinbase Wallet extension is not installed, a mobile wallet can connect through that wallet's own connection service. When enabled, these three wallets carry a **Direct** tag in the wallet picker: - MetaMask and OKX Wallet: a connection QR code appears on the right; scan it with the wallet's app and approve. - Coinbase Wallet: a Coinbase connection window opens. If the connection service is not ready within 10 seconds, the picker falls back to the QR code of the checkout link. The wallet SDK channels are **off by default** and apply to EVM networks on desktop only. An admin turns them on one by one in the console under **Merchant & checkout → Wallet connections** (step-up verification required). ### WalletConnect WalletConnect connects wallets that are not installed and have no "open in wallet" link: - Desktop: selecting a wallet labelled **Scan**, or **WalletConnect** at the end of the default list, shows a pairing QR code on the right; scan it with the wallet app and approve the connection on the phone. The connection link can also be copied. - Phone: a wallet without an open-in-wallet link is labelled **Connect**; it connects through WalletConnect and its app is opened directly. The wallet list also gains **Other wallets (WalletConnect)**. - It is available for networks of all three families: EVM, TRON and Solana. **Turning it on.** WalletConnect needs a projectId. The merchant creates a project at Reown Cloud (`https://cloud.reown.com`) to get one and enters it in the WalletConnect section of the console's **Merchant & checkout → Wallet connections** (step-up verification required). Without a projectId the checkout does not offer WalletConnect; an admin can also switch it off there. :::caution If the Reown project lists allowed domains, the list must include both the checkout domain (`public_url`) and the console domain; otherwise the relay rejects the browser's connection. The console's WalletConnect section lists both domains. ::: ### When WalletConnect is unavailable - The server checks the WalletConnect relay every minute. After 3 failures in a row it is marked unavailable and the checkout stops offering it; it is offered again once the relay recovers. - In the payer's browser, one stall of more than 8 seconds while initialising or fetching the pairing code, or two failures in a row, switches WalletConnect off for that session. What the checkout does then: - Desktop: **WalletConnect** no longer appears in the default list, and selecting a mobile wallet shows the QR code of the checkout link on the right; the **Direct** wallet SDK entries that are enabled keep working. - Phone: "open in wallet" is the main path, with **Copy checkout link** alongside. The three main paths (in-wallet browsers, desktop extensions and "open in wallet") are unaffected by the state of WalletConnect. ## Restored sessions After a payer has connected a wallet, the connection is restored the next time the checkout opens: an authorized injected wallet, a WalletConnect session and, on desktop, a wallet SDK session all resume silently, and the main button pays directly. The payer can move to another wallet at any time with **Switch wallet**; the wallet used last leads the wallet list. ## Smart accounts The checkout reads the wallet's capabilities before paying. For smart accounts and wallets that support batched calls (EIP-5792), approval and payment can complete in a single confirmation; when a wallet cannot produce a particular kind of signature, the checkout moves on to the next available method. For a subscription, the ERC-6492 signature of a smart account that is not yet deployed is not used for Permit2 or for the subscription terms: the checkout moves on to the next method and, when needed, fetches the subscription terms again and subscribes with a token allowance (approve) instead. Changing the payment method in "My subscriptions" works the same way. ## Related pages - [Payment flow](/en/checkout/payment-flow/): the full sequence from choosing a token to payment complete. - [Networks and tokens](/en/checkout/networks-and-tokens/): supported networks, tokens and confirmations. - [Gas and hot wallets](/en/console/gas-and-hot-wallets/): configuring gas sponsorship. --- # Networks and tokens URL: https://docs.flowpayra.com/en/checkout/networks-and-tokens/ FlowPayra Lite supports three network families: EVM, TRON and Solana. An admin adds, enables or disables each network in the console as needed; the checkout lists only the tokens listed on enabled networks. ## Mainnets ### EVM mainnets | Network | Chain ID | Native coin | Default confirmation | |---|---|---|---| | Ethereum | 1 | ETH | 12 blocks | | BNB Smart Chain | 56 | BNB | 15 blocks | | Polygon | 137 | POL | 64 blocks | | Avalanche C-Chain | 43114 | AVAX | 1 block | | Arbitrum One | 42161 | ETH | The `safe` block tag; 20 blocks when the node does not serve it | | OP Mainnet | 10 | ETH | The `safe` block tag; 20 blocks when the node does not serve it | | Base | 8453 | ETH | The `safe` block tag; 20 blocks when the node does not serve it | | X Layer | 196 | OKB | The `safe` block tag; 20 blocks when the node does not serve it | | Linea | 59144 | ETH | 20 blocks | | Scroll | 534352 | ETH | 20 blocks | | Gnosis | 100 | XDAI | 24 blocks | | Celo | 42220 | CELO | The `safe` block tag; 20 blocks when the node does not serve it | | Arc | 5042 | USDC | 1 block (final once produced) | | Robinhood Chain | 4663 | ETH | The `safe` block tag; 20 blocks when the node does not serve it | ### TRON and Solana | Network | Native coin | Default confirmation | |---|---|---| | TRON | TRX | Solidified blocks, about 19 blocks (3 seconds each) | | Solana | SOL | The `finalized` commitment, about 32 slots (about 400 ms each) | ### Other EVM networks An admin can add any EVM-compatible network from the console under **Chains & tokens → Add chain**: enter an RPC URL, let the system read the chain's details, then deploy and verify the merchant contracts and enable the chain. A network without built-in defaults gets the number of blocks that covers about two minutes at its measured block time (at least 3, at most 1000); the admin can change it. The steps are in [Chains and contracts](/en/console/chains-and-contracts/). ## Testnets Testnets serve test mode only: test orders and test subscriptions are paid on testnets, and mainnets accept live orders only. A built-in testnet is marked as a testnet automatically when added. | Testnet | Chain ID | Native coin | Default confirmations | |---|---|---|---| | Sepolia | 11155111 | ETH | 3 | | BNB Smart Chain Testnet | 97 | tBNB | 3 | | Polygon Amoy | 80002 | POL | 5 | | Avalanche Fuji | 43113 | AVAX | 1 | | Arbitrum Sepolia | 421614 | ETH | 5 | | OP Sepolia | 11155420 | ETH | 5 | | Base Sepolia | 84532 | ETH | 5 | | X Layer Testnet | 1952 | OKB | 5 | | Linea Sepolia | 59141 | ETH | 5 | | Scroll Sepolia | 534351 | ETH | 5 | | Gnosis Chiado | 10200 | XDAI | 5 | | Celo Sepolia | 11142220 | CELO | 5 | | Arc Testnet | 5042002 | USDC | 1 | | Robinhood Chain Testnet | 46630 | ETH | 5 | | Testnet | Native coin | Default confirmation | |---|---|---| | TRON Nile | TRX | As on TRON mainnet | | TRON Shasta | TRX | As on TRON mainnet | | Solana Devnet | SOL | As on Solana mainnet | | Solana Testnet | SOL | As on Solana mainnet | Using test mode is covered in [Test mode (Sandbox)](/en/developers/sandbox/). :::note The shared contracts are deployed on six EVM mainnets (Ethereum, BNB Smart Chain, Base, X Layer, Arc and Robinhood Chain) and on the Sepolia, Arc testnet, TRON Nile and Solana Devnet test networks. Their addresses are listed in [Security reviews](/en/security/audits/). ::: ## Confirmations When a payment appears on chain, the order first shows as confirming; it is booked as paid, and `order.paid` is sent, only once the network's confirmation requirement is met. - Each network's confirmations can be changed in the console under **Chains & tokens**. - Confirmation can be by block count or by the node's `safe` / `finalized` block tag; the system checks that the node supports the tag before saving. - Before confirming, the system compares the payment's block on two nodes and holds the confirmation if they disagree. - If a confirmed payment disappears in a chain reorganisation, the order becomes `reverted` and `order.payment_reverted` is sent. ## Tokens ### Default tokens | Category | Tokens | |---|---| | Stablecoins | USDT, USDC, DAI, PYUSD, EURC | | Native coins | Each network's native coin, such as ETH, BNB, POL, AVAX, TRX, SOL, CELO | Tokens are listed per network: the same token is listed, enabled or delisted on each network separately. ### How an order decides which tokens it accepts - An order is priced as an amount in a currency. Stablecoins pegged to that currency pay 1:1; a USD order can be paid in USDC, USDT or DAI, for example. - An order can restrict the tokens with `tokens` and the networks with `chains`. By default it accepts every listed stablecoin, plus a token whose symbol equals the currency. - To price a token individually (for example to accept a native coin), the order gives the amount due in that token with `prices`. What the checkout finally lists is the intersection of what the order allows, the enabled networks, the tokens that are listed and not paused, the networks where the payee addresses passed their checks, and the routes the current gas mode can offer. See the [Integration guide](/en/developers/integration/). ### Custom tokens An admin can list other tokens on any network from the console: 1. In **Chains & tokens**, open the network's token list and choose **Add token**. 2. Enter the token contract address; optionally a symbol, the pegged currency (used for price conversion) and a holder address (used to simulate a transfer and detect fees). 3. Choose **Probe and add**. The system reads the token's symbol, name, decimals and authorization capabilities. 4. The token is added unlisted and marked as custom; list it after review. A custom token without a bundled icon can be given one (PNG, JPEG or WebP). ## Token requirements The system probes a token's behaviour when it is listed; tokens that do not meet the requirements cannot be listed. ### EVM and TRON tokens | Case | Handling | |---|---| | Fee-on-transfer tokens | Refused | | Rebasing tokens (balances that change by themselves) | Refused | | Upgradeable proxy tokens (EIP-1967) | Accepted; the implementation contract is recorded and re-checked periodically. When it changes, the token is paused automatically with an alert, and resumes only after an admin reviews the new implementation | | Tokens with a blocklist (such as USDC and USDT) | Accepted; payee addresses are checked against the token's blocklist at registration and daily afterwards | | EVM tokens with EIP-3009 | Accepted; the system simulates `receiveWithAuthorization` to confirm that only the receiving address named in the authorization can call it, and that signatures of another type and invalid signatures are refused, so that nobody else can submit the payer's signature first. A token that fails the check (or whose check meets a node error) is not treated as supporting EIP-3009 and is paid with another method | Fee-on-transfer and rebasing tokens are refused for the same reason: a payee must receive exactly the amount stated in the order's terms, or splits cannot be carried out accurately. ### Solana tokens Both SPL Token and Token-2022 tokens can be listed on Solana. Token-2022 extensions are checked against an allow list; a token carrying any of these is refused: | Extension | Meaning | |---|---| | Transfer Fee | A fee on transfers | | Confidential Transfer Fee | A fee on confidential transfers | | Transfer Hook | A hook run on transfers | | Permanent Delegate | A permanent delegate over holders' balances | | Non-Transferable | Tokens that cannot be transferred | | An extension not on the list | Including extensions added to Token-2022 later; refused until the program lists them | Token-2022 tokens with no extensions, or with listed extensions only, can be listed. The listed extensions are: metadata and grouping (Metadata Pointer, Token Metadata, Group Pointer, Token Group, Group Member Pointer, Token Group Member), Mint Close Authority, Interest Bearing, Scaled UI Amount, Confidential Transfer, Confidential Mint/Burn, Default Account State and Pausable. Every subscription charge checks this too: if a token gains an extension off the list after the subscription was opened, the charge fails. A symbol must be entered when listing a Solana token. ## Authorization methods Payers do not choose an authorization method. The system selects one from the token's and the wallet's capabilities, and falls back to approve when a signature is refused: | Network family | Methods | |---|---| | EVM | EIP-3009, EIP-2612 permit, DAI permit, Permit2, approve; native coins are paid directly | | TRON | Approve-type methods and TIP-2612; native coins are paid directly | | Solana | The payer signs one transaction. Transactions are built in the legacy format where possible, for wallets that support only legacy transactions; one that would exceed the 1232-byte size limit (for example with many payees) is built as a v0 transaction with the merchant's address lookup table | For a subscription, when the signature a wallet gives for Permit2 or for the subscription terms cannot be used (such as the ERC-6492 signature of a smart contract account that is not yet deployed), the checkout moves on to the next method; when no Permit2 method works, it fetches the subscription terms again and subscribes with a token allowance (approve) instead. Changing the payment method in "My subscriptions" works the same way. An admin can force a method per token, separately for one-time payments and subscriptions, in the token list (limited to the capabilities that were probed). ## How gas sponsorship affects the tokens offered On a network set to gas sponsorship, only routes that can be completed with a signature can be sponsored: - Native coins must travel with the transaction and cannot be sponsored. - Tokens that can only be authorized with approve cannot be sponsored, unless the payer has already approved Permit2 for that token. - A network in gas mode `sponsored` does not list those tokens; a network in `sponsored_fallback` still lists them, the payer sends those routes and the checkout notes "This payment needs a small amount of gas from the wallet." - On a Solana network with sponsorship on, a payer whose wallet cannot sign a transaction without sending it pays the fee instead. When the wallet fails to give the sponsored signature (other than the payer cancelling in the wallet) or alters the transaction, and the payer holds enough SOL for the fee and rent, the checkout gets a new quote in which the payer signs and sends the transaction. In both cases the checkout notes "This payment needs a small amount of gas from the wallet." - TRON energy delegation applies to one-time payments only; payers pay for subscription sign-up themselves. The checkout marks **Gas-free** per token and network. Configuration is covered in [Gas and hot wallets](/en/console/gas-and-hot-wallets/). ## Pausing a token In **Chains & tokens**, an admin can pause or resume a token by symbol on every network at once. While paused, the token disappears from every checkout, new quotes are refused and quotes already issued are voided. See [Risk controls](/en/console/risk/). ## Related pages - [Chains and contracts](/en/console/chains-and-contracts/): adding networks, deploying the merchant contracts, managing RPC endpoints and tokens. - [Wallet support](/en/checkout/wallets/): the wallets supported per network family. - [Payment flow](/en/checkout/payment-flow/): how the payer chooses a token and a network. --- # Embedding the checkout URL: https://docs.flowpayra.com/en/checkout/embed/ Besides redirecting the payer to the payment link, a merchant can open the checkout on its own page: on desktop the payment happens in a modal (an iframe), and on phones the payer is redirected to the checkout page. Phones are redirected because wallet apps and their links work most reliably in a full page. ## Integration modes | Mode | Description | |---|---| | Redirect (default) | After creating the order, send the payer to `checkout_url`; they return to `return_url` when done | | Modal / iframe | The page loads `/pay/embed.js`; the checkout opens in a modal on desktop and by redirect on phones | This page covers the second mode. Creating orders is described in the [Integration guide](/en/developers/integration/). ## Step 1: register the sites allowed to embed By default the checkout cannot be embedded. In the console under **Merchant & checkout → Merchant and look**, in the merchant card, enter the https origins of the merchant's sites in **Sites allowed to embed the checkout**, one per line, for example: ``` https://shop.example ``` The checkout allows only these sites to embed it, through the `frame-ancestors` directive of its Content Security Policy. A site that is not listed cannot load the checkout in an iframe, and the embed script redirects instead. ## Step 2: load the script Load the embed script from the checkout's domain on the merchant page. Replace `https://pay.example.com` in the examples with the address of your own deployment. ### Declarative Give a button the `data-flowpay-checkout` attribute with the order's `checkout_url`; a click opens the checkout: ```html ``` ### Programmatic ```js const checkout = FlowPay.open(order.checkout_url, { mode: 'auto', // auto (default: modal on desktop, redirect on phones) | modal | redirect onPaid(e) { /* { order_id, status: 'paid', return_url } */ }, onExpired(e) { /* { order_id, status: 'expired' } */ }, onClose(e) { /* { order_id, reason: 'closed' | 'return' | 'blocked' | 'replaced' } */ }, redirectOnReturn: true, // "Return to merchant" on the result page sends the top-level page to the signed return_url fallback: true, // redirect to the checkout when embedding is refused (not ready within 10 s); false only fires onClose(reason: 'blocked') }); checkout?.close(); // null in redirect mode ``` The same events are also dispatched on `window`, with the same `detail` as the callback arguments above: ```js window.addEventListener('flowpay:paid', (e) => refreshOrder(e.detail.order_id)); // also flowpay:expired and flowpay:closed ``` ### Options | Option | Description | |---|---| | `mode` | `auto` (default): modal on desktop, redirect on phones; `modal`: always a modal; `redirect`: always a redirect | | `onPaid` | Called when the payment reaches the required confirmations | | `onExpired` | Called when the order expires | | `onClose` | Called when the modal closes; `reason` says why | | `redirectOnReturn` | When `true`, pressing "Return to merchant" on the result page sends the top-level page to the signed `return_url` | | `fallback` | When `true`, a refused embed (not ready within 10 seconds) redirects to the checkout; when `false`, only `onClose` fires, with `reason` set to `blocked` | ## Events | Event | Source | When | |---|---|---| | `paid` | The checkout iframe | The payment reached the required confirmations and the result page is shown | | `expired` | The checkout iframe | The order expired | | `closed` | The embed script | The payer closed the modal (close button, Esc or a click on the backdrop), or pressed "Return to merchant" on the result page (`reason: 'return'`) | ## Security - The checkout sends events only when the embedding page belongs to the sites allowed to embed it; the `postMessage` target origin is fixed to that site, and the checkout accepts no messages from the parent page. - The embed script accepts only messages that come from the checkout iframe and whose origin is the checkout's domain. - The result page inside the modal never loads the merchant page into the iframe: returning to the merchant is done by the top-level page. :::caution Embed events are for interface feedback only. **Ship and activate on the status reported by the webhook or `GET /v1/orders/{id}`.** To check a return, verify the signature in `return_url` as described in the [Integration guide](/en/developers/integration/). ::: ## Example page `docs/developers/examples/embed.html` in the source repository is a complete example page. Replace the checkout domain and the order link in it with your own. ## Related pages - [Integration guide](/en/developers/integration/): creating orders, verifying the return signature and deciding when to ship. - [Webhooks](/en/developers/webhooks/): events and signature verification. - [Payment flow](/en/checkout/payment-flow/): the payer's steps at the checkout. --- # Overview and orders URL: https://docs.flowpayra.com/en/console/overview-and-orders/ The console is where a merchant operates FlowPayra Lite. It is served under `/admin` of the deployment (for example `https://admin.example.com/admin`). This page covers signing in, the overview page and top bar, and the day-to-day tasks in the **Payments** and **Support** menu groups. ## Signing in The first screen of the sign-in page asks only for the **Username**. After **Continue**, the system decides the next step: | Account state | Next step | |---|---| | A passkey or security key is registered | The browser opens key verification straight away. Once it passes, the administrator is signed in; no password is needed | | No key is registered yet (authenticator app only, or first sign-in) | Enter the password, then the 6-digit code, or go through second-factor setup | A passkey stored on the device or in a password manager can also be used from the first screen with **Sign in with a passkey**, without typing a username. If the browser asks for another click, or the verification is cancelled, the page stays on the key step. Choose **Verify with key** to retry, or **Use the password instead**. - On first sign-in the account has no second factor yet. Setup must be completed before the console can be used. - Five consecutive failures of the second factor or recovery code during sign-in lock the account for 15 minutes; only a passkey or security key signs in meanwhile. Wrong passwords at the sign-in page never lock the account; they pause password sign-in for that name from that IP. - A session lasts 12 hours and ends after 30 minutes of inactivity. For second factors, recovery codes and step-up verification, see [Admins and passkeys](/en/console/admins-and-passkeys/). ## The overview page After sign-in the console opens **Overview**. The page counts only orders that have reached their confirmations. | Area | Content | |---|---| | Today's takings | Amount and number of orders confirmed today, with the **New payment** and **New subscription** buttons | | Awaiting payment | Orders waiting to be paid, and the number confirming on chain | | Pending refunds | Refunds waiting to be sent or confirmed | | Confirmed orders, last 7 days | Counted per day in the merchant's time zone | | Chains and connectivity | Index lag, gas mode and hot wallet balance for each enabled chain; **Manage** opens **Chains & tokens** | | Recent orders | The latest orders; **All orders** opens the order list | | System alerts | Open alerts and the last day's notices | When there are duplicate payments, pending refunds or webhook events that failed delivery, the overview lists them under **Needs attention**. ## Top bar: mode, language, time zone and theme A fixed top bar sits above the content area. From left to right it holds the breadcrumb, the quick search (order number, address or transaction hash), the **Live / Test** switch, language, display time zone, theme, and the administrator's avatar (menu: **Account security**, **Sign out**). | Setting | Description | |---|---| | Live / Test | Selects which data the console shows. Orders, subscriptions, refunds, tickets, webhooks, the overview, reports and exports all follow the selected mode | | Language | Simplified Chinese or English. It also sets the language of notification emails sent to this administrator | | Display time zone | The merchant's time zone, the browser's time zone, or any IANA zone. The browser's zone is used until one is chosen. Times and date filters in lists and detail pages follow it | | Theme | System, Light or Dark | All four are saved to the administrator's account and carry over to other browsers. ### Live mode and test mode One deployment keeps two separate sets of data. Mainnets accept live orders and subscriptions only; testnets accept test ones only. After switching to **Test**, a banner appears at the top of every page and test orders, subscriptions and alerts are labelled **Test data**. Plans, payees, split rules, chains and tokens are shared by both modes. For test API keys, test webhooks and clearing test data, see [Test mode (Sandbox)](/en/developers/sandbox/). ## Orders **Payments → Orders** lists every order in the current mode. ### List and filters - Status tabs: All statuses, Awaiting payment, Confirming, Confirmed, Duplicate payment, Expired, Reverted. - Search: by merchant order number, order ID, payer address or transaction hash. - Filters: network and date range (Today, Yesterday, Last 7 days, Last 30 days, This month, Last month, or Custom). - **Export CSV** exports the orders that match the current filters. Search and filters are kept in the page address, so they are preserved when returning from an order. ### Order detail Select an order to open its detail page: | Area | Content | |---|---| | Order | Merchant order number, order ID, creation and expiry time, network and token, transaction hash, confirmation time, payer address | | Splits | For each payee: split method, receiving address, quoted amount and the amount received on chain, with a check that the on-chain `SplitPaid` events match the quote | | Timeline | Order created, quote, on-chain payment and its confirmation state | | Refunds | The order's refunds and the **Refund** button | | Webhook deliveries | Delivery state of each event for this order, with a resend action | | Metadata | The `metadata` supplied when the order was created | An order that is still awaiting payment also shows its payment link. When the payer address carries a risk label, it can be added to the block list or allowed from here; see [Risk screening](/en/console/risk/). ## Creating a payment link or subscription link Admins and operators can create a payment or a subscription directly in the console, without the business API, and send the link to the payer. The buttons are on the overview's takings card, the **Orders** page and the **Subscriptions** page. ### New payment 1. Select **New payment**. 2. Enter the **Amount** and **Currency**. 3. Optionally fill in **Order number** (generated as `ADM-YYYYMMDD-XXXXXX` when left blank), **Payer email (optional)** (a receipt is sent once paid), **Link valid for** (15 minutes to 7 days), **Split rule** (the default rule unless changed) and **Note (optional)** (visible in the console only; stored as `metadata.note`). 4. Select **Create payment link**. The dialog then shows the payment link and a QR code. The link can be copied or opened in a new window. The payer opens it, picks a token and a wallet, and pays; see [Payment flow](/en/checkout/payment-flow/). ### New subscription 1. Select **New subscription**. 2. Choose a **Plan**. If no plan is active yet, create one under **Plans** first; see [Subscriptions](/en/console/subscriptions/). 3. Optionally fill in **Customer reference** (the customer ID in the business system; generated when left blank) and the payer's email. 4. Create the subscription link and send it to the payer. Once the payer opens it and signs the subscription, charges follow the plan. :::note Orders and subscriptions created in the console belong to the mode the console is currently in. A link created in test mode accepts testnet payments only. ::: ## Statistics **Payments → Statistics** summarises takings for the selected period in the current mode. The default range is the last 30 days; the longest is 400 days. | Area | Description | |---|---| | Collected, One-time orders, Subscription charges, Net | Totalled per price currency. Net = orders + subscription charges − completed refunds | | Collected per day | Days follow the display time zone | | Payee earnings | Amount and share received by each payee, from each payment's split snapshot | | By token, By network | Token amounts actually received on chain, with payment counts | The figures use the same basis as the payee statement: an order confirmed in the period still counts as received if it is refunded later. ## Payment lookup **Support → Payment lookup** queries the chain directly and compares the result with what the system booked. It is the tool for "paid but not credited" cases. | Look up by | Description | |---|---| | Transaction hash | Shows the checkout contract events in the transaction, its confirmations and the matching order | | Payer address | Shows the payments made from the address; a date range can be set | - A network and a node can be selected. If one chain fails, the error is shown for that chain only and the other results remain. - When the result reads **Paid on chain · not booked**, select **Book payment**. - Token or native-coin transfers sent straight to a payee address, bypassing the contract, are listed separately as **Not via the contract · handle manually**. - Sign-up, charge and cancellation events of the subscription contract are decoded and matched to subscriptions. Disabled chains are queried as well. ## Refunds A refund is sent by the merchant from the receiving address back to the payer. The system opens, verifies and records it; funds remain self-custodial throughout. Admins and operators can carry out refunds; the finance role is read-only. ### Opening and sending a refund 1. In the **Refunds** section of the order, select **Refund**, choose **Full** or **Partial**, enter the amount (up to the refundable amount) and a reason, then select **Create refund**. 2. Complete the transfer in either way: - **Refund from wallet** (EVM chains): connect the wallet that holds the payment's receiving address. The system builds a transfer of the same token on the same chain, and the administrator confirms it in the wallet. - **Record transaction**: enter the hash of a refund transaction that has already been sent. 3. The system verifies on chain and books the refund: the transaction succeeded, reached the chain's confirmations, and sent at least the refund amount of the same token from the payment's receiving address to the payer. ### Verification outcomes | Case | Handling | |---|---| | Confirmations not yet reached | Stays **Verifying**; rechecked periodically and booked automatically once confirmed | | Sent from an address that did not receive this payment | Returns to **Pending** with the reason shown | | The transfer runs inside a contract call that the node cannot trace | Stays **Verifying**; after checking, use **Confirm manually** (requires step-up verification and is written to the audit log) | | Transaction failed, or the amount is short | Returns to **Pending**; refund again or record another transaction | One transaction can settle only one refund. ### Rules - A duplicate payment opens a pending refund automatically. - On split orders the primary payee bears the refund. The refund keeps the original split snapshot for reconciliation. - When every payment has been refunded the order becomes **Refunded**; a partial refund of the main payment makes it **Partly refunded**; when only a duplicate payment is returned the order goes back to **Confirmed**. - A frozen payment cannot be refunded, and the system refuses refunds to a payer address that fails risk screening. - **Refund from wallet** is offered on EVM chains. On TRON and Solana chains, send the refund from the receiving wallet yourself and record its transaction. **Payments → Refunds** lists refunds across all orders, filterable by status (Pending, Verifying, Completed, Cancelled), network and date. ## Reports **Payments → Reports** exports data as CSV (UTF-8, opens in spreadsheet applications). Every role can export, and each export is written to the audit log. | Report | Content | |---|---| | Orders | Quoted amount and currency, paid token and amount, payer, transaction hash and refunded amount per order | | Subscription charges | Each charge attempt: subscription, plan, period, token and amount, transaction hash and status | | Refunds | Includes the split snapshot and quoted amount | | Payee statement | Per period and payee: receivable (split amounts as quoted), received (amounts paid out on chain, `SplitPaid`), refunds and net, with a check that receivable and received match | Reports can be filtered by period, network, token, payee and status; subscription charges also by plan. Orders fall into the period by creation time, subscription charges by charge time, refunds by the time they were opened, and the statement by confirmation time. ## Tickets When a payer submits a request through the payment help link in the checkout footer, the system creates a ticket (numbered like `T-YYYYMMDD-NNNN`) and lists it under **Support → Tickets**. - Filter by status: Open, In progress, Resolved. - A ticket shows the issue type, the related order, transaction hash, payer address, submitter, description, screenshots and replies. - If the payer supplied a transaction hash, the system looks it up automatically and shows the result on the ticket. **Open lookup to book** leads to payment lookup. - Replies are emailed to the submitter: select **Send reply**, or **Send and resolve**. The **Help form settings** tab controls whether the payment help form is enabled, human verification, lookup on submission, the ticket notification email and the ticket number prefix. ## Related pages - [Subscriptions](/en/console/subscriptions/) - [Payees and split rules](/en/console/payees-and-splits/) - [Risk screening](/en/console/risk/) - [Webhooks](/en/developers/webhooks/) --- # Subscriptions URL: https://docs.flowpayra.com/en/console/subscriptions/ A subscription is a recurring charge drawn from an allowance the payer grants in advance. The payer signs the subscription terms and approves the allowance once at the checkout; after that the system's keeper sends each period's charge from the hot wallet, and the funds are split to the payees' addresses by the merchant contracts. This page covers **Payments → Plans** and **Payments → Subscriptions**, and how a subscription behaves at each stage. :::note Subscriptions need a hot wallet even when every chain uses the payer-pays gas mode: each charge and each on-chain cancellation is sent by the hot wallet. See [Gas and hot wallets](/en/console/gas-and-hot-wallets/). ::: ## Plans A plan defines the price, period, number of periods, trial and dunning policy. The business system reads plan IDs from `GET /v1/plans` and creates subscriptions with them. Creating and editing plans requires the admin role and step-up verification. ### Creating a plan 1. Open **Payments → Plans** and select **New plan**. 2. Fill in the fields described below. 3. Select **Save** and complete step-up verification. | Section | Field | Description | |---|---|---| | Basics | Name, Description | Shown in the console and on the payer's subscription pages; see [Payment flow](/en/checkout/payment-flow/#the-subscription-page) | | Price | Pricing | **One price (stablecoins at par)**: enter the amount per period and the currency. **Price per token**: one entry per line as `SYMBOL=amount`, or `SYMBOL@chainId=amount` for a single network | | Price | Tokens | Accepted tokens, comma-separated. Empty accepts every token the price applies to | | Billing cycle | Period | Daily, Weekly, Every 30 days, Every 365 days, or a custom number of days | | Billing cycle | Periods | Total number of charges. The subscription completes after the last one | | Start and grace | Start | **First charge at once**: the first period is charged in the sign-up transaction. **Trial first**: enter the trial length in days; sign-up only sets up the allowance, and the first charge follows the trial | | Start and grace | Wallet must hold one period at sign-up | Optional sign-up condition | | Start and grace | Grace period (days) | How long retries continue after a failed charge | | Failed charges | Retries (hours) | Hours after each failed charge, comma-separated, within the grace period. The default is 1, 24 and 72 hours | | Failed charges | When the grace period ends | **Mark unpaid (keep it)** or **Cancel** | | Splits | Split rule | The plan's default split rule; the default rule is used when none is chosen | | Splits | Payers may pause from "My subscriptions" | Whether payers can pause the subscription themselves | ### Editing and retiring - Edits apply to new subscriptions only. A subscription takes a snapshot of its plan when created (price, accepted tokens, dunning policy, pause permission); existing subscriptions keep the terms their payers signed. - A plan can be retired with **Retire** and re-enabled with **Activate**. ## Subscription list **Payments → Subscriptions** lists the subscriptions in the current mode. Search by customer reference, payer address or subscription ID. The list shows the plan, customer, charges made, next charge time and status. | Status | Meaning | |---|---| | Awaiting sign-up | Created; the payer has not yet signed at the link | | Trial | In the trial period; the first charge has not been taken | | Active | Charging normally each period | | Past due | The current charge failed; in the grace period and being retried | | Unpaid | Still not charged when the grace period ended (for plans set to keep the subscription) | | Paused | Paused by the merchant, by the payer, or after risk screening | | Canceled | Canceled; no further charges | | Completed | All periods have been charged | **New subscription** on this page creates a subscription link directly; see [Overview and orders](/en/console/overview-and-orders/). ## Subscription detail The detail page shows: | Area | Content | |---|---| | Terms | Amount per period and the period, charges made, next charge, network, token and funding source (token allowance or Permit2 allowance), trial end, payer address | | Charges | Each period's attempts, time, status and failure reason (insufficient balance, insufficient allowance). Each charge is shown in its own token | | Splits | Each payee's receiving address and amount per period | | Subscription | Subscription ID, on-chain ID, sign-up transaction | | Other | Pause source and time, on-chain cancellation state, previous payment methods, plan changes | A subscription that is still awaiting sign-up shows its sign-up link. Operators and admins can use **Change plan**, **Pause**, **Resume** and **Cancel subscription**. The business API offers the matching `change_plan`, `pause`, `resume` and `cancel` endpoints; see [API](/en/developers/api/). ## Plan changes Terms that have been signed on chain cannot be altered. To upgrade or downgrade, the system creates a new subscription that waits for the payer's confirmation, and the payer signs the new terms at a new link. 1. On the subscription, select **Change plan**, choose the new plan, then select **Create change link**. 2. Send the link to the payer. The payer also sees a notice of the change in "My subscriptions". 3. The change applies once the payer confirms the new terms with the original paying wallet and the transaction is on chain. Rules: - Only subscriptions in **Trial** or **Active** that are confirmed on chain can be changed. Past-due, unpaid and paused subscriptions must be resolved first. - The new plan charges from the period boundary that follows the current period; if that boundary is less than 30 minutes away, it moves one period later. The current period is neither refunded nor prorated. Any difference is billed by the business system as a separate one-time order. - A change made during a trial does not grant a second trial; the new plan charges from the end of the trial. - Only the wallet that pays the original subscription can confirm the change. - After the new subscription is confirmed, the original one ends once its current period is over, and the keeper cancels it on chain. - The link stops working 15 minutes before the new plan starts. If the payer does not confirm in time, the change expires and the original subscription continues as before. - A newer change request replaces an earlier one the payer has not confirmed. Canceling either subscription withdraws the change. A plan change is shown as Awaiting the payer, Applied, Expired or Withdrawn. ## Pause and resume A pause takes effect inside the system: the keeper skips charges while the subscription is paused. | Initiated by | Subscriptions that can be paused | |---|---| | Merchant (console or business API) | Any active or past-due subscription | | Payer ("My subscriptions") | Only **Trial** and **Active** subscriptions, and only when the plan allows it | | Risk screening | Paused automatically when the payer address hits a block-level list before a charge | - After resuming, charging starts from the next period. The period in which the pause began and the periods during the pause are not charged, then or later. The failure count, retry time and past-due start are reset. - A pause caused by risk screening can be lifted only in the console. The payer address is screened again before resuming; if it is still blocked, the subscription stays paused. - A paused or unpaid subscription becomes **Completed** once all of its periods have passed. ## Cancellation | Cancellation | Description | |---|---| | By the merchant | Select **Cancel subscription** on the detail page and confirm, or call the business API | | By the payer | The payer cancels in "My subscriptions", or directly on chain | | Unpaid after grace | Canceled by the system when the plan is set to cancel at the end of the grace period | | Allowance revoked | When the allowance reads 0 and is still 0 on a recheck 5 minutes later, it is treated as cancellation by the payer | Cancellation has two steps: 1. **Off-chain cancellation** takes effect immediately; the keeper stops charging at once. 2. **On-chain cancellation** follows: the keeper calls the contract with the merchant's quote signature to cancel the subscription on chain, after which nobody can charge it. The **On chain** field on the detail page shows **Being canceled on chain**, then **Canceled on chain**. A cancellation the payer sends on chain is indexed and the subscription becomes **Canceled**. If the on-chain cancellation cannot be completed, the system raises an alert. :::caution A period that is charged after the off-chain cancellation but before the on-chain cancellation lands is recorded separately and raises an alert; the merchant returns it to the payer with a separate transfer. A second on-chain charge of a period that was already paid is labelled **Duplicate** in the charge list and must be returned as well. ::: ## What the keeper does The keeper is the background task that charges subscriptions. It runs every 30 seconds and sends its transactions from the hot wallet. | Step | Behaviour | |---|---| | Screen | The payer address of each due subscription is screened first. On a block-level hit the subscription is paused and the period is not charged | | Recheck | Confirms the subscription is still valid, the on-chain subscription is unchanged, the period has not been charged, and no payment-method switch in flight or pending plan change covers the period | | Simulate and send | The charge is simulated first and, if it passes, sent from the hot wallet | | Book | Once the charge reaches its confirmations it is booked, and the webhook and charge receipt are sent | | Cancel on chain | Cancels on chain every subscription that was canceled in the system, and every on-chain subscription replaced by a payment-method switch | - Keeper charges and on-chain cancellations are the system's own transactions. They are sent on chains in any gas mode, are not limited by the sponsorship budget and do not count as sponsorship spending. They remain subject to the gas price cap and the hot wallet balance. - When transactions cannot be sent because of the node, the balance or the price cap, an alert is raised for that chain; it clears when a keeper transaction next goes out. - Subscriptions that cannot progress for the moment back off for 1, 2, 4 minutes and so on, up to 1 hour. - No charges are made while a token is under an emergency pause. - After an outage the keeper charges only the current period; earlier periods are not charged retroactively. ## Dunning When a charge fails because of insufficient balance or allowance, the subscription enters dunning: 1. The subscription becomes **Past due**. The system sends the `subscription.charge_failed` webhook and the **Charge failed** receipt, which includes guidance. 2. Within the grace period the keeper retries at the plan's retry intervals. The detail page shows when the subscription became past due, the next retry and the last error. 3. When a retry succeeds the subscription returns to **Active**. 4. If the grace period ends without a successful charge, the subscription becomes **Unpaid** or is canceled, as the plan specifies. In "My subscriptions" the payer can top up the balance, renew the allowance, or change the payment method (another wallet, token or network). If the period is already due, the transaction that changes the payment method charges it immediately. The system also notifies the business system at these points: | Event | When | |---|---| | `subscription.trial_will_end` | Before a trial ends (the number of days is set in the receipt settings; 3 by default) | | `subscription.allowance_low` | Once, when the remaining allowance no longer covers the remaining periods | For all events, see [Webhooks](/en/developers/webhooks/). ## Receipts Subscription receipts are sent to the subscription's receipt email and are managed under **Collection → Receipts & email**. | Receipt | When it is sent | |---|---| | Subscription started | When a subscription or trial starts | | Charge successful | When each charge is confirmed | | Charge failed | On entering the grace period, with guidance | | Trial ending soon | A set number of days before a trial ends | | Subscription cancelled / completed | When a subscription ends | - The **Receipts** tab turns each receipt type on or off, sets the merchant details and footer note shown on receipts, and previews each type per language with a test send. - The **Mail server** tab holds the sending provider (or SMTP server). Without one, receipts and notices are not sent. - The **Delivery log** tab lists each email with its status; sent and failed emails can be resent. - Subscription receipts carry a link for managing the subscription, which leads the payer to "My subscriptions". After sign-up the receipt email can be changed only there. - When a plan change applies, a plan-changed receipt is sent; it follows the on/off setting of the started receipt. ## Related pages - [Payment flow](/en/checkout/payment-flow/) - [Gas and hot wallets](/en/console/gas-and-hot-wallets/) - [Risk screening](/en/console/risk/) - [Webhooks](/en/developers/webhooks/) --- # Payees and split rules URL: https://docs.flowpayra.com/en/console/payees-and-splits/ A payee is a party that receives funds: the merchant itself, a partner, a channel or a supplier. Every payment of an order or subscription is divided among the payees' addresses according to a split rule, inside a single on-chain transaction. This page covers **Collection → Payees & rules**. Register at least one payee and set a default split rule before taking payments. ## Concepts | Concept | Description | |---|---| | Payee | A recipient of funds, registered by an admin in the console. The business system refers to it by `payee_id` or `payee_ref` (the API reference) | | Primary payee | The payee that stands for the merchant itself. There is exactly one. It is the destination of hot wallet withdrawals and heads the payee statement | | Split rule | How funds are divided among payees: by ratio only, or as fixed amounts plus ratios | | Split whitelist | The set of registered payee addresses. While it is on, orders and subscriptions can split funds only to registered payees | The first member of every split rule must be a ratio member. It takes the rounding remainder and bears refunds for the order. It is normally the merchant itself. ## Registering a payee Registering or changing a payee address changes where funds go. Only admins can do it, and each address needs its own step-up verification. 1. Open **Collection → Payees & rules** and select **Register payee**. 2. **Step 1 · Payee**: enter the name and the **API reference** (used as `payee_ref` in API orders; 1–64 letters, digits or `-`, `_`, `.`; fixed once registered), and choose whether this is the primary payee. When it is, a 100% default split rule can be created at the same time. 3. **Step 2 · Addresses**: enter an address for each chain family (see below). Any of them can be added later; chains without an address do not pay this payee. 4. **Step 3 · Review**: check each address and type its last four characters. This guards against address poisoning. 5. Select **Submit** and complete each security verification when prompted. Keep the window open while submitting. If submission stops part-way, the completed steps are kept and the rest can be continued from the payee list. With dual approval on, an address change shows **Awaiting approval** and takes effect once another admin approves it; see [Admins and passkeys](/en/console/admins-and-passkeys/). ### Addresses per chain family | Chain family | Address format | Scope | |---|---|---| | EVM | Hexadecimal address starting with `0x` | One shared address serves every enabled EVM chain (testnets included). EVM chains enabled later use it automatically | | TRON | Base58 address starting with `T` | Registered per chain | | Solana | Base58 public key | Registered per chain | To use a different address on one EVM chain (for example a different wallet or contract account there), select **Set address** in the payee list after registering and set an address for that chain. The address used on a chain is its own address if one is set, otherwise the shared address. :::note Contract wallets such as multisigs may have different addresses on different chains, or exist on only some of them. When the shared address is a contract on some chains and a plain account on others, the console says so and recommends per-chain addresses. ::: ### Changing an address Select **Set address** in the payee list, enter the new address, confirm its last four characters, and complete step-up verification on submission. - The new address applies to orders and subscriptions created from then on. Active subscriptions keep paying the previous address. - The change is written to the audit log and other admins are notified. ### Changing the primary payee Select **Make primary** on the payee's row and complete step-up verification. With dual approval on, another admin must approve. ## Address checks ### Checks at registration and on change Each address is checked separately on every enabled chain it serves. A hit on any check rejects the registration before the verification step. | Check | Description | |---|---| | Token contract blocklists | Queries the blocklist or freeze list of every token listed on the chain (for example the blocklist functions of USDT and USDC) | | Risk lists and sanctions sources | The same sources used for payer screening; see [Risk screening](/en/console/risk/) | | Address type | A plain account passes. A contract address produces a notice and takes no part in native-coin splits, so that a failed transfer cannot fail the payment | | Address form | Checksum validation; not the zero address; not one of this system's contracts, the hot wallet or a quote signer address | ### Daily re-checks - Every payee address is re-checked once a day. - When a chain is enabled or a token is listed, all payees are checked again. A chain offers quotes only when the payee addresses have a passing result on it. - Before a quote is issued the system also simulates the split transfers, as a last check. ### When a re-check hits The address is blocked on the chain where the hit occurred: - Orders and rules that pay this payee stop receiving quotes on that chain. Other chains are unaffected. - The system sends the `system.payee_blocked` webhook (payee, address, chain and the source of the hit) and notifies the admins. - The list shows **Blocked** for that chain. Once the cause is resolved, select **Check again** to restore it, or set a different address for that chain. ## Split rules The **Split rules** tab lists every rule. Creating, editing and archiving a rule, and making one the default, each require an admin's step-up verification. ### The two kinds | Kind | Definition | Example | |---|---|---| | Ratio only | Each member has a ratio; ratios total 100% | Merchant 70%, partner 30% | | Fixed amount plus ratio | Some members take a fixed amount (with its currency, such as 2.00 USD); the others share "total − fixed part" by ratio. Ratios total 100%, and there is at least one ratio member | Service provider a fixed 2.00 USD; of the rest, merchant 85% and channel 15% | A fixed amount is counted in its own currency and is offered only on tokens pegged to that currency: 2.00 USD is never converted into a token of another currency or into a native coin. An order whose amount cannot cover the fixed splits is rejected at creation. ### Creating a rule 1. On the **Split rules** tab, select **New split rule**. 2. Enter the rule name. 3. Select **Add payee** for each member, choose its kind (**Ratio** or **Fixed**) and enter the value. The first member must be a ratio member. 4. Tick **Make default** if required. 5. Save and complete step-up verification. ### How rules are used - An order or subscription can name a rule (`split_rule_id`) or pass an inline list (`splits`). When neither is given, the default rule applies. A plan can set its own default rule. - A rule can be edited, made the default, or archived. Rules apply to orders and subscriptions created from then on; orders already created keep their splits, and active subscriptions keep theirs. ## The split whitelist switch The **Split whitelist** switch at the top of the page is on by default. | State | Behaviour | |---|---| | On (default) | Orders and subscriptions can refer only to registered payees, by `payee_id` or `payee_ref`. Even if the business system's API key leaks, funds cannot be split to unknown addresses | | Off | The business system, and the console's **New payment** and **New subscription**, may name recipient addresses directly in the split list, without registering them first | These checks still apply when the whitelist is off: - **Address form**: the same as when registering a payee. - **Risk screening**: every time a recipient is named by address, it is screened again on each chain that could pay the order or subscription. A hit on any chain rejects the order or subscription. - **First member**: when the split list contains an address, the first member must be a ratio member and a registered payee, so the remainder and refunds always fall to an address the merchant has registered. Recipients named by address appear on the **Non-whitelisted addresses** tab. They cannot be used in split rules, cannot be made primary, and their address cannot be changed. :::caution With the whitelist off, any system holding an API key can split order funds to any address that passes screening. Turn it off only when needed, and protect API keys carefully. ::: Only admins can change the switch. Every change requires step-up verification, is written to the audit log, and notifies other admins. With dual approval on, turning the whitelist off waits for another admin's approval; turning it back on takes effect immediately. ## Removing or disabling a payee Select **Remove** on a payee's row. What is possible depends on how the payee has been used: | Situation | What can be done | |---|---| | Not referenced by any order, subscription, split rule (archived ones included) or pending approval | It can be deleted. Deletion cannot be undone and removes its addresses | | It has history | It cannot be deleted; it can be disabled | | It is a member of a split rule in use | Remove it from those rules, or archive them, first | | It is the primary payee and is referenced | Make another payee primary first | Effects of disabling a payee: - It takes no new orders, split rules or primary-payee role. - Unpaid orders that pay it can no longer be paid. - Active subscriptions keep charging with their existing splits until they end. - Its history stays, and it can be re-enabled at any time with **Enable**. A primary payee that is not referenced can be deleted. The system then has no primary payee; hot wallet withdrawals need one, and it can be set again when registering a payee. Removing and disabling both require step-up verification and are written to the audit log. ## Related pages - [Overview and orders](/en/console/overview-and-orders/) - [Risk screening](/en/console/risk/) - [Gas and hot wallets](/en/console/gas-and-hot-wallets/) - [Integration guide](/en/developers/integration/) --- # Chains, tokens and merchant contracts URL: https://docs.flowpayra.com/en/console/chains-and-contracts/ The enabled chains and listed tokens define what the checkout can offer. This page covers **Collection → Chains & tokens** and **Security & access → Quote signer keys**, plus the checkout network order under **Merchant & checkout**. Taking a chain from added to ready for payments involves, in order: 1. Adding the chain with an RPC endpoint. 2. Preparing a quote signer key. 3. Deploying and verifying this merchant's contracts (on Solana, creating the merchant account). 4. Listing tokens. 5. Enabling the chain. A new chain is always added switched off. Adding a chain, changing chain settings and RPC endpoints, listing tokens and verifying contracts require the admin role and step-up verification. ## Chain families FlowPayra Lite supports three chain families. They differ in address format, contract model and quote signer key: | Chain family | Merchant contracts | Quote signer key | |---|---|---| | EVM | This merchant's Router and Subscriptions contracts, created through the shared factory | secp256k1 | | TRON | This merchant's Router and Subscriptions contracts, created through the shared TRON factory | secp256k1 (shared with EVM) | | Solana | A merchant account under the shared program | ed25519 | ## Adding a chain ### Built-in presets The system ships presets for common networks, covering the chain identifier, name, native coin, network type, confirmations and block explorer: | Chain family | Presets | |---|---| | EVM mainnets | Ethereum, BNB Smart Chain, Polygon, Avalanche C-Chain, Arbitrum One, OP Mainnet, Base, X Layer, Linea, Scroll, Gnosis, Celo, Arc, Robinhood Chain | | EVM testnets | Sepolia, BNB Smart Chain Testnet, Polygon Amoy, Avalanche Fuji, Arbitrum Sepolia, OP Sepolia, Base Sepolia, X Layer Testnet, Linea Sepolia, Scroll Sepolia, Gnosis Chiado, Celo Sepolia, Arc Testnet, Robinhood Chain Testnet | | TRON | Mainnet, Nile, Shasta | | Solana | Mainnet, devnet, testnet | :::note The shared contracts are deployed on six EVM mainnets (Ethereum, BNB Smart Chain, Base, X Layer, Arc and Robinhood Chain) and on the Sepolia, Arc testnet, TRON Nile and Solana devnet test networks; their addresses are listed in [Security reviews](/en/security/audits/). On a network without them, the deployment checklist reports the shared contracts as missing. ::: ### Adding an EVM chain 1. Open **Collection → Chains & tokens**, select **Add chain**, and choose the **EVM** chain family. 2. Enter the **RPC URL**. **Built-in network (optional)** can be left blank so the network is detected from the RPC; when one is chosen, the chain ID the RPC returns is checked against it. 3. The system probes the endpoint and fills in what it finds: - the chain identifier and latest block, and whether it is a built-in network or a custom chain; - the block time, measured from recent blocks; - the confirmations (the recommended value for a built-in network; for a custom chain, derived from the block time for about a 2-minute wait); - the block explorer and network type; - the contract check: whether the shared contracts are present on the network. 4. For a custom chain, add the name, native coin symbol and block explorer. 5. Select **Add chain** and complete step-up verification. On adding, the system probes the chain's capabilities automatically: dynamic fees (EIP-1559), the `safe` / `finalized` finality tags, the block span of a single log query, and whether the CREATE2 deployment proxy, Permit2 and Multicall3 are deployed. From these it suggests a confirmation method and fee handling. The results appear on the chain's **Settings** tab, where **Probe again** reruns them. ### Custom EVM chains An EVM-compatible chain that is not a preset can be added as a custom chain; the console labels it **Custom**. Compared with a built-in network: - The name, native coin symbol and block explorer are entered by hand (a local devnet needs no explorer). - Confirmations are the number of blocks in about 2 minutes at the measured block time, and can be adjusted afterwards. - An icon can be set for the chain. - The chain can be enabled only after its contracts are verified. ### Adding a TRON or Solana chain With the **TRON** or **Solana** chain family, a wizard runs in four steps: **1. Chain**, **2. Node and details**, **3. Deployment**, **4. Probe and enable**. The steps can be finished later from the chain's cards. | Chain family | Node and details | |---|---| | TRON | The JSON-RPC URL must end in `/jsonrpc`; TronGrid is the default. The HTTP API base URL, Solidity node URL and TronGrid API key are optional. On TronGrid mainnet an API key is required before enabling | | Solana | Enter the RPC endpoint (`https://`) and the commitment. Leave the program id empty for FlowPayra's official program. With `finalized`, payments are booked after about 13 seconds; `confirmed` is faster but may still roll back | The server checks the conditions for enabling and reports what is missing: complete node details and a healthy endpoint; for TRON, recorded contracts; for Solana, a merchant account on chain that matches the active ed25519 quote signer key. ### Network type Every chain is a mainnet, a testnet or a local devnet. The network type decides routing: live orders are paid on mainnets, test orders on testnets, and local devnets take both. Built-in testnets are marked as testnets when added. The network type can be changed in the chain settings, with step-up verification. ### Enabling and disabling The **Enabled** switch at the top right of the chain's page controls whether the chain is offered at the checkout. Once disabled, the chain is removed from the checkout at once; payments already submitted are tracked to completion, and subscriptions in progress on the chain keep charging on schedule. ## RPC endpoints and failover Each chain can have several endpoints, managed on its **RPC endpoints** tab. Two or more https endpoints and a wss endpoint are recommended. URLs that contain keys are stored encrypted. | Setting | Description | |---|---| | Roles | Read, Broadcast, Subscribe. https endpoints read and broadcast transactions; wss endpoints deliver new heads | | Priority | Lower goes first | | Weight | Share of reads within a priority | | Log block span | The largest block range of a single log query | | Rate limit (req/s) | Empty for no limit | | Enabled | A single endpoint can be disabled. The last readable https endpoint cannot be removed or disabled | **Health checks.** Every 15 seconds each endpoint is probed for chain ID, head and latency. An endpoint that falls clearly behind the highest head, or responds too slowly, is marked **Degraded**. Repeated failures mark it **Down** until it is retried after a backoff. An endpoint that returns the wrong chain ID is disabled. **Failover.** Reads go to healthy endpoints first, by priority, and rotate by weight within a priority; on failure the next endpoint is tried. An error in which an endpoint reports trouble of its own (a rate or usage limit reached, historical data that needs a paid plan or an API key, an unsupported method, missing block state, a busy backend and so on) also moves the read to the next endpoint and counts as a failure of that endpoint; an error about the request itself, such as a contract revert, is returned as the answer. TRON and Solana endpoints follow the same rule. Transactions are broadcast to every endpoint that has the broadcast role. When every endpoint of an enabled chain is unavailable, the system raises an alert. **Listening.** With a wss endpoint the system subscribes to new heads and scans at once; if the subscription drops, it falls back to polling at the block time. Booking always follows the index scan. **Confirmation.** By block count, or by the endpoint's `safe` / `finalized` block tag (support is checked when the setting is saved). **Reconciliation.** Every hour the system rechecks recent payment events against another endpoint and recovers any that are missing. **Public RPC (for wallets adding the network)** is used when a payer's wallet lacks the network: the checkout passes it to the wallet when adding the network. Never enter an endpoint that contains an API key here. ## Listing tokens ### Adding a token 1. On the chain's **Tokens** tab, select **Add token**. 2. Enter the token contract address. Optionally enter a display symbol (the contract's symbol is used when left empty), the peg currency (USD, EUR and so on for stablecoins; empty for other tokens) and a holder address (used to simulate a transfer and detect transfer fees). 3. Start the probe and add the token. 4. The token is added unlisted. After reviewing the probe result, turn on its listing switch in the table. On a Solana chain, enter the mint address and the token program (Token or Token-2022); the symbol is required. Token-2022 extensions are checked against an allow list: mints with transfer fees, transfer hooks, a permanent delegate, non-transferable tokens, or an extension the list does not name are not accepted (see Networks and tokens). ### Capabilities probe When a token is added, the system probes: | Probed | Purpose | |---|---| | Symbol, name, decimals | Display and amount conversion | | Authorization support (EIP-3009, EIP-2612, DAI permit, Permit2) | Decides which authorization methods the checkout can use and whether gas can be sponsored. EIP-3009 must pass a simulation: `receiveWithAuthorization` accepts calls only from the receiving address named in the authorization, and refuses signatures of another type and invalid signatures. A token that fails it, or whose check meets a node error, is not treated as supporting EIP-3009 | | Blocklist or freeze query function | Used by payee address checks | | Transfer fees and rebase interfaces | The token is refused if either is detected | | Proxy implementation address | For upgradeable proxy tokens the implementation is recorded and shown as proxy → implementation | For an upgradeable proxy token the implementation is checked every hour. When it changes, the token is paused, quotes already issued are withdrawn, the token is probed again and an alert is raised. The token can be resumed only after an admin has reviewed the new implementation in the console with **Review**. ### Forced method The **Forced method** column sets, separately for one-time payments and subscriptions, EIP-3009, Permit, Permit2 or Approve (limited to what the probe detected). The default is **Automatic**. With a method chosen, the checkout starts with it and keeps approve as the fallback when a signature is declined. The methods are described in [Networks and tokens](/en/checkout/networks-and-tokens/). ### Icons Icons can be set only for custom chains and custom tokens that have no bundled icon. Chains and tokens with a bundled icon always use it. - Upload an image: PNG, JPEG or WebP, up to 64 KB, 16–1024 pixels per side, at most twice as wide as high. SVG is not accepted. - Or enter an https image URL: the server fetches it once, stores it and serves the image itself. The checkout loads no external images. - When an icon is removed, the first letter is shown instead. ### Emergency token pause The token view groups tokens by symbol across chains and offers an emergency pause: a token can be paused or resumed on all chains by its symbol. While paused, the token disappears from every checkout, new quotes are refused, issued quotes are withdrawn, sponsorship is refused and subscriptions are not charged. Operators can pause; resuming requires an admin and step-up verification. A price feed can also be set for each pegged token to watch for a depeg: the system records the peg price periodically and raises an alert when it deviates beyond the threshold or the feed cannot be read. ## Quote signer keys A quote signer key signs quotes and subscription terms. Its address is embedded in the merchant contracts on every chain, and the contracts accept only quotes signed by it. Keys are managed under **Security & access → Quote signer keys**. ### Key schemes and states - secp256k1 keys sign on EVM and TRON chains; an ed25519 key signs on Solana chains. One key of each scheme is active at a time. - A key moves through Pending, Active, Retiring and Retired. In an emergency rotation the old key is also marked Compromised. ### Local keys Select **Generate a key**, choose the key scheme and enter a name. The key is generated on the server and stored encrypted under the master key. The private key never reaches the browser, and the console neither shows nor downloads it. An offline backup is made on the server, for secp256k1 and ed25519 (Solana) keys alike: ```sh flowpayra-lite signer export --address
--out flowpayra-lite signer check-backup --keystore --expect
``` The backup file is encrypted under a password of at least 12 characters; keep the password apart from the file. `check-backup` needs neither the database nor the master key, so it runs on an offline machine; `signer import --keystore ` restores the backup as the same key (pending). ### KMS keys A secp256k1 key can also live in AWS KMS or Google Cloud KMS. The private key stays in the KMS; the system requests signatures by digest and checks each one locally against the signer address. This feature is off by default. 1. Under **Signing backends / KMS** at the bottom of the page, select **Switch KMS on**. 2. Select **Add KMS connection**, choose the service, and enter its location and credentials: - AWS KMS: the region and an optional endpoint. Credentials are an access key, or the server environment (environment variables, task role or instance role). - Google Cloud KMS: an optional endpoint. Credentials are a service account key file, or the metadata server. 3. Test the connection. 4. Add a key from the KMS: choose the connection and enter the key. The system derives the signer address from the public key and registers it as a pending key. 5. From there the steps are the same as for a local key: deploy and verify the merchant contracts, then activate. | Item | Description | |---|---| | Key specification | `ECC_SECG_P256K1` on AWS KMS; `EC_SIGN_SECP256K1_SHA256` on Google Cloud KMS | | Credentials | Stored encrypted under the master key and not shown again | | Backup | A KMS key cannot be exported; backup and durability are the cloud provider's responsibility. Keep the key and its access until every subscription on its merchant contracts has ended | | When unavailable | The system does not fall back to another key. The checkout stops quoting and an alert is raised; the alert clears when the KMS recovers | | Scope | Quote signer keys (secp256k1) only. ed25519 keys and the hot wallet remain local keys | ### Rotation The signer address embedded in the merchant contracts cannot be changed, so replacing a key means deploying a new set of merchant contracts for the new key. 1. Generate a new key (or add one from a KMS). It starts as **Pending**. 2. On the key's card, select **Contracts** for each chain, then deploy and verify that chain's merchant contracts for the new key. 3. Once every enabled chain has verified contracts, select **Activate this key** and type the last 4 characters of the new signer address to confirm. 4. New quotes and subscription terms now use the new key and its contracts. The previous key becomes **Retiring**: payments made with its quotes within their validity still land and are booked, and subscriptions on its contracts keep charging on schedule. 5. After all of the previous key's quotes have expired, select **Retire**. A retired key is still used to cancel the subscriptions on its contracts on chain, so it must be kept until those subscriptions have all ended. **Emergency rotation.** When the current key has leaked or is suspected to have leaked, use **Emergency activation (current key leaked)**. The new key is activated at once and the previous key is marked as compromised. Its open quotes and unsubmitted subscription terms are withdrawn immediately and payers obtain new quotes. The compromised key's contracts book only payments that match quotes this system issued. **Moving subscriptions.** Subscriptions on the previous key's contracts are not moved automatically. **Ask payers to move subscriptions** sends the `subscription.migration_requested` event to the business system; payers then re-authorize to the new contracts in "My subscriptions", using the change-payment-method flow. Rotation actions require the admin role and step-up verification each time, are written to the audit log, and notify other admins. ## Deploying and verifying merchant contracts ### Shared contracts and merchant contracts | Category | Contents | Deployed by | |---|---|---| | Shared contracts | EVM: the CREATE2 deployment proxy, Permit2, the FlowPay factory and implementations. TRON: the factory. Solana: the official program | FlowPayra, once per network; shared by every merchant. On EVM chains their addresses are the same everywhere, whoever deploys them | | Merchant contracts | EVM and TRON: this merchant's Router and Subscriptions. Solana: the merchant account | The merchant, from the console | The deployment checklist in the console only shows the state of the shared contracts; a merchant neither needs to nor can deploy them from the console. Where a network has no shared contracts, the checklist says so and gives the deploy command (`deploy/shared-contracts.sh ` for the networks the repository script supports, `flowpayra-lite deploy factory --rpc ` for other EVM networks); merchant contracts can be created only on networks that have them. The merchant contracts embed the quote signer's address, so first generate and activate a secp256k1 key on the **Quote signer keys** page. Without an active key, the chain page and the **Contracts** tab point to that step. The sender of a deployment transaction gets no rights over the contracts: whoever pays the gas, the result is the same. ### EVM 1. On the chain's **Contracts** tab, select **Deploy**. When rotating a key, open **Contracts** from that key's card on the **Quote signer keys** page instead. 2. The checklist shows the CREATE2 deployment proxy, Permit2, the FlowPay factory and implementations, the merchant Router / Subscriptions and the quote signer. Contracts that already exist are only verified. 3. Select **Deploy** for the merchant Router / Subscriptions and send the transaction, paying its gas, in one of these ways: - a browser wallet, or a mobile wallet connected through WalletConnect; - a deployment private key entered in the page. The key signs in the page only and the server relays just this one deployment. A throwaway key holding only the gas is recommended. 4. Once the deployment confirms, verification and recording start by themselves; complete step-up verification. The system compares each contract's code hash with the release and, if they all match, records the contract addresses. If you dismissed the verification, select **Verify and record** below the checklist later; the addresses follow from the quote signer's address, so nothing is lost. Once verified and recorded, the chain can be enabled. Without an active quote signer key, or without its merchant contracts on the chain, enabling is refused with the reason. Multicall3 is optional; FlowPay does not depend on it. ### TRON 1. Open the chain's contract deployment dialog. It shows the official factory FlowPayra deployed on this network. 2. Choose **TRON wallet** (a browser wallet such as TronLink, OKX or Bitget) or **Private key**, then select **Sign and deploy**. The page shows the estimated TRX cost and the deploying account's balance; the account needs enough TRX for the energy. 3. When the transaction is on chain, the Router and Subscriptions addresses are read from the factory and filled in. 4. Recording starts right away; complete step-up verification. If you dismissed it, select **Verify and record** later. The dialog also offers a command-line method as a fallback. ### Solana A Solana chain has no contracts to deploy. Instead, a merchant account is created under the shared program. The merchant account derives from the active ed25519 quote signer key and the network (cluster): each network has its own, at its own address. 1. Generate and activate an ed25519 key on the **Quote signer keys** page. 2. Create the merchant account in one of two ways: - With a Solana hot wallet configured, enabling the chain creates the account from the hot wallet automatically. - Without a hot wallet, select **Create merchant account** for the chain, choose **Solana wallet** (Phantom, Solflare, Backpack and others) or **Private key**, then select **Sign and create**. The key signs in the browser only and is never sent to the server; after the paying wallet signs, the server adds the quote signer's signature and sends the transaction (the program requires both). 3. Select **Verify and record** and complete step-up verification. Creating the merchant account costs a rent deposit and a transaction fee, paid by the wallet that sends the creation. The dialog shows the amounts and the paying address's balance. A merchant account created on Solana devnet before 2026-11-16 (the format before internal review round 3) can no longer be used once the program is upgraded: the page says it must be created again; create the new merchant account with the steps above, and it replaces the old one. Subscriptions on the old account must be opened again by their payers. :::note Solana transactions are built in the legacy format where possible: a legacy transaction holds at most 6 payees (5 when sponsored), and beyond that a v0 transaction is built with the merchant's address lookup table. Without a Solana hot wallet no address lookup table is set up, and orders with more than 6 payees cannot be paid on Solana. ::: ## Checkout network order The checkout lists networks in the order the merchant sets: the first 3 are shown, the rest under **More**. A payer whose browser wallet is on a supported network starts on that network. 1. Open **Collection → Merchant & checkout**, find the **Checkout network order** card on the **Merchant and look** tab, and select **Edit**. 2. Move networks up or down, or select **Sort by name** to return to the default. 3. Select **Save**. - With no custom order, networks are sorted by name. - With a custom order, networks enabled later follow by name. - The same order is used on subscription pages and when changing the payment method in "My subscriptions". For what the payer sees, see [Networks and tokens](/en/checkout/networks-and-tokens/). ## Related pages - [Gas and hot wallets](/en/console/gas-and-hot-wallets/) - [Admins and passkeys](/en/console/admins-and-passkeys/) - [Deployment](/en/start/deployment/) - [Security model](/en/security/model/) --- # Risk screening URL: https://docs.flowpayra.com/en/console/risk/ Risk screening refuses payments and subscriptions from risky addresses. The system screens the payer address before issuing a quote, before a sponsored submission, at booking, and before each subscription charge, and uses the same sources to check payee addresses. This page covers **Risk → Risk controls**. The page has five tabs: **Overview**, **Address list**, **List sources**, **Third-party screening** and **Amount limits**. Changes to lists and policy require the admin role and step-up verification and are written to the audit log. The finance role is read-only. ## The screening switch The **Payer screening** switch at the top right of the page is off by default. | State | Behaviour | |---|---| | On | Payments and subscriptions from addresses with a block-level hit are refused, and orders paid from addresses with a review-level hit are flagged | | Off | Lists can still be edited and risk labels still show beside orders and tickets, but no payment is blocked. Third-party providers and the sanctions oracle are not called | :::caution Built-in lists are not controlled by this switch. While it is off, quotes, sponsored submissions, subscription charges, booking and refunds are still screened against the built-in lists. ::: ## Verdict levels Every list entry carries a level: | Level | Behaviour | |---|---| | Block (`block`) | No quote is issued and the checkout asks the payer to use another wallet. A payment from an address that was listed only after the quote is frozen at booking | | Review (`review`) | Payment is allowed. Once booked, the order is flagged for review and the admins are notified | | Allow (`allow`) | An exception for false positives. It overrides other lists, the oracle and third-party results | **Merging.** When several sources have a result for one address, a block from a built-in list comes before everything. Otherwise an allow from any source outranks a block, and a block outranks a review. Each entry keeps its source, so hit records and risk labels show which list produced the hit. ## Policy The **Policy** card on the **Overview** tab shows how each level is handled and sets what happens **When a source is unavailable**: | Option | Behaviour | |---|---| | Allow and flag for review (default) | Payment is allowed while a source is unavailable; the order is flagged for review | | Refuse the payment | Quotes are refused while a source is unavailable | **Check an address** screens one address on every enabled chain with the current sources and policy. Use it to confirm how a particular address would be treated. ## List sources ### Own list The merchant's own list. Changes apply at once. Entries arrive in three ways: added in the console, imported from a file, or synced through the business API. On the **Address list** tab, select **Add address** and fill in: | Field | Description | |---|---| | Address | The address to list | | Chain | All chains, or selected chains | | Category | Sanctions, Scam, Hack, Mixer, False positive, Other | | Level | Block, Review, Allow | | Note | Visible in the console only; never shown to payers | | Expires | Leave empty to keep the entry indefinitely | ### Importing a list **Address list → Import a list** accepts a CSV, JSON or TXT file, or pasted contents, up to 16 MB and 100,000 entries per file. 1. Choose a file or paste the contents, and select the file format. 2. Choose **Import into**: the own list, or a named list (a new name creates one). 3. Choose the **Mode**: - **Append** adds entries; an address already on file for the same chain takes the file's values. - **Replace** leaves the list holding only the file's entries. 4. Optionally set the default level, category and chain for entries that do not state them. 5. Select **Preview**. It shows the number of valid, invalid and duplicate records, how many entries will be added, updated and removed, a sample, and the lines with errors. Previewing needs no step-up verification. 6. Select **Import** and complete step-up verification. Valid entries are imported; invalid lines are skipped. File formats: | Format | How it is read | |---|---| | CSV | With a header, columns are found by name (`address`, `level`, `category`, `chain_id`, `reason`, `expires_at`). Without a header, the column order is `address,level,category,chain_id,reason,expires_at`. An empty `chain_id` means all chains; separate several chains with `;` | | JSON | An array of address strings or objects, possibly under a field of the top-level object such as `data` | | Text | One address per line; the rest of the line is the note. Lines starting with `#` are comments | ```csv address,level,category,chain_id,reason,expires_at 0x1111111111111111111111111111111111111111,block,scam,,chargeback ring, 0x2222222222222222222222222222222222222222,review,mixer,1;56,,2027-01-01 ``` ### Named lists A named list is a list the merchant maintains under its own name, for example one synced from an in-house risk system. It is created the first time a file import or the business API writes to it, and is filled the same way afterwards. Under **Named lists and feeds** on the **List sources** tab, its description can be edited and the list deleted together with its entries. ### Feeds (remote lists) A feed is downloaded from a URL on an interval. Under **Named lists and feeds**, select **Add a feed** and set: | Setting | Description | |---|---| | Name | 1–40 lowercase letters, digits, `_` or `-`; fixed once created. Hits show this name as their source | | List URL | http(s). Credentials go in the auth header, not in the URL | | Auth header and credential | The header defaults to `Authorization`. The credential is stored encrypted. Leave it empty when the URL needs none | | File format | CSV, JSON or text; column or field names can be specified | | Default level, default category, chain | Applied to entries that do not state them | | Import interval | 1–168 hours; 24 by default | | Import on the interval | The on/off switch | Behaviour: - Each import replaces the feed's previous entries with the file's contents and counts what was added and removed. **Import now** runs one immediately (step-up verification required). - If the download fails, the file has no valid record, or it exceeds 32 MB or 200,000 entries, the existing entries are kept and an alert is raised. The import is retried after an hour, and the alert clears on the next successful import. - A feed whose default level is allow holds allow entries only. A feed whose default level is block or review accepts no allow entries, so a remote file cannot lift another source's block. ### OFAC SDN list The system imports the digital currency addresses on the US Treasury's OFAC sanctions list and adds them at the block level, in the sanctions category, for all chains. - The list is imported once a day. **Import now** on the OFAC card runs it immediately (step-up verification required). - When payer screening is turned on, the daily OFAC import turns on with it by default. Once an admin switches it on or off explicitly, that choice stands; **Restore the default (follow payer screening)** returns to following the switch. - Addresses removed from the official list are removed at the next import. - If the download fails or no address can be parsed, the current list is kept, an alert is raised, and the import is retried after an hour. - The list URLs can be pointed at a mirror. Both `SDN.CSV` and `SDN_COMMENTS.CSV` are needed. ### Third-party providers Configure and enable each provider on the **Third-party screening** tab: | Provider | Description | |---|---| | Chainalysis | Free sanctions API; any identification blocks | | TRM Labs | Address screening: severe-risk entities or sanctions exposure block; high risk goes to review | | TRM sanctions (free) | Free sanctions API; sanctioned addresses block | | Elliptic | Wallet screening: a sanctions trigger or a score at the block threshold blocks; a score at the review threshold goes to review | | AMLBot | Blacklist or sanctions signals block; otherwise risk score thresholds decide between review and block | | Custom API | The merchant's own screening service, answering in the agreed format | - Credentials are stored encrypted. Configuration requires step-up verification and is written to the audit log. **Test** sends a test call to a provider. - Answers are cached for 24 hours per provider, address and chain, and merged with the results of lists and the oracle. - When a provider is unavailable, the **When a source is unavailable** policy applies and an alert is raised. The custom API contract: ```http GET {base_url}/v1/address/{address}?chain_id={id} Authorization: Bearer {token} ``` ```json { "risk": "block", "category": "sanctions", "labels": ["example"] } ``` `risk` is `block`, `review`, `allow` or `none`; `category` is `sanctions`, `scam`, `hack`, `mixer` or `other`. The `Authorization` header is optional. ### Chainalysis sanctions oracle (deprecated) The Chainalysis sanctions oracle is an on-chain contract. The system calls its `isSanctioned(address)` function and caches the result for 24 hours. The contract address is entered per chain and is called once for validation before saving; leave it empty to skip a chain. :::caution Chainalysis no longer maintains this oracle: its list has not been updated since 18 March 2026, and newly sanctioned addresses are not added. Treat it as a supplementary source only. In production, rely on the OFAC SDN import, and configure at least one third-party provider. ::: ### Built-in lists Built-in lists ship with the system: - they always apply, whatever the payer screening switch says; - an allow entry cannot override a built-in block; - the lists and their entries cannot be edited, imported into, removed or deleted. The console shows them read-only with their publication date. One list is included. It comes from an FBI alert published on 31 October 2026 and contains 608 Ethereum addresses and 1 Solana address, in the hack category, at the block level, for all chains. Its Ethereum addresses also cover TRON payer addresses. ### Business API The business system can read and write risk lists through the business API, with the `risk:read` and `risk:write` scopes. These two scopes are not among an API key's default scopes and must be ticked when the key is created. A test API key can write only entries whose chain is a testnet. See [API](/en/developers/api/). ## Where screening runs | Point | Behaviour | |---|---| | Before a quote | After the payer connects a wallet, the payer address is screened; a quote is issued only if it passes. The quote is bound to that address, and the contract accepts payment or a signature from that address only | | Before a sponsored submission | When the system sponsors gas, the address is screened again before the transaction is submitted. On a hit the hot wallet spends no gas | | At booking | Rechecked inside the same transaction that books the payment | | Before each subscription charge | On a block-level hit the subscription is paused and the period is not charged | | Payee addresses | The same sources are used at registration, on change and in the daily re-check; see [Payees and split rules](/en/console/payees-and-splits/) | ### At quote time On a block-level hit no quote is issued. The checkout tells the payer that the current wallet address did not pass risk screening and offers to change the wallet or contact the merchant. The reason for the hit is not shown. ### At booking **Block level: the payment is frozen.** When the payer address was added to a block-level list only after the quote, the payment is frozen at booking: - The payment record is kept but does not count toward the order: the order does not become paid, and `order.paid` is not sent. - A frozen payment cannot be refunded. - The system sends the `order.payment_frozen` webhook and raises an alert. - The checkout tells the payer that the payment did not pass risk screening, that the order was not completed, and to contact the merchant. The reason is not shown. :::caution The funds have already reached the payee addresses; the system cannot freeze them on chain. The merchant should hold the funds and follow its compliance process, and should not send them back to the payer address. ::: **Review level: the order is flagged.** The order is flagged for review and its events carry a risk flag, so the business system and operators can check it manually. ### Releasing a frozen payment When the hit is confirmed to be a false positive: 1. Add the address to the list at the **Allow** level. 2. Open the order, find the payment under **Frozen payments**, select **Release**, confirm, and complete step-up verification. Before releasing, the payer address is screened again against every source. If the result is still a block, the payment stays frozen. Once released, the payment counts toward the order under the normal rules; the order may become paid and the business system is notified. The action is written to the audit log. **A hit on a built-in list can never be released.** ### Subscriptions Before each charge the keeper screens the payer address. On a block-level hit the subscription is paused and the `subscription.risk_paused` webhook is sent. Such a pause can be lifted only in the console; the address is screened again first, and the subscription stays paused if it is still blocked. See [Subscriptions](/en/console/subscriptions/). ### Refunds The system refuses refunds to a payer address that fails risk screening, so that sanctioned or stolen funds are not returned to the payer. While the screening switch is off, built-in lists decide. ## Risk labels and the hit log - A risk label with source and category is shown beside the payer address on orders, subscriptions, payment lookup results and tickets. - From those places, **Add to block list** and **Allow this address** update the list directly. - Every block and every flag is recorded in the hit log. The **Related** column of the address list shows the hits for an address, for example a checkout block and the order concerned. - The **Overview** tab counts listed addresses, blocks today (split into checkout and sponsored submissions), flagged orders and allow exceptions. ## Amount limits The **Amount limits** tab sets limits in one price currency. Orders priced in another currency are not limited, and limits apply to live orders only. | Limit | Behaviour | |---|---| | Minimum per order, Maximum per order | An order outside the range is refused at creation | | Per wallet, 24 hours | Counts what one wallet has paid on every chain | **Over the wallet limit** has two policies: | Policy | Behaviour | |---|---| | Refuse payment | The checkout refuses a quote that would take the wallet over the limit and asks the payer to use another wallet or try later. A payment that still lands over the limit is flagged for review | | Allow, flag for review | The payment goes ahead; the order is flagged for review and logged | ## Test mode Test payers are screened against local lists only (the own list, the OFAC list, feeds and named lists). The sanctions oracle and third-party providers are not called. A test wallet can be added to a list to rehearse the block flow. Amount limits do not apply in test mode. ## Compliance note Use of third-party screening data is subject to the provider's terms of service. Each merchant is responsible for assessing the regulatory requirements that apply to accepting crypto payments in its jurisdictions. ## Related pages - [Payees and split rules](/en/console/payees-and-splits/) - [Admins and passkeys](/en/console/admins-and-passkeys/) - [Webhooks](/en/developers/webhooks/) - [Security model](/en/security/model/) --- # Gas and hot wallets URL: https://docs.flowpayra.com/en/console/gas-and-hot-wallets/ Gas on each chain is paid either by the payer or by the system. With gas sponsorship, the payer only signs and the system's hot wallet submits the transaction and pays its gas. This page covers **Collection → Gas & hot wallet**. The page lists every chain, including chains that are not enabled yet, so they can be set up in advance. Changing gas settings requires the admin role and step-up verification. ## Gas modes ### EVM chains In the **Gas mode per chain** table, each EVM chain uses one of three modes: | Mode | Behaviour | |---|---| | Payer | The payer pays gas; the payer's wallet sends the transaction | | Sponsored | The system pays: the payer only signs and the hot wallet submits. The checkout offers only methods that can be sponsored | | Sponsored first | Sponsored where possible; when the current method cannot be sponsored, the payer pays gas. This is the recommended sponsorship setting | Select **Edit** on a chain's row to set: | Setting | Description | |---|---| | Gas mode | Payer, Sponsored or Sponsored first | | Daily budget | The cap on a day's sponsorship spending on the chain, in its native coin | | When spent | **Payer pays gas** or **Stop sponsoring** | | Max gas price (gwei) | Above this price the hot wallet sends no transactions | | Sponsor switches | Whether payment-method switches of subscriptions are sponsored. Off by default; see below | ### TRON chains TRON fees are counted in energy and bandwidth, which come from an account's staked TRX. On TRON chains the payer pays by default. Select **Edit** on the chain's card to turn on **Sponsor energy (delegation)**: - When on, one-time payments are sponsored first: for a valid quote the system temporarily delegates energy to the payer, who then sends the transaction. When the budget or the stake is exhausted, the payer pays. - Energy delegation covers one-time payments only. Payers always pay for subscription sign-up themselves; each later charge is sent, and paid for, by the hot wallet. When sponsorship is on, the card's **Scope** row says so. - **Energy per payment** is the most energy delegated for one payment. - **Reclaim after (minutes)**: delegated energy is taken back when the payer does not send the transaction in time. - The daily budget is in TRX. The card also shows the hot wallet's balance, energy, bandwidth, staked amount and today's sponsorship spending on the chain. ### Solana chains Select **Edit** on the Solana chain's card to turn on **Sponsor fees (fee payer)**: - When on, the chain is sponsored first: the hot wallet is the transaction's fee payer and covers the base fee, priority fee and rent. The payer signs in the wallet; the server co-signs and broadcasts. When the budget is exhausted, the payer pays. - When the payer's wallet cannot sign a transaction without sending it (`solana:signTransaction`), the payer pays for that payment. When the wallet fails to give the sponsored signature (other than the payer cancelling in the wallet), or alters the transaction so that it fails the server's check, and the payer holds enough SOL for the fee and rent, the checkout gets a new quote in which the payer signs and sends the transaction. This applies to one-time payments, subscription sign-ups and payment-method changes in "My subscriptions". - When off, the payer pays. - The daily budget is in SOL. - **Priority fee** is added to every transaction the server sends; 0 adds none. ## Which payment methods can be sponsored Sponsorship covers signature-based payment paths: the payer signs an authorization and the hot wallet submits it together with the payment. | Case | Sponsorable | |---|---| | The token supports EIP-3009 | Yes | | The token supports EIP-2612 permit or DAI permit | Yes, when the payer is a plain account | | The payer has already approved Permit2 | Yes, smart contract accounts included | | Subscription sign-up | Yes: with an EIP-2612 permit, with Permit2, or by signing only the subscription terms when an existing allowance already covers the allowance cap. On TRON, subscription sign-up is not sponsored; the payer pays | | Native coin payment | No: the funds have to travel with the transaction | | The token has no permit and the payer has not approved Permit2 | No: the payer must send an approve transaction first | | Changing a subscription's payment method | Only where **Sponsor switches** is on for the chain | At the checkout: - Networks that can be sponsored carry the **Gas-free** label. - A network in **Sponsored** mode does not list the native coin or tokens payable only through approve. - In **Sponsored first** mode, payer-paid methods come after sponsored ones. When the payer has to pay, the checkout says that the payment needs a small amount of gas from the wallet. The authorization methods are described in [Networks and tokens](/en/checkout/networks-and-tokens/). ### Sponsor switches When a payer changes a subscription's payment method in "My subscriptions" (another wallet, token or network), the payer sends the transaction by default. With **Sponsor switches** on for a chain, a switch to that chain is submitted by the system in the same way as a sponsored sign-up, and counts toward that chain's daily budget. - The setting is per chain and off by default, so it can be turned on only where gas is cheap. - When the budget is spent or the hot wallet is unavailable, the payer pays instead. The switch is never refused, so that a subscription in progress can keep charging. ## The hot wallet The hot wallet is a wallet the system holds on the server. It is used only to pay gas, and its private key is different from the quote signer key. It sends: | Purpose | Description | |---|---| | Sponsored transactions | Payments and subscription sign-ups the payer has signed | | Subscription charges | The charge the keeper sends each period | | On-chain subscription cancellations | Cancelling on chain the subscriptions that were cancelled in the system | | Supporting operations on Solana | Creating the merchant account, keeping the address lookup table, reclaiming rent | :::caution Without a hot wallet, payers pay gas on every chain and subscriptions are not charged automatically. A hot wallet is required for subscriptions even when every chain is set to **Payer**. ::: Keep only a small balance of native coins in the hot wallet. Payments are split to payee addresses by the merchant contracts and never pass through it. ### Setting up the hot wallet The hot wallet's key stays on the server and never passes through the console. Until one is configured, the page shows the **Set up the hot wallet** steps: 1. On the server, create an encrypted keystore file and set its password when prompted: ```sh cast wallet new /etc/flowpay hot-wallet.json ``` 2. Point `config.toml` at it and provide the password in an environment variable: ```toml [relayer] keystore = "/etc/flowpay/hot-wallet.json" password_env = "FLOWPAY_RELAYER_PASSWORD" ``` 3. Restart the service. The page then shows the hot wallet's address. Fund it with a little of each chain's native coin, then turn on sponsorship per chain. The hot wallet per chain family: | Chain family | Hot wallet | |---|---| | EVM | The address of the keystore above; the same on every EVM chain | | TRON | The same key. Energy and bandwidth come from the TRX the hot wallet has staked | | Solana | A separate Solana key file (`solana_keystore` under `[relayer]`), in addition to the EVM hot wallet above. It must differ from the ed25519 quote signer key | For the full configuration, see [Deployment](/en/start/deployment/). ## Sponsorship budgets and abuse protection The system limits sponsorship so that the hot wallet's gas cannot be abused: - Only currently valid quotes are sponsored, with at most 3 submissions per order or subscription. - Each transaction is simulated before submission; one that fails simulation is not sent. - The payer address is screened again before submission. On a hit the hot wallet spends no gas; see [Risk screening](/en/console/risk/). - Each chain has a gas price cap and a daily budget. The budget counts what has been spent plus the worst-case cost of transactions in flight. - A transaction that stays unconfirmed for too long is replaced at a higher fee, and is booked only once. The **Gas mode per chain** table shows what each chain has sponsored today. ### When the budget is spent | Setting | Behaviour | |---|---| | Payer pays gas (default) | The payer pays instead, and the checkout says that the payment needs a small amount of gas from the wallet | | Stop sponsoring | Methods that need sponsorship are no longer offered | An alert is raised in both cases. ### Transactions outside the budget The keeper's subscription charges and on-chain cancellations are the system's own transactions. They are sent on chains in any gas mode, are not limited by the daily budget and do not count as sponsorship spending; the gas price cap and the hot wallet balance still apply. Gas spent on hot wallet withdrawals and on reclaiming Solana rent is likewise outside the sponsorship budget. ## Low-balance alerts When the hot wallet balance falls below its minimum, sponsorship on that chain pauses and an alert is raised: - The alert appears on the overview page and in the **Alert center**, and is sent to the configured notification channels according to the alert routes. - The business system receives the `system.relayer_low_balance` webhook. - A further notice is sent when the balance recovers. The minimum is set in the server configuration under `[relayer]` (`min_balance_wei`; `solana_min_balance_lamports` for Solana). When the keeper cannot send subscription charges because of an insufficient balance, a node failure or a gas price above the cap, a separate alert is raised; it clears when a transaction next goes out. For notification channels, see [Admins and passkeys](/en/console/admins-and-passkeys/). ## Withdrawals Native coins in the hot wallet can be withdrawn to the primary payee's verified address on the same chain. No other destination can be chosen. 1. On the **Hot wallet** card, select **Withdraw** for a chain. 2. Check the address shown under **To (primary payee)**. 3. Enter an amount, or leave it empty to withdraw everything available (the system keeps back what pending sponsored transactions may still cost). 4. Select **Withdraw** and complete step-up verification with a security key. The verification is bound to this chain, destination and amount. - If the primary payee has no address for the chain, nothing can be withdrawn until one is set; see [Payees and split rules](/en/console/payees-and-splits/). - With dual approval on, another admin must approve the withdrawal; on approval the system checks that the destination has not changed. - Withdrawals are written to the audit log and notify other admins. **Recent withdrawals** lists the latest ones. ## Solana rent Accounts on Solana hold a rent deposit. Payments through FlowPayra Lite create these accounts on Solana: | Account | Created | |---|---| | The order's paid record | With each order payment; it prevents the same quote from being paid twice | | The subscription account | At subscription sign-up | | The merchant account | Once per merchant; see [Chains, tokens and merchant contracts](/en/console/chains-and-contracts/) | ### Who pays | Case | Rent is paid by | |---|---| | Payer pays | The payer, as the transaction's fee payer, pays the fee and the rent | | Sponsored | The hot wallet, as fee payer, pays the base fee, priority fee and rent | | Merchant account | The wallet that sends the creation: the hot wallet, or the wallet an admin connects in the console | The sponsorship budget is counted in SOL and includes the rent of newly created accounts. ### Reclaiming rent Rent that the hot wallet funded is reclaimed automatically by the keeper: - Every hour, on each Solana chain, the keeper looks for accounts that the hot wallet funded and that can now be closed, closes them, and the rent returns to the hot wallet. - An order's paid record can be closed once the deadline of its quote has passed. - A subscription account can be closed once the subscription is cancelled or completed and the deadline of its terms has passed. - Only the party that funded an account can close it, and the rent returns only to that party. - Reclaim transactions are the system's own spending and do not count toward the sponsorship budget. ## Related pages - [Subscriptions](/en/console/subscriptions/) - [Chains, tokens and merchant contracts](/en/console/chains-and-contracts/) - [Networks and tokens](/en/checkout/networks-and-tokens/) - [Deployment](/en/start/deployment/) --- # Admins and passkeys URL: https://docs.flowpayra.com/en/console/admins-and-passkeys/ This page covers accounts and security in the console: who can sign in, how identity is verified, which operations need a further verification or a second person's approval, and the related audit log, alert notifications, API keys and master key. ## Admin accounts and roles ### Creating the first admin The first admin account is created on the server from the command line. The password must be at least 12 characters: ```sh FLOWPAY_ADMIN_PASSWORD='…' flowpayra-lite admin create --username ops --role admin ``` Further accounts can be added in the console under **Security & access → Team**. ### Roles | Role | Permissions | |---|---| | Admin (`admin`) | Everything, including configuration, payees, keys and accounts | | Operator (`operator`) | Day-to-day work: tickets, refunds, booking payments manually, resending webhooks and emails, pausing / resuming / cancelling subscriptions and changing their plans, emergency token pause. Can read configuration | | Finance (`finance`) | Read-only, with report export. Email addresses are masked | The console hides or disables what a role may not do, and the server enforces the same rules. ## Sign-in and second factors The sign-in flow is described in [Overview and orders](/en/console/overview-and-orders/). An account can register these factors: | Factor | Description | |---|---| | Passkey | Recommended. Based on WebAuthn and bound to this site's domain, so it resists phishing. Use requires user verification (fingerprint, face or device password) | | Security key | A FIDO2 hardware key such as Google Titan or YubiKey. Recommended as a second, backup key. Insert the key and enter its PIN to use it | | Authenticator app | Google Authenticator or similar, producing 6-digit codes. Available only while the account has no passkey or security key registered | | Recovery codes | Ten single-use codes, for when every key has been lost | ### First sign-in On first sign-in the account has no second factor. Setup must be completed before the console can be used. 1. Enter a name for the key (for example "Office laptop" or "YubiKey 5"). 2. Select **Add passkey** or **Add security key** and follow the browser's prompts. Alternatively, expand **Use Google Authenticator** to set up an authenticator app instead. 3. Save the ten recovery codes the system generates. They are shown once. ### Signing in with a passkey or security key - Once a key is registered, entering the username and selecting **Continue** opens the browser's key verification. When it passes, the administrator is signed in without a password. - A passkey stored on the device or in a password manager can also be used through **Sign in with a passkey**, without entering a username. - **Use the password instead** remains available: enter the password, then complete the second step with a key or a recovery code. :::caution Passkeys and security keys are bound to the console's site domain. In production the console must be reached over an HTTPS domain. If the console is served at an address different from the public one, configure that before registering any key; see [Deployment](/en/start/deployment/). ::: ### Authenticator app An authenticator app is available only while the account has no passkey or security key. In that state it is used to sign in and to verify sensitive operations. As soon as a key is registered, the authenticator app is switched off and can no longer be used for sign-in or verification. When an authenticator app is set up again, the new one stays pending until its code is entered to confirm it; the current one remains in use until then. ### Recovery codes - Each recovery code works once. - A sign-in with a recovery code is limited to the **Account security** page, for setting up a new factor. Sign in again once that is done. - **Regenerate** under **Account security** issues new codes; the page shows how many are left. When every key and recovery code is lost, another admin uses **Reset factors** on the **Team** page. If no other admin is available, run this on the server to clear all of the account's factors and force a new setup: ```sh flowpayra-lite admin reset --username ops --new-password ``` With `--new-password` the password is reset as well. This needs server access and is the last resort. An account that is only locked (its factors intact) needs no reset: wait 15 minutes, or sign in with a passkey or security key. With server access, the lock alone can be lifted, keeping factors, sessions and the password: ```sh flowpayra-lite admin unlock --username ops ``` ### The Account security page Select the avatar in the top bar, then **Account security**, to manage your own: | Item | Description | |---|---| | Passkeys and security keys | Add or remove keys. Removing a key is verified with another key; at least one factor always remains | | Recovery codes | See how many are left; regenerate | | Password | Change the password (at least 12 characters). Changing it signs out the account's other sessions | | Notification email | Receives notices when other admins carry out sensitive operations | | Sessions | The account's sessions and their sign-in method; other sessions can be signed out | ### Lockout, rate limits and sessions | Rule | Description | |---|---| | Lockout | Five consecutive failures during or after sign-in, across second factor, recovery code and the current password when changing it, lock the account for 15 minutes. While locked, passwords, authenticator codes and recovery codes are refused; passkeys and security keys still sign in and verify. With server access, `flowpayra-lite admin unlock --username NAME` lifts the lock | | Wrong passwords | Never lock the account: five wrong passwords for one account name from one IP within 15 minutes pause password sign-in for that name from that IP; 50 from all IPs together pause password sign-in for the name, while passkeys keep working | | Rate limit | Sign-in requests are refused for a while when one IP has too many unfinished sign-ins or too many recent failures | | Session | Lasts 12 hours and ends after 30 minutes of inactivity | ## Step-up verification for sensitive operations For a sensitive operation the system asks the administrator to verify again, with a key or, when no key is registered, with an authenticator code. With a key, the verification is bound to the content of that one operation and can be used only once; it cannot be applied to a different operation. | Operation | Verification | |---|---| | Adding or changing a payee address, the split whitelist switch, changing the primary payee, hot wallet withdrawals, approving a request | Every time; a payee address also requires typing the last 4 characters of the new address | | Creating, editing or archiving a split rule; making one the default | Every time | | Creating or revoking an API key | Every time | | Adding or removing a factor, regenerating recovery codes, team changes, the dual approval switch, changing the password or notification email | Every time | | Exporting or erasing personal data by email | Every time | | Generating, activating or retiring a quote signer key and related actions; KMS signing backend settings | Every time | | Deleting all test data | Every time | | Master key re-encryption | Every time | | Other configuration: gas modes and sponsorship budgets, webhooks, chain settings, RPC endpoints, adding a chain, contract verification, listing tokens, plans, risk lists and policy, alert channels, mail and receipt settings, manual booking, manual refund confirmation and similar | Once; valid for 5 minutes | Every sensitive operation is written to the audit log with the values before and after. ### Notifying other admins When payee addresses or split rules, the split whitelist switch, API keys, security settings or team membership change, when an approval is requested or handled, on a hot wallet withdrawal, on quote signer key or KMS operations, and on master key re-encryption, the system emails the other enabled admins who have a notification email. The email is sent in the recipient's language and includes the operation, who performed it, the time, the IP address, the values before and after, and a link to the audit log. Every admin should set a notification email under **Account security**. ## Dual approval With dual approval, certain sensitive operations are requested by one admin and take effect only after another admin approves them. It is turned on under **Security & access → Approvals** and needs at least two enabled admins. ### Operations that need approval - Changing a payee address - Changing the primary payee - Turning the split whitelist off (turning it back on takes effect immediately) - Hot wallet withdrawals - Adding a member, resetting a member's factors, re-enabling a member and changing a role (disabling a member takes effect immediately) - Master key re-encryption - Turning dual approval off Quote signer key rotation does not go through dual approval. ### Flow 1. The requester carries out the operation as usual and verifies with their own key. The request then shows as **Waiting**. 2. Another admin reviews the change on the **Approvals** page and selects **Approve**, verifying with their own key, or **Reject**. 3. On approval the change is checked again: addresses are screened again, and a withdrawal's destination is confirmed to be unchanged. 4. The audit log records both the requester and the approver. Rules: - A request expires after 24 hours. The requester can cancel it. - An approver must have been an enabled admin with a security key since before the request was submitted. - An admin cannot approve a request that concerns their own account. ## Team management **Security & access → Team** lists the accounts that can sign in, with their role, second factor, last sign-in and status. Only admins can manage accounts, and every change requires step-up verification. | Action | Description | |---|---| | Add admin | Enter a username and a role. The system generates a temporary password, shown once, to be handed over through a separate channel | | Change role | Choose the new role in the role column | | Disable | Ends all of the account's sessions at once | | Enable | Re-enables a disabled account | | Reset factors | Removes every key, authenticator and session of the account and sets a new temporary password | - At first sign-in a new member sets up a second factor, then changes the password under **Account security**. - Admins cannot change their own account here. - At least one enabled admin always remains. ### Temporary passwords under dual approval With dual approval on, the temporary password produced when adding a member or resetting factors is split in two. The requester sees part 1 on submitting, and the approver sees part 2 on approving; each is shown once and neither is stored. The member signs in with part 1 followed by part 2, with no space in between. Neither admin can sign in to the new account alone. ## Audit log **Security & access → Audit log** records sign-ins and every sensitive operation with the time, actor, action, target and IP address. Expanding an entry shows the values before and after. Entries can be filtered by actor, action and date range, or searched by action, target or admin. Writes made through the business API (for example to risk lists) and report exports are recorded in the audit log as well. ## Alert center System alerts appear on the overview page and are managed in one place under **Risk → Alert center**. The page holds recent alerts, the delivery log, channels, and routing with thresholds. ### Notification channels | Channel | Configuration | |---|---| | Email | A set of recipient addresses, up to 20 | | Telegram | Bot token and chat ID; optionally a self-hosted Bot API server | | Slack | Incoming webhook URL | | Webhook | Endpoint URL and signing secret. The system sends a JSON POST signed in the `FlowPay-Signature` header, using the same scheme as business webhooks. If the secret is left blank, one is generated and shown once | | Merchant notice address (built-in) | The ticket notification email, or the support email when that is not set | - Channel credentials are stored encrypted and shown only as hints. Adding or changing a channel requires step-up verification and is written to the audit log. - **Send test** checks that a channel can be reached. - The email channel depends on the mail server settings on the **Receipts & email** page. ### Routing **Routing** decides which channels each type of alert goes to: - One or more channels can be ticked per event type. - Events set to **Follow default** use the default row's settings, as do event types added in future. - The default route delivers to the merchant notice address only. - Events with no channel ticked are only recorded in the console. ### Alert types | Category | Alerts | |---|---| | Infrastructure | All RPC endpoints of a chain unavailable, hot wallet balance low, WalletConnect relay unavailable, reconciliation recovered missing events | | Payments and splits | Payee address blocked, on-chain splits differ from the quote, duplicate payment | | Tokens | Stablecoin price off its peg, price feed stale or unreadable, token under emergency pause, implementation of a custom token changed | | Risk | Payer address refused by risk screening, risky payment booked and flagged for review, risky payment frozen, OFAC import failed, feed import failed, third-party provider unavailable | | Subscriptions | Charge failure rate above the threshold, subscription charging stalled, on-chain charge after cancellation, charge on a replaced payment method, on-chain cancellation failed | | Keys and approvals | Quote signer key rotated, signer address in the contracts differs from the record, unquoted payment received by a retired key's contracts, quote signer key unable to sign, an operation waiting for another admin's approval | | Email | Address suppressed after repeated bounces | **Thresholds** sets the failure rate, window and minimum number of charges for the subscription charge failure rate alert. ### Delivery - A lasting alert notifies once when it opens and once when it resolves. Repeated events for the same subject notify once a day. - Failed deliveries are retried with backoff for about a day. Those that finally fail can be resent from the delivery log. - Every alert is also sent to the business webhook as a `system.` event, independent of channels and routing; see [Webhooks](/en/developers/webhooks/). - Alerts that concern test data or testnets are labelled as test data and go to the test webhook only, not to the alert channels. ## API keys The business system calls the business API with an API key. Keys are managed under **Developers → API keys**. Creating and revoking a key requires the admin role and step-up verification. ### Creating a key 1. Select **Create API key**. 2. Enter a name that tells keys apart, such as "Website" or "ERP". 3. Choose the mode: - **Live**: creates real orders that collect real funds. The key starts with `fpk_live_`. - **Test**: creates test data only; payments use testnets. The key starts with `fpk_test_`. 4. Tick the scopes. 5. Create the key and complete step-up verification. The full key is shown once: copy it immediately and keep it safe. ### Scopes | Scope | Description | |---|---| | `orders:write` | Create orders through the API | | `orders:read` | Read orders, payments and splits | | `subscriptions:write` | Create, pause, resume and cancel subscriptions | | `subscriptions:read` | Read subscriptions and their charges | | `events:read` | Fetch events (`GET /v1/events`) to catch up on missed webhooks | | `risk:read` | Read the risk address list | | `risk:write` | Add and remove addresses on the risk list | A request that lacks the required scope returns `403 insufficient_scope`. The business system calls the API with this header: ```http Authorization: Bearer ``` ### Revoking a key Select the revoke action in the list and confirm. Systems using the key lose API access at once, and this cannot be undone. The list is divided into **Active** and **Revoked** and shows each key's prefix, scopes, last use and creation time. For integration steps see the [Integration guide](/en/developers/integration/); for test keys see [Test mode (Sandbox)](/en/developers/sandbox/). ## Master key rotation The master key encrypts sensitive content in the database: RPC endpoint URLs, webhook signing secrets, authenticator seeds, payer and admin email addresses, mail provider and SMTP credentials, the bounce notification URL's secret, third-party provider credentials, alert channel configuration, KMS connection credentials and quote signer private keys. The master key lives only in the server configuration (`secrets.master_key`) and is never written to the database. **Security & access → Master key** shows the loaded master keys with their fingerprints, how many values each location holds under each key, and the progress of re-encryption. A fingerprint is a 16-character hexadecimal identifier of a master key, used to check the configuration; the key cannot be recovered from it. ### Rotation steps 1. Under **Rotate the master key**, select **Generate a new master key**. The key is generated in the browser, is never sent to the server, and is shown once: save it immediately. It can also be generated on the server with `flowpayra-lite secrets keygen`. 2. Change the server configuration: set the new key as `secrets.master_key` and move the previous key into `secrets.previous_master_keys`. From then on the previous key only decrypts. 3. Restart every instance with the new configuration. 4. Return to the **Master key** page, confirm that the current fingerprint is the new key's, select **Re-encrypt under the current key** and complete step-up verification. With dual approval on, it runs after another admin approves. 5. Re-encryption runs in batches in the background and continues after a restart. The system keeps operating normally meanwhile. 6. When the page reports that the previous key is no longer used, remove it from `secrets.previous_master_keys` and restart. ```toml [secrets] master_key = "" previous_master_keys = [""] ``` :::caution Do not start re-encryption until every instance has restarted with the new configuration. Keep the previous key in the configuration until the page reports that it can be removed; otherwise the values encrypted under it cannot be decrypted. ::: - Re-encryption requires the admin role, is written to the audit log, and notifies other admins. - Back up a new master key offline as soon as it is generated. Keep the offline copy of a previous key until the oldest database backup that might still be restored has expired. - If the page reports values encrypted under a key that is not configured, add the key with that fingerprint to `secrets.previous_master_keys` and restart to make them readable. - Command-line equivalents: `flowpayra-lite secrets status`, `secrets keygen` and `secrets reencrypt`. For rotating quote signer keys, see [Chains, tokens and merchant contracts](/en/console/chains-and-contracts/). ## Related pages - [Overview and orders](/en/console/overview-and-orders/) - [Payees and split rules](/en/console/payees-and-splits/) - [Security model](/en/security/model/) - [Deployment](/en/start/deployment/) --- # Developer settings URL: https://docs.flowpayra.com/en/console/developer-settings/ The **Developers** menu group of the console holds everything a business system needs for integration. It has four entries: | Menu | Purpose | |---|---| | API keys | Create and revoke the keys business systems use to call the business API | | Webhooks | Set the endpoint and signing secret for events, review deliveries and resend them | | Test mode | See how much test data exists and delete all of it | | Integration docs | Open the integration guide and API reference in a new window, and call the business API from the browser | For integration steps and the API itself, see the [Integration guide](/en/developers/integration/) and the [API overview](/en/developers/api/). ## API keys The business system calls the business API with an API key. **Developers → API keys** lists the keys of both modes under two tabs, **Active** and **Revoked**. Each row shows the name, mode, scopes, prefix, last use and creation time. Creating and revoking a key requires the admin role and step-up verification every time. Other roles can view the list. ### Creating a key 1. Select **Create API key**. 2. Enter a **Name** that tells keys apart, such as "Website" or "ERP". 3. Choose the **Mode**. It defaults to the mode the console is currently in. 4. Tick the **Scopes**. 5. Select **Create** and complete step-up verification. 6. The dialog shows the full key. Copy and store it, then select **I've saved it**. :::caution The full key is shown once, when it is created. After the dialog is closed it cannot be shown again; the only option is to revoke the key and create another. ::: ### Live and test keys | Mode | Prefix | Description | |---|---|---| | Live | `fpk_live_` | Creates real orders that collect real funds | | Test | `fpk_test_` | Reads and writes test data only; payments use testnets and no real funds | Keys of the two modes are separate. Reading a live order with a test key (or the reverse) returns `404`, and `GET /v1/events` lists only the events of the key's own mode. Test mode is described in full in [Test mode (Sandbox)](/en/developers/sandbox/). ### Scopes | Scope | Console label | Description | |---|---|---| | `orders:write` | Create orders | Create orders through the API | | `orders:read` | Read orders | Read orders, payments and splits | | `subscriptions:write` | Create and manage subscriptions | Create, pause, resume and cancel subscriptions | | `subscriptions:read` | Read subscriptions | Read subscriptions and their charges | | `events:read` | Read events | Fetch events (`GET /v1/events`) to catch up on missed webhooks | | `risk:read` | Read the risk address list | Read the risk address list | | `risk:write` | Maintain the risk address list | Add and remove addresses on the risk list | - A new key has every scope ticked except `risk:read` and `risk:write`. The risk address list is installation-wide configuration, so these two scopes are chosen explicitly. - A test-mode key can write list entries for testnet chains only. - A request that lacks the required scope returns `403 insufficient_scope`. The business system calls the API with this header: ```http Authorization: Bearer ``` ### Revoking a key Select **Revoke** in the list, confirm, and complete step-up verification. Systems using the key lose API access at once, and this cannot be undone. A revoked key stays under the **Revoked** tab with the time it was revoked. Creating and revoking keys is written to the audit log and notified to the other admins by email; see [Admins and passkeys](/en/console/admins-and-passkeys/). ## Webhooks When an order, a subscription or another object changes state, the system POSTs an event to the business system's endpoint with a signature header. On **Developers → Webhooks**, the endpoint card is at the top and the delivery log below it. For event types, signature verification and retry rules, see [Webhooks](/en/developers/webhooks/). ### Endpoint and signing secret Live mode and test mode each have their own endpoint and signing secret. The page shows and changes the set that belongs to the mode the console is currently in: | Console mode | Card title | Used for | |---|---|---| | Live | Endpoint | Live events; return signatures of live orders | | Test | Webhook (test mode) | Test events; return signatures of test orders | The card shows the **URL** and the state of the **Signing secret** (**set** or **not set**). Changes require the admin role and step-up verification, and are written to the audit log. To set up a webhook: 1. Choose the mode in the top bar (**Live** or **Test**). 2. Open **Developers → Webhooks**, select **Edit**, enter an endpoint address starting with `https://`, and save. 3. Select **Rotate secret**. The dialog shows the new signing secret (`whsec_…`). Copy it into the business system for signature verification, then select **I've saved it**. :::caution A signing secret is shown once, when it is generated. After a rotation the system signs with the new secret immediately, including later retries. Update the secret in the business system at the same time, or signature verification fails. ::: Events of the two modes are delivered in order independently: a failing endpoint in one mode does not hold up the other. ### Delivery log Below the card, the page lists every event of the current mode with its delivery state. | Column | Description | |---|---| | # | Event sequence number | | Event | Event type; events that concern an order link to it | | Status | Pending, Delivered or Failed | | Attempts | Number of delivery attempts so far | | Last result | HTTP status code or error of the latest attempt; while waiting for a retry, the time of the next one | | Created | When the event was produced | - Status tabs: All, Pending, Delivered, Failed. - Search: by event ID, sequence, order ID or subscription ID. - Filters: event type (a whole family can be selected, for example `order.*`) and date range. An event counts as delivered when the endpoint returns 2xx within 10 seconds. Otherwise delivery is retried with backoff for about 24 hours, after which the event is marked **Failed**. ### Resending an event Select **Resend** on the event in the delivery log; the system queues it for delivery again. Admins and operators can resend, and the action is written to the audit log. The **Webhook deliveries** section of an order's detail page offers the same action. A resent event carries the same `id` as the original, so the business system should process events idempotently by `id`. ## Test mode One deployment keeps two separate sets of data, live and test. **Developers → Test mode** explains how test mode works and manages test data. The **Switch to test mode** and **Back to live mode** buttons at the top right of the page do the same as the **Live / Test** switch in the top bar. | Area | Content | |---|---| | Test mode (Sandbox) | Number of test orders, test subscriptions, test refunds, test tickets, test events and test alerts, and the number of active test API keys | | How test mode works | Notes on test API keys, the test webhook (showing its current endpoint, or that it is still to be set) and testnet payments | | Clean up test data | The **Delete all test data** button | After switching to test mode, a banner appears at the top of every page. Its **Manage test data** link leads to this page. ### Deleting all test data 1. Under **Clean up test data**, select **Delete all test data**. 2. The dialog states how many records will be deleted. Select **Delete** and complete step-up verification. | Deleted | Kept | |---|---| | Every test order, subscription (with its charges), refund, ticket, event and alert | Test API keys, the test webhook, and shared configuration such as chains, payees, split rules and plans | - The operation requires the admin role and step-up verification every time. It is written to the audit log and notified to the other admins. - Deletion is permanent. Live data is not affected. - Test subscriptions that exist on chain remain on their testnets; the system no longer charges them. ## Integration docs and API playground **Developers → Integration docs** (and the button of the same name at the top right of the API keys page) opens the console's built-in integration docs in a new window, at `/admin/docs` of the console. Viewing them requires being signed in to the console; every role can use them. ### Content | Tab | Content | |---|---| | Guides | Integration guide, Testing in test mode, Popup / iframe embedding, Developer resources | | API reference | Generated from the business API's OpenAPI specification and grouped by resource. Each operation lists its required scope, parameters, request body fields and responses | The guides are written in Chinese; the API reference is in English. ### Try it Each operation in the API reference has a **Try it** panel that sends requests from the browser straight to this deployment's business API: 1. Enter an API key at the top right of the page. 2. In the operation's **Try it** panel, edit the parameters and the request body. The body is prefilled with the example from the specification. Operations that create objects get an `Idempotency-Key` automatically; **New** generates another one. 3. Select **Send request**. The page shows the status code, the time taken and the response. 4. To reproduce the call on the command line, copy the equivalent `curl` command shown on the page. - The API key is kept in the current browser tab only and is cleared when the tab is closed. Requests go from the page straight to the business API. - With a live key (`fpk_live_…`) the page warns that the orders, subscriptions and risk list changes it makes are real. :::tip Use a test key (`fpk_test_…`) while integrating. Test orders are paid on testnets only and test events go to the test webhook, without touching live data. ::: ## Related pages - [Integration guide](/en/developers/integration/) - [Webhooks](/en/developers/webhooks/) - [Test mode (Sandbox)](/en/developers/sandbox/) - [API overview](/en/developers/api/) - [Admins and passkeys](/en/console/admins-and-passkeys/) --- # Merchant and checkout settings URL: https://docs.flowpayra.com/en/console/merchant-and-checkout/ **Collection → Merchant & checkout** controls the merchant details, appearance and legal pages that payers see on the checkout, and how their wallets connect. The page has three tabs: | Tab | Content | |---|---| | Merchant and look | Merchant, Checkout appearance, Checkout network order, Checkout wallet order | | Privacy policy and terms | The privacy policy and terms in each language | | Wallet connections | WalletConnect, Wallet SDK channels | Each card shows the current settings; **Edit** opens a dialog to change them. Changes require the admin role, and other roles can view the settings. These settings are shared by live mode and test mode. The payment help form is configured under **Support → Tickets**; see [Payment help and support contact](#payment-help-and-support-contact) on this page. ## Merchant The **Merchant** card on the **Merchant and look** tab holds these settings: | Setting | Description | |---|---| | Merchant name | Shown on the checkout and on receipts. Required | | Support email | Shown in the checkout footer and on receipts. It is the reply-to address of receipts when none is set, and receives ticket notices when no ticket notification email is set | | Checkout default language | 简体中文 or English. Used only when neither the payment link, the order nor the browser decides the language. Simplified Chinese when not set | | Time zone | Where a business day starts: "today", report dates and the times in emails. Each admin can show times in another zone from the top bar | | Sites allowed to embed the checkout | The sites that may open the checkout in an iframe; see [Allowed embed origins](#allowed-embed-origins) | ## Checkout appearance The **Checkout appearance** card sets the checkout's default theme and the app icon that wallets show when connecting. | Setting | Description | |---|---| | Default theme | **Follow the system**, **Light** or **Dark**. A `?theme=light` or `?theme=dark` parameter on the payment link takes precedence | | App icon (PNG) | The app icon wallets show when connecting, for example on the OKX Connect confirmation screen. Enter the `https` URL of a PNG image; when empty, the built-in icon is used | Appearance settings are saved without step-up verification, and changes are written to the audit log. Icons for chains and tokens are set under **Chains & tokens**; see [Chains, tokens and merchant contracts](/en/console/chains-and-contracts/). ## Checkout network order The **Checkout network order** card decides the order in which the checkout lists networks. - The checkout lists the enabled networks in this order. The first 3 are shown and the rest are placed under **More**. On the card, the first 3 networks are labelled **Shown**. - A payer whose browser wallet is on a supported network starts on that network. - Without a custom order, networks are sorted by name. To change the order: 1. Select **Edit**. 2. Use the move up and move down buttons on each row to arrange the networks. 3. Select **Save**. Once a custom order is set, networks enabled later follow the arranged ones, by name. **Sort by name** in the dialog clears the custom order. ## Checkout wallet order The **Checkout wallet order** card decides the order of the popular wallets in the checkout's wallet list. It is set per network family (EVM, TRON, Solana), and the card shows only the families of the enabled networks. The checkout's wallet list starts with the wallet the payer used last, then the wallets detected in the payer's browser, then follows this order until 5 wallets are listed, and ends with WalletConnect. The remaining wallets are placed under **More wallets**. On the card, the first 5 wallets are labelled **Shown by default**. To change the order: 1. Select the network family on the card. 2. Select **Edit**. 3. Use the move up and move down buttons on each row to arrange the wallets. 4. Select **Save**. **Restore the default order** in the dialog clears the custom order of that family. For the default order of each family and the list payers see, refer to [Wallet support](/en/checkout/wallets/). For how payers choose a network and token, see [Networks and tokens](/en/checkout/networks-and-tokens/). ## Allowed embed origins By default the checkout cannot be opened in an iframe. To open it as a popup on the merchant's own pages, register the sites under **Sites allowed to embed the checkout** on the **Merchant** card: - Enter one `https` origin per line, for example `https://shop.example.com`. - An empty list forbids embedding; the card then shows **Embedding not allowed**. - Changing this setting requires step-up verification. The checkout can be embedded only by the registered sites, and sends payment result events only to them. When a site that is not registered loads the embed script, the script redirects to the checkout page instead. For the embed script and its events, see [Embedding the checkout](/en/checkout/embed/). ## Privacy policy and terms The **Privacy policy and terms** tab manages the two legal pages linked from the checkout footer. The privacy policy and the terms each have a Simplified Chinese and an English version, four entries in all, and each is set separately. ### Content source | Option | Description | |---|---| | Not set | The checkout footer leaves the entry out | | External URL | The address of a page on the merchant's own site; the footer link redirects to it | | Hosted text | Markdown entered in the console, hosted and displayed by the system | ### Setting a page 1. Select **Edit** on the row for the page and language. 2. Choose **External URL** and enter the address, or choose **Hosted text** and enter the Markdown. 3. Select **Save** and complete step-up verification. For an entry that is set, **View page** opens the page as payers see it in a new window. Choosing **Not set** and saving removes an entry. ### Hosted text - Markdown headings, lists, tables and links are supported. - The pages are served at `/legal/privacy` and `/legal/terms` on the checkout domain, for example `https://pay.example.com/legal/privacy`; the `lang` parameter selects the language. - The page shows the merchant name at the top and the date of the last update under the title. - Raw HTML in the text is displayed as text and is not executed. Only `http`, `https`, `mailto` and same-site links are kept. :::note The system stores payers' email addresses and wallet addresses. The merchant's privacy policy should disclose that this information is collected and what it is used for. For handling a payer's request to see or delete their personal data, see [Personal data requests](/en/console/privacy-requests/). ::: ## Wallet connections The **Wallet connections** tab configures the checkout's remote connection channels. Browser extension wallets, wallets' in-app browsers and opening the checkout inside a wallet app do not depend on these settings and are always available. For how each kind of wallet connects, see [Wallet support](/en/checkout/wallets/). ### WalletConnect WalletConnect is used on desktop to connect a phone wallet by QR code, and in phone system browsers to open a wallet app. It depends on an external relay and needs the merchant's own projectId. | Item | Description | |---|---| | Enable WalletConnect | The switch | | projectId | Obtained by creating a project at Reown Cloud (`https://cloud.reown.com`); 32 hexadecimal characters. Without one the checkout does not offer WalletConnect | | Relay | **Up**, **Down** or **Not checked yet**, with the time of the latest check | | Checkout | **Offers WalletConnect**, or **Not offered** (off, no projectId, or the relay is down) | | Reown allowed domains | The domains that must be on the Reown project's allowlist; each can be copied | To set it up: 1. Create a project at Reown Cloud and take its projectId. 2. On the **WalletConnect** card select **Edit**, turn on **Enable WalletConnect** and enter the projectId. 3. Select **Save** and complete step-up verification. The system checks the relay every minute. After 3 failures in a row the relay shows **Down**, the checkout switches to its other connection channels, and a "WalletConnect relay unavailable" alert opens; it resolves by itself once the relay is back. For how alerts are notified, see the alert center in [Admins and passkeys](/en/console/admins-and-passkeys/). :::caution If the Reown project lists allowed domains (an allowlist), it must include every domain shown on the card: the checkout's domain and the console's domain. If either is missing, the relay refuses browser connections from that domain (`origin not allowed`), while the relay status on the card still shows **Up**, because that check is made by the server and carries no browser origin. ::: The console itself connects wallets through WalletConnect when deploying contracts and sending refunds, which is why the console's domain belongs on the allowlist as well. ### Wallet SDK channels On desktop, when the MetaMask, OKX or Coinbase browser extension is not installed, the checkout can connect through each wallet's own connection service, without WalletConnect. Each channel has its own switch and is off by default: | Channel | How it connects | |---|---| | MetaMask SDK (QR code) | The checkout shows a connection QR code to scan with the MetaMask app on a phone | | OKX Connect (QR code) | The checkout shows a connection QR code to scan with the OKX app on a phone | | Coinbase Wallet SDK (keys.coinbase.com window) | A `keys.coinbase.com` window opens to complete the connection | - A switch saves as soon as it is changed, and requires step-up verification. - Once a channel is on, the corresponding wallet is marked **Direct** in the checkout's wallet picker. - If the connection service does not return a connection link within 10 seconds, the checkout shows a QR code of the checkout link instead; the payer scans it with the wallet app and opens the checkout inside the wallet. - These channels are used on desktop only. When WalletConnect is unavailable, they are the main alternative for remote connections on desktop. ## Payment help and support contact The footer of every checkout page shows the privacy policy and terms that are set, the **Payment help** link, and the merchant's support email. **Payment help** opens the payment help form. The order number, payer address and language are carried over from the checkout. The payer chooses an issue type, enters an email address and a description, and can add a transaction hash and screenshots. On submission the system creates a ticket, emails a confirmation to the payer and notifies the merchant. The form is configured on the **Help form settings** tab of **Support → Tickets**. Changes require the admin role and step-up verification: | Setting | Description | |---|---| | Enable the payment help form | When on, the checkout footer shows the payment help link | | Look up the transaction on submission | When the payer supplies a transaction hash, the system looks it up on submission and shows the result on the ticket | | Enable human verification | Requires a CAPTCHA before the form is sent. Choose Cloudflare Turnstile or hCaptcha and enter its site key and secret key | | Ticket notification email | Receives notices of new tickets; when empty, notices go to the merchant support email | | Notification language | Language of the ticket notification emails | | Ticket number prefix | Prefix of ticket numbers; with the prefix `T`, numbers look like `T-20261017-0012` | - Submissions are rate limited: 5 per hour per IP address and 3 per hour per email address. - Up to 3 screenshots of at most 5 MB each can be attached, in PNG, JPEG, WebP or GIF format. - Confirmation emails, notices and ticket replies are sent through the mail server configured on the **Receipts & email** page; see [Email and receipts](/en/console/email-and-receipts/). For working on and replying to tickets, see [Overview and orders](/en/console/overview-and-orders/). ## Related pages - [Payment flow](/en/checkout/payment-flow/) - [Wallet support](/en/checkout/wallets/) - [Embedding the checkout](/en/checkout/embed/) - [Email and receipts](/en/console/email-and-receipts/) - [Personal data requests](/en/console/privacy-requests/) --- # Email and receipts URL: https://docs.flowpayra.com/en/console/email-and-receipts/ FlowPayra Lite sends email through the sending service the merchant picks: a sending provider such as Resend, Cloudflare, Amazon SES, SendGrid, Postmark, Mailgun, Brevo, Alibaba Cloud DirectMail or Tencent Cloud SES, a company mailbox such as Tencent Exmail, Alibaba Mail or Google Workspace, or any SMTP server. When payers leave an email address on the checkout, the system sends them payment receipts and subscription receipts. Ticket emails, admin notices and alert emails go out through the same sending service. All settings are under **Collection → Receipts & email**. The page has four tabs: | Tab | Content | Roles | |---|---|---| | Receipts | Receipt type switches, the checkout email field, merchant details on receipts, and the receipt preview | Admin | | Mail server | The sending provider and its credentials, the sender domain's DNS records (written for you if you like), bounce notifications, test emails and the bounce limit | Admin | | Delivery log | Every email sent or waiting to be sent, with resend | Admin, operator | | Bounces and suppressed addresses | Addresses that have bounced and addresses no longer mailed, with the action to lift a suppression | Admin, operator | A badge next to the page title shows the sending state: **Sending set up** or **No mail server**. :::caution Without a mail server, receipts and notices are not sent. Complete the [mail server](#mail-server) settings first. ::: ## Emails the system sends | Email | Recipient | When | |---|---|---| | Payment receipt, Refund receipt | Payer | See [Receipt types](#receipt-types) | | Subscription receipts: Subscription started, Charge successful, Charge failed, Trial ending soon, Subscription cancelled / completed | Payer | See [Receipt types](#receipt-types) | | Subscription sign-in link | Payer | When the payer signs in to their subscriptions page by email | | Ticket confirmation | The payer who submitted the ticket | After the payment help form is submitted | | Merchant notice | The ticket notification email, or the support email when that is not set | When a new ticket arrives | | Ticket reply | The payer who submitted the ticket | When an admin or operator replies on the ticket | | Admin notice | The notification email of the other admins | When an admin carries out a sensitive operation | | System alert | The email channels of the alert center | When an alert opens or resolves | Admin notices and alert channels are described in [Admins and passkeys](/en/console/admins-and-passkeys/). ## Mail server The **Sending service** card on the **Mail server** tab lists four steps in order: provider and credentials, domain and DNS, bounce notifications, test email. The next step to do opens by itself; finished steps fold into one line, and **Edit** opens them again. Once all are done, the card is the sending status page. Each step is saved on its own, so you can leave and come back. ### Supported providers | Provider | Sends over | Sender domain | Bounce notifications | |---|---|---|---| | Resend | HTTP API or SMTP | Added at the provider | Callback registered for you | | Cloudflare (beta) | HTTP API or SMTP | Added at the provider; the domain must use Cloudflare DNS | Pulled from a Cloudflare queue every 30 seconds | | Amazon SES | HTTP API or SMTP | Added at the provider (Easy DKIM and a custom MAIL FROM) | Pushed through SNS, registered for you | | SendGrid | HTTP API or SMTP | Added at the provider | Signed Event Webhook, registered for you | | Postmark | HTTP API or SMTP | Added at the provider | Callback registered for you | | Mailgun | HTTP API or SMTP | Added at the provider | Callback registered for you | | Brevo | HTTP API or SMTP | Added at the provider | Callback registered for you | | Alibaba Cloud DirectMail | HTTP API or SMTP | Added at the provider | Pushed through EventBridge, registered for you | | Tencent Cloud SES | SMTP | Added at the provider | A callback URL you paste into Tencent Cloud's console | | Tencent Exmail, Alibaba Mail, Google Workspace | SMTP | SPF and DKIM guidance | Not available | | Custom SMTP | SMTP | The [sender domain check](#sender-domain-check-for-custom-smtp) | Not available | - The HTTP API is not affected by blocked SMTP ports on the server, and returns the provider's message id. - Tencent Cloud SES sends over SMTP only: its API sends reviewed templates only. Individual-verified accounts opened after 2026-03-02 cannot use SMTP; upgrade to enterprise verification or pick another provider. - Google Workspace connects with an app password (the account needs 2-Step Verification, and some organizations disable it) or through the SMTP relay `smtp-relay.gmail.com` (an admin allows this server's outgoing IP under Admin console › Gmail › Routing). - Company mailboxes and custom SMTP servers send no bounce notifications; only rejections at send time are recognized. ### Step 1: provider and credentials 1. Select **Edit** next to **Provider and credentials** (it opens by itself the first time). 2. Pick the provider. The form shows the credentials it needs, with a link to where you get them. 3. For providers with both, choose **HTTP API** or **SMTP**; for providers with regions, choose the region. 4. Enter the credentials, the sender name and the sender address. 5. Select **Save** and complete step-up verification. - Credentials are stored encrypted and not shown again; leave a field empty to keep the saved value. - The SMTP server, port, encryption and username come from the provider's preset; the Amazon SES SMTP password is derived from the secret key for the region. Only a custom SMTP server is typed in: encryption **STARTTLS**, **TLS** or **None (internal relays only)**, with the port defaulting to 587, 465 or 25. - Send from a subdomain (for example `mail.example.com`) to keep its reputation apart from your everyday mail. - Switching providers clears the previous provider's domain and notification set-up; the later steps have to be done again. The credentials each provider needs: | Provider | Credentials | |---|---| | Resend | An API key. Adding the domain and registering notifications need a Full access key; once set up you can switch to a Sending access key | | Cloudflare | The account ID and an API token with Email Sending edit; bounce notifications also need Queues edit | | Amazon SES | An IAM user's access key ID and secret access key (not temporary credentials) with sending, identity and SNS topic/subscription permissions. New accounts are in the sandbox and can only send to verified addresses until production access is granted in the AWS console | | SendGrid | An API key with mail send, domain authentication and Event Webhook permissions | | Postmark | The Server Token (sending and notifications) and the Account Token (adding the domain) | | Mailgun | An API key; the webhook signing key when it cannot be read through the API; for SMTP, the domain's SMTP username and password | | Brevo | An API key; for SMTP, the SMTP login and SMTP key | | Alibaba Cloud DirectMail | A RAM user's AccessKey with DirectMail and EventBridge permissions; for SMTP, the sender address's SMTP password | | Tencent Cloud SES | The SecretId and SecretKey (adding the domain, setting up the sender address) and the sender address's SMTP password | | Tencent Exmail, Alibaba Mail | The mailbox's client password or third-party client password, with SMTP enabled for the account in the admin console | | Google Workspace | An app password; none with the SMTP relay | Alibaba Cloud DirectMail and Tencent Cloud SES want the sender address created at the provider first: once the domain passes, the system creates it with these credentials and sets its SMTP password. ### Step 2: domain and DNS Receiving mail servers use the sender domain's DNS records to tell whether an email really comes from that domain: - **SPF**: which servers may send mail for the domain. - **DKIM**: the provider signs each email with the domain's private key; receivers check it with the public key in DNS. Someone faking your domain has no private key. - **DMARC**: requires the sender's domain to match the SPF or DKIM domain, and tells receivers what to do with mail that does not. Only `p=quarantine` or `p=reject` stops email that falsely uses your domain; `p=none` only reports. For providers that add the domain, select **Add {domain} at {provider}** and complete step-up verification: the system adds the sender domain through the provider's API, lists the records it asks for and shows the provider's verification status. For company mailboxes the SPF and DKIM guidance shows right away, and the DKIM key is copied from the mailbox's admin console; for Tencent Exmail, first enter the DKIM selector that console shows. The table lists each record's purpose, type, name (fully qualified), value and status, with a copy button: | Status | Meaning | |---|---| | In place | The record is found in public DNS | | Missing | The record is not found | | Different value | A record of that name is published with another value; the current value is shown under the value | | Needs a change | Published but in need of a change, for example several SPF records at one name, or DMARC at `p=none` | | Lookup failed | The DNS query failed | The provider's own verification result shows under the status. - SPF is checked where the provider wants it, not necessarily at the root: Resend uses the `send.` subdomain, Cloudflare `cf-bounce.`. - A name can have one SPF record only. If one exists, merge the provider's `include:` into it rather than adding a second record. - When the zone holding the sender domain (the organizational domain) has no DMARC record, the console suggests `v=DMARC1; p=none`, with an `rua=` report address when the support address belongs to that domain. Subdomains follow the organizational domain's DMARC. Once the reports look right, move to `p=quarantine`, then `p=reject`. - **Inbound (optional)** records (such as Mailgun's MX) make the provider receive the domain's incoming mail. Do not add them if the domain already receives mail elsewhere. - DNS changes usually take minutes to hours. While the page is open it checks every minute; **Check again** checks at once. #### Writing the records to DNS When the domain's DNS is at Cloudflare, DNSPod (Tencent Cloud) or Alibaba Cloud DNS, the system can write the records. The host is picked from the domain's NS records, and you can change it. 1. Select **Write to DNS**. 2. Enter a credential limited to the domain (see the table below). It is used for this read and write only and is not stored. 3. Select **Read current records**. The system reads the domain's current records and lists what it will do with each record. 4. Select **Write {n} records (verify)** and complete step-up verification. The write is recorded in the audit log, and the records are checked again. | DNS host | Credential and least permissions | |---|---| | Cloudflare | A custom API token with Zone › Zone › Read and Zone › DNS › Edit, limited to this zone. The Global API Key is not accepted | | DNSPod | A Tencent Cloud CAM sub-user's SecretId and SecretKey, with a policy allowing only DescribeDomain, DescribeRecordList, CreateRecord, ModifyRecord and DeleteRecord on this domain | | Alibaba Cloud DNS | A RAM user's AccessKey, with a policy allowing only DescribeDomainRecords, DescribeSubDomainRecords, AddDomainRecord, UpdateDomainRecord and DeleteDomainRecord on this domain | What happens to each record: | Action | When | |---|---| | Add | The name has no such record | | Merge | One SPF record exists: the provider's `include:` is added before its `all`, not as a second record | | Replace | The DKIM selector or CNAME already has another value: the old and new values are shown, and the record is replaced once you confirm | | Keep | The record exists with the same value; an existing DMARC record is always kept | | Conflict | Several SPF records at the name, or SPF with `redirect=`; a CNAME clashing with other records at the name; MX records already at the name (its current incoming mail). Nothing is written; fix it by hand | | Needs value | A company mailbox's DKIM key: paste the value from the mailbox's admin console, then plan again | - Records written at Cloudflare are DNS only, not proxied. - The suggested DMARC value can be edited before writing, or left out with **Leave DMARC out this time**. - **Inbound (optional)** records are not written unless you tick the box for them. - If the merged SPF record needs more than 10 DNS lookups, a warning says so: SPF may then fail, so trim the `include:` terms. ### Step 3: bounce notifications Once connected, the provider's bounce, complaint and delivery notifications come back to the system, for bounce counting and suppression (see [Bounces and suppression](#bounces-and-suppression)). 1. Open **Bounce notifications**, select the connect button and complete step-up verification. 2. The system creates a notification URL with a random secret, `https:///mail/events/`, and connects it the provider's way: - Registered for you: Resend, Amazon SES (through SNS), SendGrid, Postmark, Mailgun, Brevo, Alibaba Cloud DirectMail (through EventBridge). - Pulled from a queue: Cloudflare; the system creates a queue at Cloudflare subscribed to the sending events and pulls it every 30 seconds. - Pasted by you: Tencent Cloud SES. Copy the callback URL shown and paste it into the callback setting of Tencent Cloud's console, with bounce, complaint and delivery events. The URL contains a secret: keep it private. 3. The card shows the connection, when it was made, the last notification, and the bounces, complaints and provider suppressions of the last 30 days. - Each notification is verified the way its provider signs it (Svix, SNS certificates, ECDSA, HMAC, RSA; for providers that do not sign, the secret in the URL plus HTTP authentication). Requests that do not verify are refused. - A notification has an effect only when it is about an email the system sent through that provider: the provider's test notifications and forged requests suppress nothing. - **Connect again** creates a new URL and replaces the earlier registration at the provider; **Disconnect** clears the connection settings here. ### Step 4: test email Select **Start** next to **Test email**, enter a **Test recipient** and select **Send test email**. The test uses the receipt type currently chosen in the preview on the **Receipts** tab, which is the payment receipt by default, in the console's current language. Check that it did not land in spam. ### Sender domain check for custom SMTP With a custom SMTP server there are no provider records, so the **Sender domain check** card below the steps looks up the sender domain's DNS records by general rules and suggests fixes. 1. Leave **Sender domain** empty to use the domain of the sender address, or enter another domain. 2. Under **DKIM selector**, enter the selector your mail server signs with (for example `s1`). When empty, the saved selector is used. 3. Select **Check**. | Record | Looked up at | What is checked | |---|---|---| | SPF | TXT records of the sender domain | A `v=spf1` record is published, there is only one, and it ends with `-all` or `~all` | | DKIM | `._domainkey.` | A public key is published and is valid | | DMARC | `_dmarc.` | A `v=DMARC1` record is published, there is only one, and it has a `p=` policy and an `rua=` reporting address | The suggestions: publish one SPF record that includes your mail server (`include:…`) and ends with `-all` (`~all` suits testing); publish the DKIM public key at `._domainkey.`; start DMARC at `p=none` with `rua=`, then move to `quarantine` or `reject` once the reports look clean. **Save** on the card stores the DKIM selector and the bounce limit, and requires step-up verification. The DNS server used for the checks can be set in the server configuration, under `[mail] dns_server` in `config.toml`. ## Payment and subscription receipts ### Recipient address A receipt goes to the email address attached to the order or subscription. The address comes from either source: - The business system passes `customer_email` when creating the order or subscription. - The payer enters it in the **Email (optional)** field on the checkout. **Checkout email field** on the **Receipts** tab decides whether the checkout shows the field: | Option | Description | |---|---| | Shown (optional) | The checkout shows the email field; the payer may leave it empty | | Hidden | The checkout does not show the field; receipts go only to an address the business system passed as `customer_email` | The field appears only while the matching receipt type is on: **Payment receipt** for payment pages and **Subscription started** for subscription pages. When an order or subscription has no email address, no receipt is sent. Order webhook events carry `customer_email`, so that the business system can match them to its users. ### Receipt types The **Receipt types** card has a switch for each receipt: | Receipt | When it is sent | Main content | |---|---|---| | Payment receipt | When the order reaches its confirmations. At most one per order | Item, amount, token and network, transaction hash, order number, payment time | | Refund receipt | When a refund is verified on chain | Refund amount, order number, network, refund address, refund transaction hash, original payment transaction hash, refund time | | Subscription started | When a subscription or trial starts; also when a plan change takes effect | Plan, amount per period, period, first charge date, allowance cap, how to cancel | | Charge successful | When each charge is confirmed | Period number, amount, transaction hash, next charge date | | Charge failed | When a charge fails and the subscription enters its grace period | Reason for the failure, retry time, guidance | | Trial ending soon | A number of days before a trial ends, 3 by default; the current number is shown under the switch | First charge date and amount, how to cancel | | Subscription cancelled / completed | When a subscription is cancelled or all its periods are complete | Final state, number of periods charged | When a type is switched off, receipts of that type are no longer sent. ### Merchant details on receipts The **Merchant details (on receipts)** card sets the merchant information and links printed on receipts: | Setting | Description | |---|---| | Merchant name | The same setting as the merchant name under **Merchant & checkout** | | Support email | The same setting as the support email under **Merchant & checkout** | | Website | The merchant's website, shown on receipts | | Reply-to address | Where a payer's reply to a receipt is sent; the support email when empty | | Order page link template | Builds the receipt's **View order** button. `{merchant_order_no}` and `{order_id}` can be used, for example `https://shop.example.com/orders/{merchant_order_no}`. An order's `metadata.order_url` takes precedence when present | | Footer note | A note shown in the receipt footer, up to 300 characters | Subscription receipts also carry a link for managing the subscription, which takes the payer to their subscriptions page. After changing receipt types, the email field or merchant details, select **Save** and complete step-up verification. ### Language and test mode - A receipt is written in the checkout language in use when the payer entered the email address, or otherwise in the order's language. - Receipts for test orders and test subscriptions have "[Test]" prefixed to the subject ("[测试]" in Chinese). ### Preview The right side of the **Receipts** tab is the preview. Choose the receipt type under **Preview** and the language (简体中文 or English) to see the subject and body. The preview shows the email exactly as it is sent, and it updates when settings are saved. ## Bounces and suppression | Rule | Description | |---|---| | Bounce | Permanently rejected at send time (SMTP 5xx, or refused by the provider's API), or reported as a hard bounce by the provider once notifications are connected: the email is marked **Bounced**, not retried, and counts toward the address's bounces in a row | | Soft bounce, delay | Noted on the email only; not counted | | Complaint | The recipient marked an email as spam: mail to the address stops at once | | Provider suppression | The provider refused to send because the address is on its own suppression list: mail to the address stops here too | | Suppression | Once an address reaches the limit of bounces in a row, the system stops mailing it. Later emails to it appear as **Suppressed** in the delivery log | | Reset | One successful delivery resets the count: with notifications connected, the provider's delivery report; otherwise the sending service accepting the email | | Alert | When an address is suppressed, an "Address suppressed after repeated bounces" alert is raised | **Bounces before suppression** defaults to 3 and can be set from 1 to 20: on the **Bounce limit** card with a provider, on the **Sender domain check** card with a custom SMTP server. The **Bounces and suppressed addresses** tab lists the addresses that bounced, complained or were suppressed by the provider: | Column | Description | |---|---| | Recipient | The email address | | Status | **Suppressed** with the reason (bounces, complaint, provider suppression) and the time, or **Counting** (bounces recorded, limit not reached) | | Bounces | Number of bounces in a row | | Last bounce | Time of the latest bounce and its error | The list can be searched by email address. Once an address is known to receive mail again, select **Lift** to resume mailing it; an address the provider suppressed also has to be removed from the provider's suppression list. Lifting is written to the audit log. ## Delivery log The **Delivery log** tab lists every email the system produces. | Column | Description | |---|---| | Type | The kind of email, for example Payment receipt, Ticket confirmation or Ticket reply | | Recipient | The recipient address, masked (for example `a***@example.com`). An address that has been suppressed is labelled **Address suppressed** | | Status | See the next table. With notifications connected, the provider's later report (delivered, soft bounce, complaint …) shows under the status | | Attempts | Number of send attempts so far | | Last result | The send time when sent; otherwise the latest error, with the time of the next retry while one is pending | | Created | When the email was produced | | Status | Meaning | |---|---| | Pending | Waiting to be sent or retried | | Sent | Accepted by the sending service or the provider | | Failed | Not sent after all retries | | Bounced | The recipient address was permanently rejected (at send time, or reported later by the provider) | | Suppressed | The recipient address is suppressed (or the provider refused it for its suppression list); the email was not delivered | - Status tabs: All statuses, Pending, Sent, Failed, Bounced, Suppressed. - Search: by recipient address, entered in full. - Filters: email type and date range. ### Retries and resending - An email that fails to send is retried automatically with backoff, at intervals growing from 1 minute to 12 hours, for about a day. After that it is marked **Failed**. - Any email that is not **Pending** can be queued again with **Resend**. Resending is written to the audit log. ## Protection of email addresses - Email addresses are stored encrypted and shown masked in console lists. - The finance role always sees email addresses in masked form. - For a payer's request to export or delete the data tied to their email address, see [Personal data requests](/en/console/privacy-requests/). ## Related pages - [Merchant and checkout settings](/en/console/merchant-and-checkout/) - [Subscriptions](/en/console/subscriptions/) - [Personal data requests](/en/console/privacy-requests/) - [Admins and passkeys](/en/console/admins-and-passkeys/) - [Webhooks](/en/developers/webhooks/) --- # Personal data requests URL: https://docs.flowpayra.com/en/console/privacy-requests/ A payer may ask a merchant which personal data it holds about them, or ask for that data to be deleted (for example under GDPR or a similar law). FlowPayra Lite identifies a payer by email address, and **Support → Personal data requests** exports or erases the data tied to an address. FlowPayra Lite is self-hosted, and the data lives in the merchant's own database. The merchant, as the controller of the data, receives, verifies and answers the payer's request; this page is the tool for carrying out the export or erasure. ## Personal data the system stores | Data | Source | How it is stored | |---|---|---| | Email address | Passed by the business system as `customer_email`, or entered by the payer on the checkout or the payment help form | Stored encrypted; shown masked in console lists (for example `a***@example.com`) | | Ticket content | The description and screenshots the payer supplied on the payment help form, and the IP address at submission | Kept with the ticket | | Email log | Delivery records of the receipts, ticket emails and other emails sent to the address | The recipient address is stored encrypted | | Subscription sign-ins | Created when the payer signs in to their subscriptions page by email | Linked through an index of the address; the address itself is not stored in plain text | | Wallet address and transaction hash | On-chain payments | Kept as part of the payment record, and public on the blockchain | The merchant's privacy policy should disclose the collection and use of email addresses and wallet addresses. For setting the privacy policy, see [Merchant and checkout settings](/en/console/merchant-and-checkout/). ## How a request arrives A payer makes the request through the contact details the merchant publishes, usually by writing to the merchant's support email. The support email is shown in the checkout footer and on receipts. Before acting, the merchant should confirm that the requester controls the email address, for example by asking for the request to be sent from that address. On export or erasure the system matches data by the address entered in the console only; it does not verify the requester's identity. ## Roles and verification | Operation | Roles | Verification | |---|---|---| | Export | Admin, operator, finance | Step-up verification for each export | | Erase | Admin only | Step-up verification for each erasure, and the address must be retyped to confirm | The step-up verification is bound to the operation and the address; it cannot be used for another address or another operation. Step-up verification is described in [Admins and passkeys](/en/console/admins-and-passkeys/). ## Exporting data 1. Open **Support → Personal data requests**. 2. On the **Request** card, enter the payer's address under **Email address**. Addresses are not case sensitive; the system matches them in lower case. 3. Select **Export** and complete step-up verification. 4. The page shows an **Export** card with the number of records of each kind and the time it was generated. 5. Select **Download JSON** to get the file `privacy-export-.json`, which the merchant sends to the payer. When nothing is tied to the address, the page states **No records are on file for this address.** ### What is exported | Category | Content | |---|---| | Orders | Order ID, merchant order number, status, quoted amount and currency, network, token and amount paid, payer address, transaction hash, language, `metadata`, and the creation, payment and confirmation times | | Subscriptions | Subscription ID, plan, customer reference, status, network, token, amount per period, payer address, number of charges made, language, `metadata`, the creation, activation and cancellation times, and for each charge its period, status, amount, transaction hash and time | | Tickets | Ticket number, issue type, status, related order, transaction hash, payer address, description, language, IP address at submission, creation and resolution times, number of screenshots, and every reply | | Email log | For each email sent to the address: type, status, language, creation time and send time | | Sign-ins | Number of sign-ins to the subscriptions page | | Bounce record | The address's count of consecutive bounces, the time of the last bounce and the time of suppression, when a record exists | The export file also contains the address that was queried and the time it was generated. ## Erasing data Only an admin can erase, and erasure is permanent. It is advisable to export the data first, for answering the payer or for the merchant's records. 1. Open **Support → Personal data requests** and enter the payer's address under **Email address**. 2. Select **Erase**. 3. The dialog explains what is erased and what is kept. Retype the address under **Retype the address to confirm**. 4. Select **Delete** and complete step-up verification. 5. The page shows an **Erased** card with the number of records affected: orders, subscriptions, tickets, ticket screenshots, email log entries, sign-ins and bounce records. ### What is erased and what is kept | Data | Handling | |---|---| | Email address on orders and subscriptions | The address and its lookup index are erased; the order and subscription records themselves stay | | Email address on tickets | Replaced with a placeholder address. Occurrences of the address in the description and replies are replaced with `[erased]`. The IP address at submission is removed | | Ticket screenshots | Deleted | | Subscription sign-ins and sign-in sessions | Deleted | | Log entries of emails sent to the address | Deleted | | The address's bounce record | Deleted | | Payment records | Kept: amounts, network and token, payer address, transaction hash, splits and refunds, for reconciliation and compliance | | Other ticket content | Kept: ticket number, issue type, status, description and replies (with the address replaced) | :::caution Erasure cannot be undone. The orders and subscriptions concerned no longer carry an email address, so the system sends no further receipts for them to that address. Payer addresses and transaction hashes are recorded on the blockchain and cannot be deleted. ::: :::note Erasure applies to the FlowPayra Lite database only. Email addresses that the business system received through the `customer_email` field of webhooks or the API and stored itself, historical data in database backups, and mail logs on the mail server are for the merchant to handle separately. ::: ## Audit trail Every export and erasure is written to the audit log, under **Security & access → Audit log**: | Operation | Action in the audit log | What is recorded | |---|---|---| | Export | `privacy.export` | Actor, time, IP address, the masked email address, and the number of records exported in each category | | Erase | `privacy.erase` | Actor, time, IP address, the masked email address, and the number of records affected in each category | The audit log records the email address in masked form, so the full address does not remain in the audit log after it is erased. ## Related pages - [Email and receipts](/en/console/email-and-receipts/) - [Merchant and checkout settings](/en/console/merchant-and-checkout/) - [Admins and passkeys](/en/console/admins-and-passkeys/) - [Security model](/en/security/model/) --- # Integration guide URL: https://docs.flowpayra.com/en/developers/integration/ This guide is for business systems (shops, SaaS billing, membership systems and similar) that accept payments through FlowPayra Lite. It covers every step from the first order to going live. The authoritative definition of fields, status codes and error codes is the OpenAPI specification, which every deployment serves for its own version at `GET /v1/openapi.yaml`; see the [API overview](/en/developers/api/). The requests and responses below are taken from an actual run of the integration tests (two local development chains). Long responses are shortened with `…`; IDs and timestamps differ on every run. The test validates every API response and webhook event against the OpenAPI specification. ## Concepts - **One deployment serves one merchant.** FlowPayra Lite is deployed by the merchant (`public_url`, for example `https://pay.example.com`). The business API, the checkout, the console and the payer's "My subscriptions" page all live under that domain. This guide writes `$BASE` for that address and `$KEY` for the API key. - **Non-custodial.** The payer's wallet transfers tokens directly to the payees (the contract splits the payment atomically according to the quote). The system holds no funds; the hot wallet is used only for gas sponsorship and for subscription charge transactions and never handles the payment itself. Refunds are also sent directly from the receiving address to the payer (see [Refunds](#refunds)). The structure is described in the [security model](/en/security/model/). - **Orders and subscriptions.** An order (`/v1/orders`) is a one-time payment: create it, redirect the payer to `checkout_url`, and the payer chooses a token and network and pays. A subscription (`/v1/subscriptions`) is based on a plan maintained in the console: the payer signs the terms at the subscription link and authorizes a capped allowance, and the keeper then charges each period automatically. - **The server state is authoritative.** Payment results are pushed as webhooks and can be queried at any time. Return parameters and embed events are for the user interface only. Fulfil orders and activate services based on webhooks or on the status returned by `GET /v1/orders/{id}` and `GET /v1/subscriptions/{id}`. - **Live mode and test mode.** Every API key belongs to one mode (`fpk_live_…` / `fpk_test_…`) and reads and writes only that mode's data; objects and events carry a `livemode` field. Use a test key for integration work; see [Test mode](/en/developers/sandbox/). ### Integration methods | Method | Description | |---|---| | Redirect (default) | Create an order (`POST /v1/orders`) and redirect the payer to `checkout_url`; after payment the payer returns to `return_url` | | Modal / iframe | Load `/pay/embed.js` in your page; the checkout opens in a modal on desktop and redirects on phones. See [Embedding the checkout](/en/checkout/embed/) | ## API keys, scopes and modes ### Creating a key Create keys in the console under "Developers → API keys" (admin role, step-up verification required), or on the server: ```sh flowpayra-lite apikey create --name shop # live key, default scopes flowpayra-lite apikey create --name ci --mode test # test key flowpayra-lite apikey create --name crm --scope risk:read --scope risk:write ``` The plaintext key is shown once; only its hash is stored. Send it in the `Authorization: Bearer $KEY` header. A missing, malformed, unknown or revoked key answers `401 unauthorized`. ### Scopes Each operation names the scope it requires in `security` in the OpenAPI specification. A key without it answers `403 insufficient_scope`. | Scope | Endpoints | |---|---| | `orders:write` | `POST /v1/orders` | | `orders:read` | `GET /v1/orders`, `GET /v1/orders/{id}`, `GET /v1/payees` | | `subscriptions:write` | `POST /v1/subscriptions`, `…/{id}/cancel`, `/pause`, `/resume`, `/change_plan` | | `subscriptions:read` | `GET /v1/subscriptions/{id}`, `GET /v1/plans` | | `events:read` | `GET /v1/events` | | `risk:read` | `GET /v1/risk/addresses` | | `risk:write` | `POST /v1/risk/addresses`, `POST /v1/risk/addresses/import`, `DELETE /v1/risk/addresses/{address}` | - A key created without naming its scopes gets every scope except `risk:read` and `risk:write`. The risk address list is installation-wide screening configuration (`risk:write` can allow-list an address), so these scopes are granted separately when needed. - The `orders` scope of keys made before scopes existed grants every scope except `risk:*`. - Use separate keys per purpose: for example, default scopes for the shop back end and a dedicated key with only `risk:*` for a risk synchronization job. - `GET /v1/openapi.yaml` needs no authentication. ### Modes A live key sees only live orders, subscriptions and events; a test key sees only test data. Reading another mode's object answers `404`. Plans, payees and split rules are shared by both modes: the same `plan_id` and `payee_ref` work in either. ## An order from start to finish ### 1. Create the order ```sh curl -X POST "$BASE/v1/orders" \ -H "Authorization: Bearer $KEY" \ -H "Idempotency-Key: ord-SO-10023" \ -H 'Content-Type: application/json' \ -d '{ "merchant_order_no": "SO-10023", "amount": "100.00", "currency": "usd", "tokens": ["USDC"], "customer_email": "payer@example.com", "return_url": "https://shop.example/orders/SO-10023/done?ref=mail", "metadata": { "cart": "c_8812", "items": 3 } }' ``` ```json HTTP/1.1 201 Created { "id": "8a1bb5ea-4a41-4bc1-aff5-7e66f1f812f9", "livemode": true, "merchant_order_no": "SO-10023", "order_hash": "0xbefbeb9a9e16c0184f15e80b00fb0f3b2a80127f372d9826ffced438ef2321eb", "status": "pending", "amount": "100", "currency": "USD", "prices": null, "tokens": ["USDC"], "chains": null, "split_rule_id": "ed080622-2d55-4224-beba-2b0c0525a400", "payment": null, "splits": [ { "position": 0, "payee_ref": "main", "kind": "ratio", "bps": 8500, "fixed_amount": null, "fixed_currency": null, "payee_id": "cb365376-3e6f-4ef8-9c78-f9179bd18742", "address": null, "amount": null }, { "position": 1, "payee_ref": "vendor", "kind": "fixed", "bps": null, "fixed_amount": "2", "fixed_currency": "USD", "payee_id": "3d420c9d-95b5-4e60-a08a-23ded6d5e3dc", "address": null, "amount": null }, { "position": 2, "payee_ref": "channel", "kind": "ratio", "bps": 1500, "fixed_amount": null, "fixed_currency": null, "payee_id": "a499e305-2a44-4d10-950e-d766e2970705", "address": null, "amount": null } ], "risk_flag": null, "locale": null, "return_url": "https://shop.example/orders/SO-10023/done?ref=mail", "metadata": { "cart": "c_8812", "items": 3 }, "expires_at": "2026-10-22T14:46:07.259144Z", "created_at": "2026-10-22T14:16:07.260660Z", "checkout_url": "http://localhost:8080/pay/8a1bb5ea-4a41-4bc1-aff5-7e66f1f812f9" } ``` - `merchant_order_no` is your own order number (1–128 characters, unique within the mode; a duplicate answers `409 duplicate_order`). - `amount` is a decimal string (at most 8 decimals) priced in `currency`; `currency` is case-insensitive and stored in upper case. - Without `splits` or `split_rule_id` the default split rule applies (in the example: main payee 85%, vendor a fixed 2.00 USD, channel 15%). - Members of `splits` reference payees registered in the console by `payee_ref` or `payee_id`. Once the merchant turns the split whitelist off in the console, a member may also name a receiving address directly with `address` (and an optional `name`), for example `[{"payee_ref": "main", "kind": "ratio", "bps": 9000}, {"address": "0x…", "name": "卖家 42", "kind": "ratio", "bps": 1000}]`. The first member must be a ratio member that is a registered payee; the address is screened on every chain that could pay, and a hit answers `422 payee_blocked`. With the whitelist on, `address` answers `400 split_address_not_allowed`. - Orders expire after 30 minutes by default (configuration `orders.default_ttl_secs`); set `expires_in` (60–604800 seconds) to choose another lifetime. - Every create request needs an `Idempotency-Key` (see [Idempotency and errors](#idempotency-and-errors)). Deriving it from your order number (such as `ord-`) is sufficient, and retrying with the same key after a network timeout is safe. ### 2. Redirect to the checkout Redirect the payer to `checkout_url` (or open it in a modal with `/pay/embed.js`; see [Embedding the checkout](/en/checkout/embed/)). The checkout lists the available tokens and networks; the payer connects a wallet, signs and pays. Your system has nothing to do at this step. ### 3. Return and signature check Once the order reaches a final state (paid or expired), the checkout result page sends the payer back to `return_url` with four parameters appended after any existing ones: ``` https://shop.example/orders/SO-10023/done?ref=mail&order_id=8a1bb5ea-4a41-4bc1-aff5-7e66f1f812f9&status=paid&ts=1792678567&sig=3c6f…a1 ``` - `status` is `paid` (also for a duplicate payment) or `expired`. - `sig = hex(HMAC-SHA256(webhook_secret, ".."))`, with the same secret as webhooks (test orders use the test webhook secret). - Check the age of `ts` (for example 600 seconds) and take the **last occurrence** of each parameter (your own `return_url` may carry parameters with the same names). - Verification functions in five languages and test vectors are described under [Webhooks: return URL signature](/en/developers/webhooks/#return-url-signature). :::caution The return URL is for showing a result page only. The payer may close the page, never return, or revisit it with forged parameters. Fulfil the order based on steps 4 and 5 below. ::: ### 4. Receive the webhook Enter the endpoint URL in the console under "Developers → Webhooks" and obtain the signing secret `whsec_…` (one endpoint and secret each for live and test). Once the payment is confirmed, the system sends a POST request: ```http POST /flowpay/webhook HTTP/1.1 Content-Type: application/json User-Agent: FlowPayra-Lite/0.1.0 FlowPay-Signature: t=1792678567,v1=5b0c…e9 (signature truncated) { "id": "e6744ca8-e69a-479b-bd2c-158757c03bab", "type": "order.paid", "created_at": "2026-10-22T14:16:07.746192Z", "livemode": true, "data": { "id": "8a1bb5ea-4a41-4bc1-aff5-7e66f1f812f9", "merchant_order_no": "SO-10023", "status": "paid", "amount": "100", "currency": "USD", "payment": { "chain_id": 31337, "token_id": "5ad01eba-75da-4ec2-b7df-23ed1fcd2cf2", "symbol": "USDC", "decimals": 6, "amount": "100000000", "payer": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8", "tx_hash": "0x2eb3e3a63ad32317eec2955354aa4a089a152a0b0842dab526e4f83fe72cd4a4", "paid_at": "2026-10-22T14:16:07.653925Z", "confirmed_at": "2026-10-22T14:16:07.740029Z" }, "payments": [{ "chain_id": 31337, "block_number": 19, "status": "confirmed", "amount": "100000000", "payer": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8", "tx_hash": "0x2eb3e3a63ad32317eec2955354aa4a089a152a0b0842dab526e4f83fe72cd4a4" }], "customer_email": "payer@example.com", "risk_flag": null, … } } ``` Handling rules: 1. **Verify first, parse second.** Compute `HMAC-SHA256(secret, ".")` over the raw request body bytes and compare it with any `v1` in the header; reject requests where `|now − t|` exceeds 300 seconds. Re-serialized JSON does not verify. 2. **Be idempotent by `id`.** The same event may arrive more than once (a lost acknowledgement, a manual resend from the console). Record the `id` of handled events and answer 2xx to repeats. 3. **Answer 2xx within 10 seconds.** Queue slow work (fulfilment, activation) and process it asynchronously. A non-2xx answer, a timeout or a redirect is retried. 4. **Check `livemode`.** A production endpoint may reject events with `livemode: false` (test events are sent only to the test endpoint, so this should not occur). 5. **Check `risk_flag`.** `review` means the paying address matched a review-level list entry or exceeded the payer's daily limit: hold fulfilment and review it manually (a refund can be issued as described under [Refunds](#refunds)). `frozen` means a payment came from an address that failed risk screening (a block-level entry, or a built-in list such as the FBI's list of hacker addresses). That payment is frozen and does not count toward the order, and the system sends `order.payment_frozen`. Do not fulfil the order and do not refund the paying address; the funds are already in the receiving wallets and are to be handled according to your compliance process. Orders from before this behaviour existed may carry `hit_after_paid`; those orders stay paid. The `data` of an order event is the complete order as it stood (the same as `GET /v1/orders/{id}`, without `checkout_url`), plus `payments` (every on-chain payment, the booked one first) and `customer_email`. The `amount` in `payment` is in token base units; `symbol` and `decimals` are those the token was listed with, and `amount / 10^decimals` is the token quantity (for example `100000000` with `6` is 100 USDC). Delivery rules, the signature algorithm, event types and the retry schedule are documented under [Webhooks](/en/developers/webhooks/). ### 5. Query the order ```sh curl "$BASE/v1/orders/8a1bb5ea-4a41-4bc1-aff5-7e66f1f812f9" -H "Authorization: Bearer $KEY" # or by your own order number: curl "$BASE/v1/orders?merchant_order_no=SO-10023" -H "Authorization: Bearer $KEY" ``` ```json { "id": "8a1bb5ea-4a41-4bc1-aff5-7e66f1f812f9", "status": "paid", "payment": { "chain_id": 31337, "chain": { "id": 31337, "caip2": "eip155:31337", "family": "evm" }, "amount": "100000000", "payer": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8", "tx_hash": "0x2eb3e3a63ad32317eec2955354aa4a089a152a0b0842dab526e4f83fe72cd4a4", "token_id": "5ad01eba-75da-4ec2-b7df-23ed1fcd2cf2", "symbol": "USDC", "decimals": 6, "paid_at": "2026-10-22T14:16:07.653925Z", "confirmed_at": "2026-10-22T14:16:07.740029Z" }, "splits": [ { "position": 0, "payee_ref": "main", "kind": "ratio", "bps": 8500, "address": "0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc", "amount": "83300000", … }, { "position": 1, "payee_ref": "vendor", "kind": "fixed", "fixed_amount": "2", "fixed_currency": "USD", "address": "0x976ea74026e726554db657fa54763abd0c3a0aa9", "amount": "2000000", … }, { "position": 2, "payee_ref": "channel", "kind": "ratio", "bps": 1500, "address": "0x14dc79964da2c08b23698b3d3cc7ca32193d9955", "amount": "14700000", … } ], … } ``` Querying the order after receiving the webhook and before fulfilment rules out both forged requests and out-of-order events. `payment.amount` and `splits[].amount` are in token base units (USDC has 6 decimals: `100000000` is 100 USDC). #### Chain object and address formats The `payment`, `payments[]` and `refund` of an order, and the subscription object in subscription, refund and charge events, carry `chain: {id, caip2, family}` (`chain_id` is kept as before): - `id` is the chain ID, `caip2` the CAIP-2 identifier (`eip155:8453`, `tron:0x2b6653dc`, `solana:…`), and `family` the chain family: `evm` | `tron` | `solana`. - Addresses and transaction identifiers are written in the family's customary format: lower-case hexadecimal `0x…` for EVM (the risk list API returns EIP-55 checksummed addresses), Base58Check (`T…`) and 64-digit hexadecimal transaction IDs without the `0x` prefix for TRON, and Base58 public keys and Base58 transaction signatures for Solana. - Addresses and transaction identifiers in requests (`account`, `payer`, `tx_hash`, payee addresses, the risk list) are accepted in all three formats. One that does not match the family of the chain named answers `422 address_family_mismatch`; an operation that exists only on EVM chains, used with another family, answers `422 family_unsupported`. ### 6. Fallback: the event feed When the webhook endpoint is unreachable (downtime, a firewall), events remain stored. Your system can poll `GET /v1/events?since=` to obtain every event in commit order (see [Webhooks: the event feed](/en/developers/webhooks/#the-event-feed-get-v1events)), or call `GET /v1/orders/{id}` for each order that has stayed `pending` beyond a threshold. ## Order states and lifecycle | `status` | Meaning | Event | What to do | |---|---|---|---| | `pending` | Awaiting payment | — | — | | `paid_unconfirmed` | A payment was seen on chain but has not reached its confirmations | — | A "confirming payment" notice may be shown; do not fulfil | | `paid` | The first payment reached its confirmations | `order.paid` | Fulfil / activate | | `duplicate_paid` | A further payment reached its confirmations (for example one on each of two chains) | `order.duplicate_paid` | The order still counts as paid; a pending refund is opened automatically and the merchant returns the extra payment from the console | | `expired` | Unpaid at `expires_at` | `order.expired` | Close the order; a payment arriving after expiry is still booked (the order becomes `paid` and `order.paid` is sent) | | `reverted` | A confirmed payment disappeared in a chain reorganization | `order.payment_reverted` | Pause or withdraw fulfilment and wait for a new payment or manual handling | | `partially_refunded` | The booked payment was refunded in part (or in full while a duplicate payment remains) | `order.refunded` | Act on the refunded amount | | `refunded` | Every payment has been refunded in full | `order.refunded` | Cancel the order | - An order is booked against the **first confirmed payment** only (`payment`); later duplicate payments do not replace it. - A payment from an address that fails risk screening is frozen and does not count toward the order: the order stays unpaid, `risk_flag` is `frozen`, and the system sends `order.payment_frozen` (`data.frozen_payment` gives the frozen payment). - Expiry is evaluated about 2 minutes after `expires_at` (`orders.expiry_grace_secs`) and waits for transactions that were submitted and are still within their quote's validity. - After a duplicate payment is refunded, the order returns from `duplicate_paid` to `paid` (`order.refunded` is sent as well). - A checkout quote is valid for 10 minutes; the payer receives a new quote when changing token or network. These details are transparent to your system. ## Amounts, currencies, per-token pricing and splits ### Pricing and accepted tokens - An order is priced by `amount` and `currency`. Stablecoins pegged to that currency pay 1:1 (a USD order can be paid in USDC, USDT, DAI and so on). - `tokens` restricts the accepted token symbols (case-insensitive, stored in upper case). The default is every listed stablecoin, plus the token whose symbol equals `currency` (for example ETH when the order is priced in `ETH`). - `chains` further restricts the networks (chain IDs). The default is every enabled network that serves the key's mode (live: mainnets; test: testnets; local development chains serve both). - `prices` sets a price per token: the key is the token symbol (case-insensitive, stored with the listed spelling) and the value is the quantity of that token due. Tokens not listed are still converted from `amount`, which works for pegged tokens only. ```json { "merchant_order_no": "SO-10024", "amount": "100", "currency": "USD", "prices": { "usdc": "99.50" }, "tokens": ["usdc"], "chains": [31337], "expires_in": 3600, "locale": "EN", "splits": [{ "payee_ref": "main", "kind": "ratio", "bps": 7000 }, { "payee_ref": "channel", "kind": "ratio", "bps": 3000 }] } ``` The response carries `"prices": {"USDC": "99.5"}`, `"tokens": ["USDC"]`, `"locale": "en"` and `"split_rule_id": null`. ### Splits - Payees are registered in the console (`GET /v1/payees` lists `id`, `ref`, `name`, `is_primary`, `active`). Orders reference them by `payee_ref` or `payee_id`, and only active payees can be referenced. - Choose exactly one of three ways: `splits` (splits for this order), `split_rule_id` (a split rule maintained in the console), or neither (the default rule). Sending both `splits` and `split_rule_id` answers `400`. - 1–10 members. A `ratio` member gives `bps` (basis points; the ratio members sum to 10000); a `fixed` member gives `fixed_amount`. At least one ratio member is required, no payee may appear twice, and a member receiving zero is refused (`400 invalid_splits`). - **Calculation**: fixed amounts are paid first and the remainder is divided by ratio. The first ratio member is the main payee and absorbs the rounding remainder. Under the default rule above, 100 USDC is divided as: vendor 2, main payee (100 − 2) × 85% = 83.3, channel (100 − 2) × 15% = 14.7. - **Currency of fixed amounts**: a `fixed_amount` sent with the order is in the order's `currency`; a fixed amount in a split rule is in the rule member's own currency (`fixed_currency` in the response). Fixed amounts can only be paid in tokens pegged to that currency; other tokens are not offered at the checkout. - When an order is created the system checks that a payable route exists (network × token × screened payee addresses) and answers `422` when none does: - `split_total_too_small`: the amount does not cover the fixed splits (`params.amount`, `currency`, `fixed[]`); - `split_currency_mismatch`: no accepted token is pegged to a fixed split's currency; - `no_payable_route`: any other cause (token filter, prices, a payee address that failed screening on the chain, and so on). When the payees' addresses are the reason, `params.reason` is `payee_address` and `params.payees[]` lists them (`payee_id`, `name`, `problem`: `missing` no address for the network's family, `unscreened` not screened yet, `blocked` refused by screening), with the candidate networks in `params.chains[]`. The same applies to subscriptions. - Live orders are also subject to the order amount limits configured in the console: an order priced in the limits' currency outside the per-order minimum or maximum answers `422 amount_out_of_range` (`params.limit`, `bound`, `currency`, `amount`). Test orders are not subject to the limits. Payee and split rule configuration is described under [Payees and splits](/en/console/payees-and-splits/). ## Idempotency and errors ### Idempotency-Key Writes that create (`POST /v1/orders`, `/v1/subscriptions`, `/v1/subscriptions/{id}/change_plan`, `/v1/risk/addresses`, `/v1/risk/addresses/import`) require an `Idempotency-Key` header (1–255 characters); without it they answer `400 invalid_request`. - Keys are scoped to the API key. The system stores a hash of the raw body of the first request together with its answer (2xx and 4xx alike): a replay with the same key and the same body returns the first status code and body unchanged. - The same key with another body: `422 idempotency_key_reused`. A retry while the first request is still running: `409 request_in_progress` (retry later). - 5xx answers are not stored, so the request can be retried with the same key. Stored keys do not expire; do not reuse a key for a different business request. - The hash is computed over the raw bytes: send exactly the same bytes when retrying (for example by caching the body as first serialized). - `cancel`, `pause`, `resume` and `DELETE` take no key: the outcome of a repeated call is predictable (canceling a subscription that has ended returns it unchanged; pausing twice answers `409 not_pausable`). ### Error format ```json { "error": { "code": "invalid_request", "message": "expires_in must be between 60 and 604800 seconds", "params": { "field": "expires_in", "min": 60, "max": 604800 } } } ``` `code` is stable and suitable for program logic. `params` carries the field at fault and the limits, so that your system can word the message in its own language. `message` is English, intended for logs, and may change. The status codes and `code` values each operation may return are defined in the OpenAPI specification (every response lists its `code` values). The common ones are: | Status | `code` | When | `params` | |---|---|---|---| | 400 | `invalid_request` | The body is not JSON, has an unknown field or a wrong type; a field is invalid; `Idempotency-Key` is missing; a path or query parameter is malformed | `field`, and `min`, `max`, `max_decimals`, `allowed`, `token` and others | | 400 | `invalid_splits` | The split members do not form a valid rule | — | | 400 | `split_address_not_allowed` / `main_payee_first` / `main_payee_not_registered` | Split members named by address: the split whitelist is on; the first member is not a ratio member; the first member is not a registered payee | — | | 400 | `invalid_entries` | A bulk risk list import contains invalid entries | `invalid`, `errors[{index, message}]` | | 401 | `unauthorized` | Missing or invalid API key | — | | 403 | `insufficient_scope` | The key lacks the operation's scope | — | | 403 | `testnet_only` | A test key writing an entry not scoped to a testnet | `chain_id`, `testnets` | | 404 | `not_found` | The object does not exist or belongs to the other mode | `what`: `order`, `subscription`, `entry` | | 409 | `duplicate_order` | The order number already exists in this mode | — | | 409 | `request_in_progress` | A request with the same `Idempotency-Key` is still running | — | | 409 | `not_pausable` / `not_paused` / `risk_paused` | The subscription's status does not allow pausing or resuming, or it was paused by risk screening | — | | 409 | `same_plan` / `not_changeable` / `switch_in_flight` / `plan_change_in_flight` | The plan change cannot be carried out | `not_changeable`: `status` | | 409 | `list_is_feed` / `entry_not_removable` | Risk list: a URL feed is not writable; the entry comes only from imported sources | `list` / `sources` | | 413 | `payload_too_large` | The body exceeds 64 KiB (4 MiB for the bulk import) | — | | 422 | `idempotency_key_reused` | The same key with another body | — | | 422 | `split_total_too_small` / `split_currency_mismatch` / `no_payable_route` / `amount_out_of_range` | The order (for subscriptions only `no_payable_route`) cannot be paid or is outside the limits | See [Splits](#splits) | | 422 | `payee_blocked` | A split member named by address failed screening on a chain that could pay | `field`, `address`, `chain_id`, `hits` | | 422 | `address_family_mismatch` / `family_unsupported` | An address or transaction identifier does not match the family of the chain named; the operation exists only on EVM chains | — | | 500 | `internal` | Server error | Retry later (with the same key for idempotent requests) | | 503 | `chain_unavailable` | None of the networks that could pay a split member named by address could be reached to screen it; nothing is recorded, retry later | — | Actual responses: ``` POST /v1/orders 400 {"error":{"code":"invalid_request","message":"locale must be one of zh-CN, en","params":{"allowed":["zh-CN","en"],"field":"locale"}}} POST /v1/orders 400 {"error":{"code":"invalid_request","message":"XYZ is not a listed token","params":{"field":"prices.XYZ","token":"XYZ"}}} POST /v1/orders 422 {"error":{"code":"split_total_too_small","message":"the amount does not cover the fixed split amounts","params":{"amount":"1","currency":"USD","fixed":[{"amount":"2","currency":"USD","payee_id":"3d420c9d-95b5-4e60-a08a-23ded6d5e3dc"}]}}} POST /v1/orders 422 {"error":{"code":"amount_out_of_range","message":"the amount is above the maximum order amount of 50 USD","params":{"amount":"60","bound":"50","currency":"USD","limit":"max"}}} GET /v1/orders/not-a-uuid 400 {"error":{"code":"invalid_request","message":"Invalid URL: Cannot parse `id` with value `not-a-uuid`: …","params":{"field":"id"}}} POST /v1/subscriptions/f99a…3eb6c3/change_plan 409 {"error":{"code":"not_changeable","message":"the subscription is canceled","params":{"status":"canceled"}}} ``` In addition, a request that takes longer than 30 seconds answers `408` (empty body), and a path or method that does not exist answers `404` / `405` (empty body). ## Subscriptions ### Plans Plans are maintained in the console under "Plans" (a single price or per-token prices, period, number of periods, immediate start or trial, grace period, retry interval, unpaid or canceled once the grace period runs out, default split rule, accepted tokens, whether the payer may pause) and are shared by both modes. `GET /v1/plans` lists the active plans; pass a plan's `id` as `plan_id`. A subscription snapshots its plan when created, so later plan edits affect only new subscriptions. The console workflow is described under [Subscriptions](/en/console/subscriptions/). ### Create a subscription and send the link ```sh curl -X POST "$BASE/v1/subscriptions" -H "Authorization: Bearer $KEY" -H "Idempotency-Key: sub-cus_1001" \ -H 'Content-Type: application/json' \ -d '{"plan_id":"2ff2d006-6bcb-4935-b2a9-d57346819a05","customer_ref":"cus_1001","customer_email":"payer@example.com", "locale":"ZH-cn","return_url":"https://shop.example/account/billing","metadata":{"account":"acct_77"}}' ``` ```json HTTP/1.1 201 Created { "id": "f99a7f93-65b3-482d-821c-77de043eb6c3", "livemode": true, "plan_id": "2ff2d006-6bcb-4935-b2a9-d57346819a05", "plan_name": "Pro", "customer_ref": "cus_1001", "status": "incomplete", "checkout_url": "http://localhost:8080/pay/sub/f99a7f93-65b3-482d-821c-77de043eb6c3", "chain_id": null, "token": null, "payer": null, "sub_id": null, "amount_per_period": null, "period_seconds": 86400, "max_periods": 4, "trial_seconds": 0, "start_at": null, "trial_end_at": null, "next_charge_at": null, "charges_made": 0, "last_charged_index": null, "past_due_since": null, "last_error": null, "cancel_source": null, "splits": [], "locale": "zh-CN", "return_url": "https://shop.example/account/billing", "metadata": { "account": "acct_77" }, "created_at": "2026-10-22T14:16:11.212803Z", "canceled_at": null, "replaces": null, "replaced_by": null, "pending_plan_change": null } ``` - Send the payer to `checkout_url` (`/pay/sub/{id}`, valid for 7 days by default; `expires_in` accepts 60 seconds to 30 days). The payer chooses a token and network, confirms the terms and authorizes an allowance capped at the plan's periods. On some networks the system sponsors the gas and the payer only signs. - `customer_ref` (at most 128 characters) is your customer number. `customer_email` is used for subscription receipts (activation, charge, failed charge, trial ending, end) and for email sign-in to "My subscriptions". - `trial_seconds` can shorten the trial (trial plans only, and not beyond the plan's trial length). `tokens` and `chains` default to the plan's settings. Splits default to the plan's default rule, and after that to the system default rule. - `locale` is the same as for orders: only `zh-CN` and `en` are accepted (case-insensitive). - After subscribing, the payer returns to `return_url` with `subscription_id` and `status` (`trialing` or `active`) appended. These two parameters are **not signed**; rely on `subscription.activated` or `GET /v1/subscriptions/{id}` for activation. ### States and events | `status` | Meaning | |---|---| | `incomplete` | The link was issued; no on-chain subscription yet | | `trialing` | In trial (the on-chain subscription is confirmed) | | `active` | Charging normally | | `past_due` | The latest charge failed; retried at the plan's retry interval | | `unpaid` | The grace period ran out without a successful charge (for plans set to "unpaid"); no more charges | | `paused` | Paused: periods while paused are not charged, then or later | | `canceled` | Canceled (`cancel_source` says by whom) | | `completed` | Every period has passed | | Event | When | Additional `data` fields | |---|---|---| | `subscription.activated` | The on-chain subscription reached its confirmations (for an immediate start, `subscription.charged` for the first period follows) | — | | `subscription.trial_will_end` | N days before the trial ends (receipt setting, 3 days by default) | — | | `subscription.charged` | A period's charge reached its confirmations | `charge: {id, period_index, amount, tx_hash}` | | `subscription.charge_failed` | A charge failed; the subscription becomes `past_due` | `charge: {id, period_index, error}`, `retry_at` | | `subscription.unpaid` | The grace period ran out; the subscription becomes `unpaid` | As above | | `subscription.paused` / `subscription.resumed` | Paused / resumed | `paused`: `previous_status` | | `subscription.risk_paused` | Screening before a charge matched a block-level entry; the subscription was paused by risk control | — | | `subscription.canceled` | Canceled (with `charge` and `retry_at` when the grace period ran out on a plan set to "cancel"; with `canceled_by` after an on-chain cancel) | Depends | | `subscription.charged_after_cancel` | A period was charged after the subscription was canceled in the system and before the on-chain cancel: a refund is due; no receipt is sent | `charge` | | `subscription.completed` | Every period has passed | — | | `subscription.allowance_low` | The remaining allowance no longer covers the remaining periods (sent once) | `allowance`, `needed` | | `subscription.payment_method_changed` | The payer moved to another wallet, token or network in "My subscriptions" | `previous: {chain_id, token, payer}`, `switch: {chain_id, payer}` | | `subscription.migration_requested` | After the merchant replaced the quote signer key, the payer is asked to migrate to the new payment contracts | `migration: {reason, action}` | | `subscription.plan_change_pending` / `_expired` / `_canceled` | A plan change was requested, expired or withdrawn (sent on the old subscription) | `plan_change` | | `subscription.plan_changed` | The plan change took effect (sent on the new subscription, instead of `activated`) | `previous: {id, plan_id, plan_name}`, `effective_at` | | `subscription.replaced` | The old subscription of a plan change ended (sent on the old subscription, now `canceled` with `cancel_source: plan_changed`, usually together with `plan_changed`). Not a cancellation: the service goes on with the new subscription | `replaced_by`, `effective_at` | The `data` of a subscription event is the complete subscription as it stood (the same as `GET /v1/subscriptions/{id}`, without `checkout_url`), plus the fields in the table. A failed charge, for example: ```json { "type": "subscription.charge_failed", "data": { "status": "past_due", "last_error": "balance", "charge": { "id": "675c384f-ccba-4032-adb3-9d7f4d1d9389", "period_index": 0, "error": "balance" }, "retry_at": "2026-10-22T15:16:11.750158Z", … } } ``` Recommended handling: activate the service on `activated` and `plan_changed`; extend it on `charged`; on `charge_failed` ask the customer to top up or check the allowance; stop the service on `unpaid`, `canceled` and `completed`; keep it on `replaced` (the old subscription of a plan change was replaced, and the new one in `replaced_by` carries the service on); on `allowance_low` remind the customer to renew the allowance; on `migration_requested` ask the customer to open "My subscriptions" and complete the migration. ### Pause, resume and cancel ```sh curl -X POST "$BASE/v1/subscriptions/$SUB/pause" -H "Authorization: Bearer $KEY" # → 200, status: paused curl -X POST "$BASE/v1/subscriptions/$SUB/resume" -H "Authorization: Bearer $KEY" # → 200, status: active curl -X POST "$BASE/v1/subscriptions/$SUB/cancel" -H "Authorization: Bearer $KEY" # → 200, status: canceled ``` - **Pause**: a `trialing`, `active`, `past_due` or `unpaid` subscription can be paused; other statuses answer `409 not_pausable`. While paused the keeper does not charge; a third party can still charge on chain (such charges are booked as usual). - **Resume**: charging resumes from the next period. Periods while paused are not charged later, and the failure count and the past-due start are reset. A subscription that is not paused answers `409 not_paused`. A subscription paused by risk screening (`subscription.risk_paused`) can be resumed only from the console after the payer is screened again; the API answers `409 risk_paused`. - **Cancel**: charging stops at once (`cancel_source: merchant`); the system then cancels on chain with `cancelByMerchant`, after which nobody can charge. Canceling an `incomplete` subscription sends no event; canceling a subscription that has ended returns it unchanged with `200`. The payer can also cancel in "My subscriptions" or on chain, or revoke the allowance (`cancel_source: payer`); a cancel by the main payee on chain is reported as `chain`. ### Plan changes (upgrade and downgrade) On-chain terms cannot be modified, so a plan change works as "the old subscription runs out and a new one starts from the next period": ```sh curl -X POST "$BASE/v1/subscriptions/f99a7f93-65b3-482d-821c-77de043eb6c3/change_plan" \ -H "Authorization: Bearer $KEY" -H "Idempotency-Key: chg-1" -H 'Content-Type: application/json' \ -d '{"plan_id":"f8bc8289-c389-483f-90ad-794691e4c334"}' ``` ```json HTTP/1.1 201 Created { "id": "43557641-89f1-4a38-b142-c0335cac03ac", "status": "incomplete", "plan_name": "Team", "replaces": "f99a7f93-65b3-482d-821c-77de043eb6c3", "checkout_url": "http://localhost:8080/pay/sub/43557641-89f1-4a38-b142-c0335cac03ac", "customer_ref": "cus_1001", "locale": "zh-CN", "return_url": "https://shop.example/account/billing", "plan_change": { "id": "7b5adb4a-7db3-4458-8f39-6c769c5dc4aa", "subscription_id": "f99a7f93-65b3-482d-821c-77de043eb6c3", "new_subscription_id": "43557641-89f1-4a38-b142-c0335cac03ac", "plan_id": "f8bc8289-c389-483f-90ad-794691e4c334", "plan_name": "Team", "status": "pending", "source": "api", "reason": null, "effective_at": "2026-10-23T14:15:11.275580Z", "expires_at": "2026-10-23T14:00:11.275580Z", "created_at": "2026-10-22T14:16:11.459767Z", "ended_at": null }, … } ``` 1. The request returns a new `incomplete` subscription (`replaces` points to the old one). The old subscription receives `subscription.plan_change_pending`, and `GET` on the old subscription shows the payer's confirmation link in `pending_plan_change.checkout_url`. Send the payer to the new subscription's `checkout_url`; the new terms are confirmed with **the wallet paying the old subscription**. 2. The first period of the new terms starts at the old subscription's next period boundary that is at least 30 minutes ahead (`effective_at`) and is not charged in the subscribe transaction. The old subscription keeps its current period and nothing is prorated (bill a difference as a separate one-time order). From the request on, the old subscription charges no period from the boundary onwards. 3. Once the new subscription reaches its confirmations, it receives `subscription.plan_changed` (not `activated`). The old subscription becomes `canceled` (`cancel_source: plan_changed`) as soon as its current period is charged (or over) and receives `subscription.replaced` with `replaced_by` and `effective_at` (not `subscription.canceled`: the customer did not cancel); it is then canceled on chain. Both events usually arrive when the payer confirms, before the new plan's first period (`effective_at`): switch the customer to the new plan then, or keep the old plan until `effective_at` (it is paid until then) and switch at that time. Reading the old subscription back shows `canceled`: when you act on states, go by the new subscription in `replaced_by` and keep the service on. 4. The link expires at the latest 15 minutes before the boundary (`plan_change.expires_at`). If the change is not on chain 10 minutes after the link expires, it expires (`subscription.plan_change_expired`; the new subscription is canceled with `cancel_source: expired`) and the old subscription continues to be charged as before. 5. A new request before the payer confirms supersedes the earlier change (`subscription.plan_change_canceled` with `reason: superseded` for the earlier one). Canceling either subscription also withdraws the change (`reason: subscription_ended` or `canceled`). Additional rules: - Only `trialing` / `active` subscriptions confirmed on chain can change plan; otherwise `409 not_changeable` (`params.status`). The same plan answers `409 same_plan`; a payment method switch in flight `409 switch_in_flight`; the subscribe transaction of an earlier change in flight `409 plan_change_in_flight`. - A change during a trial does not grant a second trial: the new plan starts charging where the trial ends. - The new subscription carries over the customer number, receipt email, locale, metadata and return URL of the old one (`return_url`, `locale` and `metadata` in the request override them). Its splits are taken from the request, else the new plan's default rule, else the old subscription's splits. ### "My subscriptions", payment method changes and migration Payers sign in at `$BASE/my/subscriptions` with a wallet signature or a one-time link from a receipt email. There they can view the charge history, pause or resume (when the plan allows), cancel, change the payment method, change the receipt email, revoke the allowance, and confirm plan changes and contract migrations requested by the merchant. Your account page can link to that address. - **Changing the payment method**: the payer moves to another wallet, token or network. The subscription ID, charge dates and number of charged periods stay the same, and `subscription.payment_method_changed` is sent once it takes effect. Your system usually only needs to record the new `payer` / `token` / `chain_id`. - **Migration**: after replacing the quote signer key, the merchant asks payers to migrate their subscriptions from the console, and each subscription receives `subscription.migration_requested`. The payer completes the migration in "My subscriptions" by changing the payment method; the system cannot migrate on the payer's behalf. Until then, charges on the old contracts continue as usual, so notify your customers accordingly. ## Refunds Refunds are started from the order detail page in the console; the business API has no refund endpoint: 1. An admin or operator starts a full or partial refund for a confirmed payment (not exceeding the amount still refundable) and gives a reason. A duplicate payment opens a pending refund automatically. 2. The transfer is sent from the receiving wallet connected in the console, or made outside it and then recorded by transaction hash. 3. The system verifies that the transaction transfers at least the refund amount of the same token from that payment's receiving address to the paying address. The refund completes once it reaches its confirmations. On completion your system receives `order.refunded`; `data` is the order's new state plus `refund`: ```json { "type": "order.refunded", "data": { "status": "partially_refunded", "customer_email": "payer@example.com", "refund": { "id": "f2deaf41-1e50-409e-9f4e-e84b1b86d6c2", "payment_id": "611af994-39c7-448e-b57c-245f99c0178a", "chain_id": 31337, "token": "0x9fe46736679d2d9a65f0992f2272de9f3c7fa6e0", "amount": "30000000", "to": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8", "from": "0x9965507d1a55bcc2695c58ba16fb37d819b0a4dc", "tx_hash": "0xeaccf16ee6a04f03310c258595ca77e788d7bb1266dca7d8548190222156a46d", "reason": "partial return", "method": "offline", "verification": "transfer" }, … } } ``` - `token` is the token contract address (the zero address for the native coin) and `amount` is in base units. `from` is the receiving address the refund was sent from. `method` is `wallet` (the wallet connected in the console) or `offline` (a recorded transaction hash). `verification` is `transfer`, `trace` (found in the call trace, for example a transfer out of a Safe) or `manual` (confirmed by an operator). - Charges that landed after a subscription was canceled (`subscription.charged_after_cancel`) and duplicate charges are returned by the merchant in a separate transfer; the system only raises the notice. ## Risk address list API Your system can read and maintain the risk address list, for example to synchronize a deny list from your own risk system. The list takes effect once payer screening is turned on: paying addresses are screened before a quote, before a sponsored submission, at booking and before each subscription charge. The console configuration is described under [Risk](/en/console/risk/). | Endpoint | Scope | Description | |---|---|---| | `GET /v1/risk/addresses` | `risk:read` | Entries of every source, filtered by `source`, `address`, `level` and `chain_id`; paged with `limit` (1–500, default 100) and `after` (the previous page's `next_after`) | | `POST /v1/risk/addresses` | `risk:write` | Adds one entry (an entry for the same address and chain scope in the same list is replaced) and answers `201`; requires `Idempotency-Key` | | `DELETE /v1/risk/addresses/{address}` | `risk:write` | Removes the address's entries from the merchant's list (or the named list given by `?list=`); `?chain_id=` removes only one chain's entry (`all` for the entry that applies to all chains) | | `POST /v1/risk/addresses/import` | `risk:write` | Bulk write of up to 10,000 entries, written only if all are valid (otherwise `400 invalid_entries`, with `params.errors` listing them by index); `mode: replace` makes the list hold exactly these entries; requires `Idempotency-Key` | - **Scopes**: `risk:read` and `risk:write` are not among the default scopes and are selected separately when the key is created; on the command line, `flowpayra-lite apikey create --name crm --scope risk:read --scope risk:write`. The `orders` scope of early keys does not include them. - **Sources**: an entry's `source` is `manual` (the merchant's list), `ofac` (the OFAC SDN list), `feed:` (a URL feed) or `list:` (a named list). Write endpoints write to the merchant's list by default; pass `list` to write to a named list (created on first use; it cannot be a URL feed, which answers `409 list_is_feed`). OFAC and URL feed entries are maintained by their own imports and cannot be removed through the API (`409 entry_not_removable`). - **Levels**: `block` (quotes are refused), `review` (payment is allowed and the order is flagged for review once booked), `allow` (allowed, taking precedence over every other source). In screening, an `allow` from any source wins, then `block`, then `review`. - **Fields**: `address` (EVM addresses in any case), `level` (default `block`), `category` (`sanctions`, `scam`, `hack`, `mixer`, `false_positive`, `other`; other names are mapped by meaning), `chain_id` (a chain configured in this deployment; omitted for all chains; an array in bulk imports, one entry per chain), `reason` (at most 200 characters, visible in the console only), `expires_at` (RFC 3339 or `YYYY-MM-DD`). - **Test mode**: a test key (`fpk_test_…`) reads every entry but writes only entries whose `chain_id` is a testnet (otherwise `403 testnet_only`). Its `replace` imports and removals also touch only testnet entries and do not affect the screening of live payments. - Writes are recorded in the audit log (actor `api:`), and the console shows which key wrote an entry. ```sh # Add to the block list curl -X POST "$BASE/v1/risk/addresses" -H "Authorization: Bearer $KEY" -H "Idempotency-Key: $(uuidgen)" \ -H 'content-type: application/json' \ -d '{"address":"0x098B716B8Aaf21512996dC57EB0615e2383E2f96","level":"block","category":"hack","reason":"fraud team"}' # Replace the named list crm with the risk system's complete list curl -X POST "$BASE/v1/risk/addresses/import" -H "Authorization: Bearer $KEY" -H "Idempotency-Key: $(uuidgen)" \ -H 'content-type: application/json' \ -d '{"list":"crm","mode":"replace","entries":["0x098B716B8Aaf21512996dC57EB0615e2383E2f96",{"address":"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC","level":"review","chain_id":[1,8453]}]}' # → {"list":"crm","source":"list:crm","mode":"replace","total":3,"added":3,"removed":0,"duplicates":0} # List an address's entries; remove its entry from the merchant's list curl "$BASE/v1/risk/addresses?address=0x098B716B8Aaf21512996dC57EB0615e2383E2f96" -H "Authorization: Bearer $KEY" curl -X DELETE "$BASE/v1/risk/addresses/0x098B716B8Aaf21512996dC57EB0615e2383E2f96" -H "Authorization: Bearer $KEY" ``` An actual response: ```json POST /v1/risk/addresses → 201 { "id": "51be397f-2b18-48cc-9219-37fee947b95a", "address": "0x098B716B8Aaf21512996dC57EB0615e2383E2f96", "chain_id": null, "source": "manual", "category": "scam", "level": "block", "reason": "Reported by the fraud team", "expires_at": null, "created_at": "2026-10-22T14:16:11.818131Z", "updated_at": "2026-10-22T14:16:11.818131Z" } ``` In the request behind this response, `"category": "fraud"` was mapped to `scam`, and the address is returned in EIP-55 checksum format. ## Embedded checkout and test mode - **Modal / iframe embedding**: load `/pay/embed.js` in the merchant page; the checkout opens in a modal on desktop and redirects on phones. The embedding site must be allowed in the console. See [Embedding the checkout](/en/checkout/embed/). - **Test mode (Sandbox)**: test keys, testnets and faucets, the test webhook and deleting test data are described under [Test mode](/en/developers/sandbox/). Going live only requires replacing the API key and the webhook secret with the live ones. ## Limits | Item | Limit | |---|---| | Request rate | The business API has no rate limit; call it as needed and within reason (leave several seconds between polls of the event feed) | | Request body | 64 KiB (4 MiB for `POST /v1/risk/addresses/import`); larger bodies answer `413 payload_too_large` | | Request duration | 30 seconds; a timeout answers `408` | | Pagination | `GET /v1/events` and `GET /v1/risk/addresses` return at most 500 items per page | | Orders | Lifetime 60 seconds to 7 days; amounts with at most 8 decimals and not above 10^12; at most 10 split members | | Subscription links | 60 seconds to 30 days, 7 days by default; a plan change link expires at the latest 15 minutes before the effective boundary | | Risk list import | At most 10,000 entries per request | | Webhooks | Acknowledge within 10 seconds; 12 attempts over about 24 hours | ## Go-live checklist - [ ] Complete the full flow on a testnet with a test key: create an order → pay at the checkout → verify the return signature → verify the webhook signature and handle it idempotently → check with `GET /v1/orders/{id}` → fulfil. Do the same for subscriptions: activation, charge, cancellation (and a plan change if you use them). - [ ] Set the live webhook endpoint to an HTTPS URL in the console and store the live signing secret. The receiver verifies the signature and timestamp, deduplicates by event `id` and answers 2xx within 10 seconds. - [ ] The return page verifies `sig` and `ts`; fulfilment depends only on webhooks or the query API. - [ ] Switch to a live key (`fpk_live_…`) with the least scopes needed for its purpose. Keep the key and the webhook secret in a secrets manager, out of the code repository and logs. - [ ] Every create request carries a stable `Idempotency-Key`; network errors and 5xx answers are retried with the same key. - [ ] Handle every order status: `duplicate_paid` (return the extra payment from the console), `reverted` (pause fulfilment), `expired`, `refunded` / `partially_refunded`; review manually when `risk_flag` is set. - [ ] Subscriptions: handle `charge_failed`, `unpaid`, `canceled`, `completed`, `allowance_low`, `plan_change_*` and `migration_requested`; the account page links to "My subscriptions" (`$BASE/my/subscriptions`). - [ ] Deploy an event feed fallback job (or query orders that stay `pending` for long) and persist `next_since`. - [ ] Monitor `system.*` events or configure an alert center channel, in particular for the kinds marked as requiring a refund. - [ ] Confirm in the console the live networks and tokens, the payee addresses (screened), the default split rule, the amount limits and the receipt email settings. - [ ] Confirm that the version of `GET /v1/openapi.yaml` matches your locally generated client (the Postman collection in the repository, `docs/developers/postman/flowpay.postman_collection.json`, can also be used to spot-check the endpoints). --- # Use a coding agent URL: https://docs.flowpayra.com/en/developers/ai-agents/ If you write integration code or deploy FlowPayra Lite with a coding agent (Claude Code, Cursor, Codex, Copilot or similar), give it the resources on this page. They contain the steps, the rules that are easy to get wrong, and checklists, in a form an agent can follow. ## Agent skills | Skill | Purpose | Download | |---|---|---| | `flowpayra-integration` | Business integration: creating orders and subscriptions, redirecting to or embedding the checkout, verifying webhooks and return URLs, fulfilling from server state, and handling duplicate payments, refunds, frozen payments, plan changes and the risk address list API | [SKILL.md](/skills/flowpayra-integration/SKILL.md) · [zip](/skills/flowpayra-integration.zip) · [tar.gz](/skills/flowpayra-integration.tar.gz) | | `flowpayra-deploy` | Deployment and operations: installation, configuration, the master key, the first admin, chains and RPC nodes, quote signer keys, merchant contracts, gas and the hot wallet, monitoring, backups, upgrades and test mode | [SKILL.md](/skills/flowpayra-deploy/SKILL.md) · [zip](/skills/flowpayra-deploy.zip) · [tar.gz](/skills/flowpayra-deploy.tar.gz) | Each skill is a folder. `SKILL.md` gives the whole flow and the rules; `references/` holds the details by topic, which the agent reads only when it needs them. The integration skill also carries `scripts/`: the signature helpers in five languages (Node.js, Python, Go, PHP, Java) and their test vectors. The skills are written in English, which agents use directly. Every build of this documentation checks the skills: the endpoints, event types and error codes they name must exist in the OpenAPI specification, and the integration skill must list every event type and error code, so the skills stay in step with the published API. ## Other resources | Resource | URL | Purpose | |---|---|---| | `llms.txt` | [`/llms.txt`](/llms.txt) | Index of this documentation for language models | | `llms-full.txt` | [`/llms-full.txt`](/llms-full.txt) | The whole documentation in one text file | | OpenAPI specification | [`/openapi.yaml`](/openapi.yaml) | Every endpoint, field, status code and error code. A running deployment serves its own copy at `GET /v1/openapi.yaml` | | Signature helpers | [`/examples/`](/examples/) | Webhook and return-URL verification for Node.js, Python, Go, PHP and Java, with test vectors | ## Install the skills ### Claude Code Run in the project directory (or install into `~/.claude/skills` to use them in every project): ```sh mkdir -p .claude/skills curl -fsSL https://docs.flowpayra.com/skills/flowpayra-integration.tar.gz | tar -xz -C .claude/skills curl -fsSL https://docs.flowpayra.com/skills/flowpayra-deploy.tar.gz | tar -xz -C .claude/skills ``` Claude Code loads the matching skill when a task concerns FlowPayra. You can also invoke them by name: `/flowpayra-integration`, `/flowpayra-deploy`. To update, remove the old folder first and run the same command, so that files removed from the skill do not linger: ```sh rm -rf .claude/skills/flowpayra-integration curl -fsSL https://docs.flowpayra.com/skills/flowpayra-integration.tar.gz | tar -xz -C .claude/skills ``` ### The Claude apps (web and desktop) 1. Download the zip from the table above; do not unpack it. 2. Make sure code execution is on under **Settings → Capabilities** (**Code execution and file creation**); on Team and Enterprise plans an organization owner turns it on. 3. Open **Customize → Skills**, click **+**, then **Create skill**, then **Upload a skill**, and choose the zip. 4. Check that the skill's switch is on. The Claude apps limit a skill's description to 200 characters, so the `SKILL.md` in the zip carries a shorter description; everything else is the same as in the tar.gz. ### Other agents - Agents that support the Agent Skills specification: place the unpacked folder where the agent's documentation says it reads skills from. - Agents without a skill mechanism: add the content of `SKILL.md` to the project's agent instructions (`AGENTS.md`, `.cursor/rules/` or the equivalent) and tell the agent where `references/` is (for example `https://docs.flowpayra.com/skills/flowpayra-integration/references/webhooks.md`), or give it `https://docs.flowpayra.com/llms.txt` and ask it to read the skill and the integration guide first. ## What to tell the agent The integration code needs four things from you. Provide them as environment variables or through your secret store, not in the prompt: | Name | Value | |---|---| | `FLOWPAY_BASE_URL` | The public URL of your deployment, for example `https://pay.example.com` | | `FLOWPAY_API_KEY` | A **test** key (`fpk_test_…`) while building | | `FLOWPAY_WEBHOOK_SECRET` | The test webhook secret (`whsec_…`) from the console | | Webhook URL | The public HTTPS address of the endpoint the agent will add; enter it in the console under **Developers → Webhooks** | For deployment and operations the agent usually needs shell access to the server, the domain and the database details. Console sign-in and sensitive console operations need a passkey or security key and step-up verification each time, so a person does those in the browser: the skill has the agent prepare and explain these steps rather than perform them. Do not paste the master key, private keys or API keys into the conversation. A prompt that works (integration): ```text Add FlowPayra Lite payments to this project, following the flowpayra-integration skill. - Create a FlowPayra order when the customer checks out and redirect them to checkout_url. - Add a webhook endpoint at /flowpay/webhook that verifies FlowPay-Signature on the raw body, deduplicates by event id and fulfils the order on order.paid after re-reading the order. - Add the return page (display only) and an event-feed fallback job. - Read FLOWPAY_BASE_URL, FLOWPAY_API_KEY and FLOWPAY_WEBHOOK_SECRET from the environment. - Test the signature code against the skill's scripts/vectors.json. ``` A prompt that works (deployment): ```text Deploy FlowPayra Lite on this server with docker compose, following the flowpayra-deploy skill. The domain is pay.example.com, behind a Caddy reverse proxy. Before you start, list the steps I have to do myself in the browser or in my secret store. ``` ## Review what the agent produced Check these points before going live. They are the ones that cause incidents: 1. The webhook handler verifies the signature over the **raw request body**, before parsing JSON, and rejects stale timestamps. 2. Events are deduplicated by `id`, and the handler answers 2xx within 10 seconds. 3. Fulfilment happens only from the webhook or from `GET /v1/orders/{id}`, never from the return URL. 4. Every create request carries a stable `Idempotency-Key`, reused on retry. 5. Amounts are sent as decimal strings. 6. `risk_flag`, `duplicate_paid`, `reverted` and refunds are handled. 7. No key or secret appears in the code, the logs or the repository. Then follow the go-live checklist in the [integration guide](/en/developers/integration/) and test in [test mode](/en/developers/sandbox/). For a deployment, check the configuration, the backups and the safekeeping of the master key against [Deployment](/en/start/deployment/). --- # Webhooks URL: https://docs.flowpayra.com/en/developers/webhooks/ FlowPayra Lite sends a signed HTTP POST request to the endpoint configured by the merchant whenever an order, a subscription, a help ticket or the system state changes. Every event is also stored and can be read in commit order through `GET /v1/events`. Fulfilment and service activation should rely on webhooks or on the status returned by the query endpoints; the flow is described in the [integration guide](/en/developers/integration/). ## Delivery | Item | Description | |---|---| | Endpoint | Console, "Developers → Webhooks": one endpoint and one secret each for live and test mode | | Headers | `Content-Type: application/json`, `User-Agent: FlowPayra-Lite/`, `FlowPay-Signature: t=,v1=` | | Signature | `v1 = hex(HMAC-SHA256(secret, "."))`, where `secret` is the whole `whsec_…` string (UTF-8). Every attempt is signed anew (`t` is the time of that attempt). Each request carries a single `v1`; the header format allows several, so a receiver accepts any matching `v1`. After the signing secret is replaced in the console, the new secret is used at once, and all later deliveries (including retries) are signed with it | | Acknowledgement | Any 2xx within 10 seconds. Redirects are not followed (a 3xx counts as a failure) | | Retries | After a failure, retried after 10 seconds, 30 seconds, 1, 5, 15 and 30 minutes, then 1, 2, 4, 8 and 8 hours (12 attempts, about 24 hours); the event is then marked failed and can be resent from the console | | Ordering | Each mode is delivered strictly in order: while an event is failing, later events of the same mode wait until it is delivered or given up. Live and test do not affect each other | | No endpoint configured | Events are kept and can be read through `GET /v1/events`; once an endpoint is configured they are delivered in order | Requirements for the receiver: 1. **Verify first, parse second.** Compute the signature over the raw request body bytes; re-serialized JSON does not verify. 2. **Be idempotent by event `id`.** The same event may arrive more than once (a lost acknowledgement, a manual resend from the console). Record handled `id` values and answer 2xx to repeats. 3. **Answer 2xx within 10 seconds.** Queue slow work and process it asynchronously. 4. **Read the object before acting on an older event.** Calling `GET /v1/orders/{id}` before fulfilment, for example, rules out both forged requests and out-of-order events. 5. **Acknowledge unknown event types with 2xx.** New event types may be added in later versions. ## Signature verification ``` FlowPay-Signature: t=1767225600,v1=5b0c…e9 ``` - `v1 = hex(HMAC-SHA256(secret, "."))`. `secret` is the whole `whsec_…` string shown on the console's webhook page (used as UTF-8 bytes). - Compute it over the **raw request body bytes**: verify first, then parse the JSON. - The header may carry several `v1` values, and any one matching is sufficient (each request carries one; after the signing secret is replaced in the console the new secret is used at once, including for later retries, so the receiver must update its secret at the same time). - Reject requests where `|current time − t|` exceeds the tolerance (300 seconds is recommended) to prevent replays. ### Receiver example (Node.js) ```js import { verifyWebhook } from './flowpay.mjs'; // req.rawBody must be the raw bytes (for example express.raw({ type: 'application/json' })) if (!verifyWebhook(process.env.FLOWPAY_WEBHOOK_SECRET, req.get('FlowPay-Signature'), req.rawBody)) { return res.status(400).end(); } const event = JSON.parse(req.rawBody); if (await alreadyHandled(event.id)) return res.status(200).end(); await queue.push(event); // process asynchronously res.status(200).end(); ``` ### Verification functions `docs/developers/examples/` in the repository provides two functions in each of five languages: one verifies a webhook (header, raw body, current time, tolerance) and one verifies a return URL (full URL, current time, maximum age). They depend on the standard library only. | Language | File | Self-check | |---|---|---| | Node.js 18+ | `examples/node/flowpay.mjs` | `node examples/node/check.mjs` | | Python 3.8+ | `examples/python/flowpay.py` | `python3 examples/python/check.py` | | Go 1.21+ | `examples/go/flowpay.go` | `cd examples/go && go test` | | PHP 7.4+ | `examples/php/FlowPay.php` | `php examples/php/check.php` | | Java 11+ | `examples/java/FlowPay.java` | See `test-examples.sh` | Node.js (from `examples/node/flowpay.mjs`): ```js import { createHmac, timingSafeEqual } from 'node:crypto'; const hmac = (secret, data) => createHmac('sha256', Buffer.from(secret, 'utf8')).update(data).digest(); /** `FlowPay-Signature: t=,v1=` over `"."`; any v1 may match (secret rotation). */ export function verifyWebhook(secret, header, rawBody, now = Math.floor(Date.now() / 1000), toleranceSecs = 300) { if (!secret || typeof header !== 'string') return false; let ts = null; const sigs = []; for (const part of header.split(',')) { const i = part.indexOf('='); if (i < 0) continue; const k = part.slice(0, i).trim(); const v = part.slice(i + 1).trim(); if (k === 't' && /^\d+$/.test(v)) ts = Number(v); else if (k === 'v1') { if (!/^[0-9a-fA-F]*$/.test(v) || v.length % 2) return false; sigs.push(Buffer.from(v, 'hex')); } } if (ts === null || sigs.length === 0 || Math.abs(now - ts) > toleranceSecs) return false; const body = Buffer.isBuffer(rawBody) ? rawBody : Buffer.from(rawBody, 'utf8'); const expected = hmac(secret, Buffer.concat([Buffer.from(`${ts}.`, 'utf8'), body])); return sigs.some((s) => s.length === expected.length && timingSafeEqual(s, expected)); } ``` Python (from `examples/python/flowpay.py`): ```python import hashlib import hmac import re import time _HEX = re.compile(r"^[0-9a-fA-F]*$") def _mac(secret: str, data: bytes) -> bytes: return hmac.new(secret.encode("utf-8"), data, hashlib.sha256).digest() def verify_webhook(secret: str, header: str, raw_body: bytes, now: int = None, tolerance: int = 300) -> bool: """`FlowPay-Signature: t=,v1=` over b"."; any v1 may match (rotation).""" if not secret or not header: return False now = int(time.time()) if now is None else now ts, sigs = None, [] for part in header.split(","): key, sep, value = part.strip().partition("=") if not sep: continue if key == "t" and value.isdigit(): ts = int(value) elif key == "v1": if not _HEX.match(value) or len(value) % 2: return False sigs.append(bytes.fromhex(value)) if ts is None or not sigs or abs(now - ts) > tolerance: return False if isinstance(raw_body, str): raw_body = raw_body.encode("utf-8") expected = _mac(secret, str(ts).encode() + b"." + raw_body) return any(hmac.compare_digest(s, expected) for s in sigs) ``` ### Test vectors `docs/developers/vectors.json` in the repository is produced by the server's signature implementation and can be used to check verification code you write yourself. The repository's tests fail when the implementation and the file disagree. A webhook vector has the fields `secret`, `header`, `body`, `now`, `tolerance` and the expected result `valid`. A valid vector: ```json { "body": "{\"created_at\":\"2026-01-01T00:00:00Z\",\"data\":{\"amount\":\"100.00\",\"description\":\"年度会员 × 1\",\"merchant_order_no\":\"SO-10023\",\"order_id\":\"0b3f5a52-8f7e-4c1e-9d2a-6c1f0e9b7a31\"},\"id\":\"evt_01\",\"type\":\"order.paid\"}", "header": "t=1767225600,v1=d559f5ea11b41db6052b42de11701d3f9ef12a4c92169e9a534f8f8bb4c0de9c", "name": "valid", "now": 1767225605, "secret": "whsec_4f1b2c3d4e5f60718293a4b5c6d7e8f9", "tolerance": 300, "valid": true } ``` | Webhook vector | Expected | |---|---| | `valid` | Accepted | | `valid, two v1 values (secret rotation)`: the header carries two `v1` values, one of which matches | Accepted | | `valid, spaces after commas` | Accepted | | `wrong secret` | Rejected | | `body changed`: the body was tampered with | Rejected | | `body re-serialized`: the body was re-serialized | Rejected | | `timestamp too old`: the timestamp is outside the tolerance | Rejected | | `timestamp changed`: the timestamp was altered | Rejected | | `no v1`: the signature is missing | Rejected | | `not hex`: the signature is not hexadecimal | Rejected | ## Return URL signature Once an order reaches a final state, the checkout returns the payer to `return_url` with four parameters appended: ``` https://shop.example/orders/done?order_id=0b3f…7a31&status=paid&ts=1767225600&sig=8c1d…40 ``` - `sig = hex(HMAC-SHA256(secret, ".."))`, with the same secret as webhooks (test orders use the test webhook secret). - `status` is `paid` or `expired`. - Your own `return_url` may carry query parameters; the system's parameters are appended last, so take the **last occurrence** of each parameter when verifying. - Check the age of `ts` (the examples default to 600 seconds). `verifyReturnUrl` / `verify_return_url` in the language examples implement these rules. The `return_url` vectors in `vectors.json` (fields `secret`, `url`, `now`, `max_age`, `valid`) cover: a valid signature, a valid signature for an expired order, merchant parameters placed first including one with the same name, a changed `status`, a wrong secret, a timestamp that is too old, and a missing signature. A valid vector: ```json { "max_age": 600, "name": "valid", "now": 1767225630, "secret": "whsec_4f1b2c3d4e5f60718293a4b5c6d7e8f9", "url": "https://shop.example/orders/done?order_id=0b3f5a52-8f7e-4c1e-9d2a-6c1f0e9b7a31&status=paid&ts=1767225600&sig=ea5f2a5e1015520542bba291f9278904eee1158c2dd929e45a752282ff8ceade", "valid": true } ``` :::caution The return signature only proves that the parameters were produced by this deployment; the return itself is for showing a result page. The return parameters after a subscription is completed (`subscription_id`, `status`) are not signed. ::: ## Event envelope ```json { "id": "…", "type": "order.paid", "created_at": "2026-10-22T14:16:07.746192Z", "livemode": true, "data": { … } } ``` `data` is the object as it was when the event was written and takes one of four shapes by type: an order (`order.*`), a subscription (`subscription.*`), a help ticket (`support.ticket_created`) or a system alert (`system.*`). Test mode events carry `livemode: false`, go to the test endpoint and are signed with the test secret. ## Event types ### Order events `data` is the complete order (the same as `GET /v1/orders/{id}`, without `checkout_url`), plus `payments` (every on-chain payment, the booked one first) and `customer_email`. | Event | When | Additional `data` fields | |---|---|---| | `order.paid` | The first payment reached its confirmations (order `paid`; sent again after a `reverted` order is paid anew) | — | | `order.duplicate_paid` | A further payment reached its confirmations (order `duplicate_paid`); a refund is opened automatically | — | | `order.payment_frozen` | A payment arrived from an address that fails risk screening (a block-level entry or a built-in list): it is frozen and does not count, and the order stays unpaid. Do not fulfil the order, do not refund the payer, and handle the funds (already in the receiving wallets) according to your compliance process | `frozen_payment` | | `order.payment_reverted` | A confirmed payment disappeared in a chain reorganization (order `reverted`); stop fulfilment | — | | `order.expired` | Unpaid at `expires_at` | — | | `order.refunded` | A refund was confirmed on chain (order `partially_refunded`, `refunded`, or `paid` again after a duplicate's refund) | `refund` | ### Subscription events `data` is the complete subscription (the same as `GET /v1/subscriptions/{id}`, without `checkout_url`), plus the fields in the table. | Event | When | Additional `data` fields | |---|---|---| | `subscription.activated` | The on-chain subscription reached its confirmations (for an immediate start, `subscription.charged` for the first period follows) | — | | `subscription.trial_will_end` | N days before the trial ends (receipt setting, 3 days by default) | — | | `subscription.charged` | A period's charge reached its confirmations | `charge: {id, period_index, amount, tx_hash}` | | `subscription.charge_failed` | A charge failed; the subscription becomes `past_due` | `charge: {id, period_index, error}`, `retry_at` | | `subscription.unpaid` | The grace period ran out; the subscription becomes `unpaid` | As above | | `subscription.paused` / `subscription.resumed` | Paused / resumed | `paused`: `previous_status` | | `subscription.risk_paused` | Screening before a charge matched a block-level entry; the subscription was paused by risk control | — | | `subscription.canceled` | Canceled (with `charge` and `retry_at` when the grace period ran out on a plan set to "cancel"; with `canceled_by` after an on-chain cancel) | Depends | | `subscription.charged_after_cancel` | A period was charged after the subscription was canceled in the system and before the on-chain cancel: a refund is due; no receipt is sent | `charge` | | `subscription.completed` | Every period has passed | — | | `subscription.allowance_low` | The remaining allowance no longer covers the remaining periods (sent once) | `allowance`, `needed` | | `subscription.payment_method_changed` | The payer moved to another wallet, token or network in "My subscriptions" | `previous: {chain_id, token, payer}`, `switch: {chain_id, payer}` | | `subscription.migration_requested` | After the merchant replaced the quote signer key, the payer is asked to migrate to the new payment contracts | `migration: {reason, action}` | | `subscription.plan_change_pending` / `_expired` / `_canceled` | A plan change was requested, expired or withdrawn (sent on the old subscription) | `plan_change` | | `subscription.plan_changed` | The plan change took effect (sent on the new subscription, instead of `activated`) | `previous: {id, plan_id, plan_name}`, `effective_at` | | `subscription.replaced` | The old subscription of a plan change ended (sent on the old subscription, now `canceled` with `cancel_source: plan_changed`, usually together with `plan_changed`). Not a cancellation: the service goes on with the new subscription | `replaced_by`, `effective_at` | The business meaning of each event and the recommended handling are given in the [integration guide: Subscriptions](/en/developers/integration/#subscriptions). ### Help ticket and system events | Event | `data` | |---|---| | `support.ticket_created` | A payer submitted the checkout's payment help form: `{id, ticket_no, livemode, order_id, merchant_order_no, kind, tx_hash, payer, customer_email, attachments}` | | `system.` | A notification of the alert center: `{alert_id, status: open \| resolved \| event, subject, details}`; `system.payee_blocked` is the exception, with `{payee: {ref, name}, address, chain_id, hits}` | ```json { "type": "support.ticket_created", "data": { "id": "fe5970ad-9c67-4378-a1d0-01ffcf439843", "ticket_no": "T-20261022-0001", "livemode": true, "order_id": "8a1bb5ea-4a41-4bc1-aff5-7e66f1f812f9", "merchant_order_no": "SO-10023", "kind": "not_credited", "tx_hash": null, "payer": null, "customer_email": "payer@example.com", "attachments": 0 } } { "type": "system.rpc_down", "data": { "alert_id": "70e6b891-7624-45e7-80c5-0bf3f7213cde", "status": "open", "subject": "31338", "details": { "chain_id": 31338, "endpoints": 1 } } } ``` ## System events `system.` System events are intended for operations; most business systems only need to log them or forward them to monitoring. The ones that require action are mainly those marked as requiring a refund. The opening (`open`) and the resolution (`resolved`) of an alert share one `alert_id`; a one-off notification has the status `event`. Alerts about test data carry `livemode: false` and go to the test endpoint. | `kind` | Type | Description | |---|---|---| | `rpc_down` | Open / resolved | Every RPC endpoint of a chain is unavailable (`subject` is the chain ID) | | `relayer_low_balance` | Open / resolved | The sponsoring hot wallet's balance is below its minimum | | `walletconnect_down` | Open / resolved | The WalletConnect relay is unavailable | | `keeper_idle` | Open / resolved | Live subscription charges have been due for 15 minutes while the keeper has not run for 5 minutes | | `keeper_stalled` | Open / resolved | Subscription charges or on-chain cancels cannot be sent on a chain (hot wallet balance, gas price cap or RPC) | | `charge_failure_rate` | Open / resolved | The subscription charge failure rate is above the threshold | | `reconcile_recovered` | One-off | Reconciliation recovered events the indexer had missed | | `split_mismatch` | Open | A payment's on-chain splits match none of the order's quotes | | `unquoted_payment` | Open | A payment not quoted by this system appeared on the contracts of a replaced key (it is not booked) | | `payment_unquoted_chain` | Open | A payment on a chain where its order has no quote for that token and amount, or whose network does not serve the order's mode (a live order paid with test coins): not booked (`reason` tells which) | | `sub_event_wrong_network` | Open | A subscription event on a chain whose network does not serve the subscription's mode: not booked | | `sub_foreign_payer` | Open | Solana: another payer opened an on-chain subscription with the terms quoted for a subscription; it is canceled on chain and its charges are recorded as duplicates: **refund them** | | `payee_ata_recreated` | One-off | A payee token account the hot wallet created was closed and is needed again: the payer pays instead of the sponsor, the keeper funds it again, or past the limit the charge fails (`action` tells which) | | `token_paused`, `token_depeg`, `price_feed_stale`, `token_impl_changed` | Open / resolved | A token is paused, has lost its peg, its price feed is stale, or an upgradeable token's implementation changed | | `sub_charge_after_cancel` | Open | A charge landed after the subscription was canceled and before the on-chain cancel: **a refund is required** | | `sub_charge_retired_method`, `sub_duplicate_charge` | Open / resolved | A charge landed on a replaced payment method; a second on-chain charge for the same period: **a refund is required** (resolved when the other charge leaves the chain) | | `sub_duplicate_subscribe` | Open | The payer subscribed again with replaced terms; the second on-chain subscription will be canceled | | `sub_onchain_cancel_failed` | Open | The on-chain cancel of a subscription failed | | `sub_subscribe_front_run`, `sub_funding_missing` | One-off / open | A sponsored subscribe was front-run with its funding stripped; the allowance is missing after subscribing and the payer must authorize it | | `payer_risk_blocked` | One-off | Risk screening refused a payer at quote time or at a sponsored submission (at most once a day per payer and chain) | | `risk_provider_down`, `ofac_import_failed`, `risk_list_import_failed` | Open / resolved | A third-party risk provider is unavailable; the OFAC or a URL feed import failed (the existing entries are kept) | | `email_suppressed` | One-off | Sending to an address stopped after repeated bounces | | `signer_rotated` | One-off | A new quote signer key was activated (`emergency` means the old key is treated as compromised) | | `signer_mismatch`, `signer_unavailable` | Open / resolved | The signer address embedded in the contracts differs from the recorded one; a signer key kept in a KMS cannot sign (quotes answer `503`) | | `payee_blocked` | One-off | A payee address was blocked by screening on a chain (the `data` shape is given above) | Duplicate payments, payments booked with a risk hit, frozen payments and risk pauses are reported by business events (`order.duplicate_paid`, the order's `risk_flag`, `order.payment_frozen`, `subscription.risk_paused`) and not additionally as `system.*`. Dual approval requests appear in the alert center only. Alert kinds may be added in later versions; handle unknown kinds generically. ## Alert channel webhooks The alert center's generic webhook channel is independent of the business webhook and is suited to operations tooling. The body is `{id, type: alert.open | alert.resolved | alert.event, created_at, data: {alert_id, kind, title, status, subject, details, at, console_url}}`, signed with the channel's own secret using the same `FlowPay-Signature` scheme. `id` identifies the delivery and stays the same across retries; `created_at` is the time of the attempt. Only alerts about live data are delivered, deliveries are not ordered, and failures are retried on the same schedule for about a day. ```json { "id": "57096b05-9d75-47bc-ac14-d03d29f96823", "type": "alert.open", "created_at": "2026-10-22T14:16:11.970582Z", "data": { "alert_id": "70e6b891-7624-45e7-80c5-0bf3f7213cde", "kind": "rpc_down", "title": "RPC 节点全部不可用", "status": "open", "subject": "31338", "details": { "chain_id": 31338, "endpoints": 1 }, "at": "2026-10-22T14:16:11.889963Z", "console_url": "https://pay.example.com/admin/" } } ``` ## The event feed `GET /v1/events` The event feed is the pull alternative to webhooks and requires the `events:read` scope. ```sh curl "$BASE/v1/events?since=0&limit=7" -H "Authorization: Bearer $KEY" ``` ```json { "data": [ { "type": "order.paid", … }, { "type": "order.paid", … }, { "type": "order.duplicate_paid", … }, { "type": "order.expired", … }, { "type": "order.refunded", … }, { "type": "support.ticket_created", … }, { "type": "subscription.activated", … } ], "next_since": 8 } ``` - It lists every event of the key's mode (whether or not the webhook was delivered) in commit order, with the same content as webhooks (order events carry `customer_email` here too). - Pass the `next_since` of a response as the next `since`. With no new events, `data` is empty and `next_since` equals `since`. Positions are shared by both modes, so a mode's feed skips numbers (in the example, 7 events are followed by 8 because one position belongs to a test event). - A position never changes once returned, and no event is ever placed before a position already returned. An event appears once every database transaction that could still commit an earlier one has ended; the feed may trail commits briefly but never skips. - `limit` defaults to 100, and values outside 1–500 are clamped. Events are kept ("Delete all test data" removes test events), so `since=0` replays the whole history. - Use it as a fallback for webhooks, or for polling in environments without a public endpoint (for example every 10–30 seconds). Persist `next_since` and deduplicate by event `id` (sharing the deduplication table with webhooks). --- # Test mode (Sandbox) URL: https://docs.flowpayra.com/en/developers/sandbox/ A single deployment provides both **live mode** and **test mode**. Business systems integrate with a test API key: test orders are paid on testnets only, test events go to a separate test webhook, and test data and live data cannot see each other. Going live only requires replacing the API key and the webhook secret with the live ones; endpoints and event formats are identical. ## Differences between the modes | | Live mode | Test mode | |---|---|---| | API key | `fpk_live_…` (early `fpk_…` keys are live as well) | `fpk_test_…` | | Networks | Mainnets (Ethereum, Base, BNB Smart Chain and others) | Testnets (Sepolia, Base Sepolia and others); local development chains serve both modes | | Objects and events | `livemode: true` | `livemode: false` | | Webhook | Console, "Developers → Webhooks" (live) | The webhook settings shown after switching the console to test mode, with a separate endpoint and secret | | Return signature | Live webhook secret | Test webhook secret | | Checkout | — | A "test mode" banner at the top | | Receipt emails | — | Subject prefixed with "[测试]" / "[Test]" | | Amount limits | Applied | Not applied | | Risk address screening | The merchant's list, the OFAC list, URL feeds and named lists, sanctions oracles, third-party providers | Local lists only (the merchant's list, OFAC, URL feeds and named lists; a test wallet can be listed to rehearse the refusal flow) | | Risk address list API | Reads and writes every entry | Reads every entry; writes, replaces and removes only entries scoped to a testnet chain (`403 testnet_only`) | | Alerts | Alert center and its channels | Marked as test data in the console's alert list; `system.*` events go to the test webhook and not to alert channels | Both modes share the configuration: chains and tokens, payees and split rules, plans, the risk address list, the checkout appearance and the legal pages. The same `plan_id`, `payee_ref` and `split_rule_id` work in either mode. The risk address list is installation-wide configuration, so entries written by a test key must be scoped to a testnet (a `chain_id` whose network type is testnet). Exercising `POST /v1/risk/addresses` and the bulk import therefore does not change the screening of live payments, while test payers on testnets are still blocked or flagged by those entries. Local development chains accept payments in both modes and are not testnets, so a test key cannot write entries for them. `merchant_order_no` is unique within each mode, so a test order may reuse a live order's number. Reading a live order with a test key (or the reverse) answers `404`. `GET /v1/events` lists only the key's mode's events (positions are shared by both modes, so numbers are skipped). ## Obtaining a test API key - Console, "Developers → API keys": choose "Test" when creating the key (step-up verification required). - On the server: `flowpayra-lite apikey create --name ci --mode test`. - Local development environment: `make devnet` prints both a live and a test key (`devnet/.state/api-key`, `devnet/.state/test-api-key`). ## Preparing a testnet 1. In the console under "Chains & tokens → Add chain", enter the testnet's chain ID. Built-in testnets fill in the name, block time and confirmations automatically and are marked as testnets: | Testnet | Chain ID | Native coin | Faucet | |---|---|---|---| | Sepolia | 11155111 | ETH | Sepolia faucets by Google Cloud Web3, Alchemy, Infura and others | | Base Sepolia | 84532 | ETH | Coinbase Developer Platform faucet, or bridge from Sepolia | | Arbitrum Sepolia | 421614 | ETH | The official Arbitrum bridge (from Sepolia), Alchemy faucet | | OP Sepolia | 11155420 | ETH | Superchain faucet | | Polygon Amoy | 80002 | POL | Polygon faucet | | BNB Smart Chain Testnet | 97 | tBNB | The official BNB Chain faucet | | Avalanche Fuji | 43113 | AVAX | Avalanche Builder Hub faucet | | X Layer Testnet | 1952 | OKB | OKX developer faucet | For other chains, set the network type to testnet when adding the chain. A chain's network type can also be changed on the "Chains & tokens" page (step-up verification required); new quotes, sponsored transactions and keeper charges are then routed by the new type. 2. Deploy the merchant contracts on the testnet as you would on a mainnet (the contract deployment checklist, or `flowpayra-lite deploy all --rpc …` followed by `flowpayra-lite signer verify` to record them) and list a test stablecoin (for example the test USDC that Circle issues on Sepolia and Base Sepolia, available from the Circle faucet). See [Chains and contracts](/en/console/chains-and-contracts/). 3. Payee addresses apply per chain: a payee's common address is used on testnets as well, or a separate address can be registered for a testnet. 4. If gas sponsorship is needed, fund the hot wallet with the testnet's native coin. ## The test mode webhook 1. Switch the mode to "Test" at the top of the console; a test mode notice appears at the top of the page. 2. In the webhook settings shown in test mode, enter the test environment's endpoint URL and replace the signing secret to obtain the test secret `whsec_…` (shown once). 3. Verification is the same as for the live webhook (see [Webhooks: signature verification](/en/developers/webhooks/#signature-verification)), only with a different secret; the top-level `livemode` of the event body is `false`. 4. Return URLs of test orders are signed with the test secret. Live and test events are each delivered in order: a failing receiver in one mode does not affect the other. ## Deleting test data The console page "Developers → Test mode" shows how much test data exists. "Delete all test data" removes every test order, subscription (including charge records), refund, help ticket, event and alert. The action requires the admin role and step-up verification, is recorded in the audit log, and notifies the other admins. Test API keys, the test webhook and the shared configuration are kept. On-chain test subscriptions remain on the testnet, and the system no longer charges them. ## Local development chains The two local Anvil chains (31337 and 31338) are local development chains: both live and test mode accept payments on them, which allows rehearsing both modes without a public testnet. `make devnet` prints two keys and two webhook secrets; `DEVNET_SEED_ARGS="--test-webhook-url http://127.0.0.1:9998/hook"` also sets the test webhook endpoint. --- # API overview URL: https://docs.flowpayra.com/en/developers/api/ The business API is a server-to-server interface for the merchant's business system: it creates and reads orders and subscriptions, lists payees and plans, reads the event feed, and maintains the risk address list. Payers pay on the hosted checkout (`checkout_url`); the system confirms payments on chain and reports them through signed webhooks and `GET /v1/events`. :::note The full OpenAPI 3.1 specification is served by every deployment at `GET /v1/openapi.yaml` (no authentication). It matches the deployment's version and is the authoritative definition of fields, status codes and error codes. A Postman collection generated from it ships in the repository (`docs/developers/postman`). ::: ## Base URL The API lives under the merchant's own deployment address (the `public_url` setting), for example: ``` https://pay.example.com/v1/orders ``` This documentation writes `$BASE` for the deployment address and `$KEY` for the API key. Request bodies are JSON (`Content-Type: application/json`). Amounts are always decimal strings, never JSON numbers. ## Authentication ```sh curl "$BASE/v1/plans" -H "Authorization: Bearer $KEY" ``` - API keys are created in the console under "Developers → API keys" or with `flowpayra-lite apikey create`, and sent in the `Authorization: Bearer` header. A missing, malformed, unknown or revoked key answers `401 unauthorized`. - **Scopes**: every key carries a set of scopes: `orders:write`, `orders:read`, `subscriptions:write`, `subscriptions:read`, `events:read`, `risk:read`, `risk:write`. A key created without naming its scopes gets all but `risk:read` and `risk:write`. A key that lacks an operation's scope answers `403 insufficient_scope` (checked after the path and query parameters are parsed, before the request body and the `Idempotency-Key`). - **Modes**: every key belongs to one mode, visible in its prefix: `fpk_live_…` (live) or `fpk_test_…` (test); `fpk_…` keys made before modes existed are live. A key creates and sees only its own mode's orders, subscriptions and events, and another mode's object answers `404`. See [Test mode](/en/developers/sandbox/). The mapping of scopes to endpoints is given in the [integration guide](/en/developers/integration/#scopes). ## Versioning - Paths are prefixed with `/v1`, and the `info.version` of the OpenAPI specification is `"1"`. - `GET /v1/openapi.yaml` returns the specification of the deployed version. Check against it when generating a client or after upgrading the deployment. - New webhook event types and alert kinds may be added in later versions; receivers should acknowledge unknown types with 2xx. ## Idempotency Writes that create require an `Idempotency-Key` header (1–255 characters) and answer `400 invalid_request` without it: - `POST /v1/orders` - `POST /v1/subscriptions` - `POST /v1/subscriptions/{id}/change_plan` - `POST /v1/risk/addresses` - `POST /v1/risk/addresses/import` Rules: - Keys are scoped to the API key. The first answer (2xx or 4xx) is stored with a SHA-256 of the raw body: a retry with the same key and the same body bytes returns it again with the same status and body. - The same key with another body answers `422 idempotency_key_reused`; a retry while the first request is still running answers `409 request_in_progress`. - A server error (5xx) is not stored: retry with the same key. Stored keys do not expire. - The other writes (`cancel`, `pause`, `resume`, `DELETE`) take no key. ## Error format An error answer carries an HTTP status and the following body: ```json { "error": { "code": "invalid_request", "message": "expires_in must be between 60 and 604800 seconds", "params": { "field": "expires_in", "min": 60, "max": 604800 } } } ``` - `code` is stable and suitable for program logic. - `params` (when present) carries the values behind the error: the `field` at fault, limits such as `min` / `max`, amounts and currencies, for wording the message in your own language. - `message` is English and intended for logs. Every operation may also answer `500 internal` (retry later), `408` (the request took over 30 seconds; empty body) and, for a path or method that does not exist, `404` / `405` with an empty body. Request bodies are limited to 64 KiB (4 MiB for the bulk import); larger bodies answer `413 payload_too_large`. There is no rate limit on the business API. Common error codes and when they occur are listed in the [integration guide: Idempotency and errors](/en/developers/integration/#idempotency-and-errors). The `code` values each operation may return are listed with its responses in the OpenAPI specification. ## Pagination | Endpoint | Method | |---|---| | `GET /v1/events` | Position cursor: `since` (default `0`) and `limit` (default 100; values outside 1–500 are clamped). The answer is `{data, next_since}`; pass `next_since` as the next `since` | | `GET /v1/risk/addresses` | ID cursor: `limit` (default 100; values outside 1–500 are clamped) and `after`. The answer is `{data, has_more, next_after}`; pass `next_after` as `after` for the next page. `next_after` is `null` on the last page | | `GET /v1/payees`, `GET /v1/plans` | Not paginated; the answer is `{data}` | ## Endpoints ### Orders | Endpoint | Scope | Description | |---|---|---| | `POST /v1/orders` | `orders:write` | Creates an order; the answer carries the `checkout_url` for the payer. Idempotent | | `GET /v1/orders?merchant_order_no=` | `orders:read` | Finds the mode's order by your order number (exact match) | | `GET /v1/orders/{id}` | `orders:read` | Returns the order as it stands: the source of truth for fulfilment | ### Payees and plans | Endpoint | Scope | Description | |---|---|---| | `GET /v1/payees` | `orders:read` | Lists every payee registered in the console (active or not), for `splits[].payee_ref` / `payee_id` | | `GET /v1/plans` | `subscriptions:read` | Lists the active subscription plans; pass a plan's `id` as `plan_id` | ### Subscriptions | Endpoint | Scope | Description | |---|---|---| | `POST /v1/subscriptions` | `subscriptions:write` | Creates a subscription on a plan and returns its `checkout_url` (`/pay/sub/{id}`); the status starts as `incomplete`. Idempotent | | `GET /v1/subscriptions/{id}` | `subscriptions:read` | Returns a subscription | | `POST /v1/subscriptions/{id}/cancel` | `subscriptions:write` | Cancels a subscription: charging stops at once and the system then cancels it on chain | | `POST /v1/subscriptions/{id}/pause` | `subscriptions:write` | Pauses a subscription: no charges while paused, and paused periods are not charged later | | `POST /v1/subscriptions/{id}/resume` | `subscriptions:write` | Resumes a paused subscription; charging resumes from the next period | | `POST /v1/subscriptions/{id}/change_plan` | `subscriptions:write` | Changes the plan (upgrade or downgrade): returns a new `incomplete` subscription whose terms the payer confirms. Idempotent | ### Events | Endpoint | Scope | Description | |---|---|---| | `GET /v1/events` | `events:read` | Reads every webhook event of the key's mode in commit order, whether or not delivery succeeded | ### Risk address list | Endpoint | Scope | Description | |---|---|---| | `GET /v1/risk/addresses` | `risk:read` | Lists risk address entries of every source, newest first, with filters and pagination | | `POST /v1/risk/addresses` | `risk:write` | Adds an entry to the merchant's list or to a named list. Idempotent | | `POST /v1/risk/addresses/import` | `risk:write` | Imports entries in bulk (up to 10,000 per request, all valid or none), in `append` or `replace` mode. Idempotent | | `DELETE /v1/risk/addresses/{address}` | `risk:write` | Removes an address's entries from the merchant's list or a named list | ### Specification | Endpoint | Scope | Description | |---|---|---| | `GET /v1/openapi.yaml` | No authentication | The OpenAPI 3.1 document of the deployment's version (YAML) | ### Webhooks (sent by the system to the merchant) The `webhooks` section of the OpenAPI specification also defines two outbound requests: | Request | Description | |---|---| | Event delivery | Events POSTed to the webhook endpoint configured in the console, with the `FlowPay-Signature` header | | Alert center notification | Notifications of an alert center webhook channel, independent of business events and signed with the channel's own secret | See [Webhooks](/en/developers/webhooks/). ## Tools - **Integration docs in the console**: "Developers → Integration docs" in the console opens the guides and the API reference in a new window. Each endpoint has an interactive console: after entering an API key, requests can be sent directly to the deployment and the equivalent curl command copied. A test key (`fpk_test_…`) is recommended for integration work. - **Postman collection**: import `docs/developers/postman/flowpay.postman_collection.json` from the repository and set the collection variables `base_url` (the deployment's `public_url`) and `api_key` (`fpk_test_…` for integration, `fpk_live_…` for production). Write requests generate a new `Idempotency-Key` on every send. - **Signature verification examples and test vectors**: see [Webhooks: signature verification](/en/developers/webhooks/#signature-verification). --- # Security model URL: https://docs.flowpayra.com/en/security/model/ This page is written for a technical reader. It explains which structures protect funds in FlowPayra Lite, what each kind of key can and cannot do, and which residual risks are known and accepted. :::note This page describes the constraints provided by the design and implementation. The contracts and the Solana program have been reviewed internally; the reviews and the shared contract deployments are listed in [Security reviews](/en/security/audits/). ::: ## Non-custodial structure - **The system holds no funds.** The payer's wallet transfers tokens directly to the payees, and the split completes atomically within a single transaction. The contracts are not upgradeable, have no owner and no withdrawal function, and hold a zero balance when a transaction ends. - **The hot wallet pays gas only.** The hot wallet is used for gas sponsorship and for submitting subscription charge transactions. It holds a small amount of native coin, never handles payment funds, and uses a different private key from the quote signer key. - **Refunds are sent directly from the receiving address.** The system only verifies the refund transaction; it does not transfer on anyone's behalf. A compromised server therefore does not directly lead to payment funds being taken: there are no funds in the system to withdraw, and the contracts transfer only as the payer authorized. ## Merchant contracts: an ownerless factory and immutable clones The contracts on EVM chains have three layers: | Layer | Contract | Deployment | Description | |---|---|---|---| | Implementations | `FlowPayRouterImpl`, `FlowPaySubscriptionsImpl` | Created by the factory's constructor, once per chain | The business logic; no owner, not upgradeable, no withdrawal function. Calling a business function on an implementation directly reverts (`onlyClone`) | | Factory | `FlowPayFactory` | Deployed through the CREATE2 deployment proxy, once per chain | Its constructor creates the two implementations and stores their addresses as immutables. It has only two functions, `predict(signer, salt)` and `deploy(signer, salt)` (idempotent); no owner, no configuration | | Merchant contracts (clones) | Router clone, Subscriptions clone | Once per quote signer key per chain | Minimal proxies with immutable arguments (based on EIP-1167). The quote signer address is written into the clone's bytecode as an immutable argument | Properties of the merchant contracts: - **No initializer, no admin, no modifiable parameters.** The signer address is part of the clone's bytecode and cannot be changed by anyone; there is no front-running of an initializer. - **The code cannot change.** A clone can only delegate to the implementation bound by the factory. The implementations are not upgradeable, and the factory cannot change the implementation addresses. - **The deployer does not matter.** A clone's address is determined uniquely by the factory address, the implementation address, the signer address and the salt, and the deployer has no rights over the contract. - **Merchants are structurally isolated.** A payer's allowance is granted to one merchant's clone and cannot be used by another merchant's clone. A payer can also revoke the allowance for a single merchant's clone. - **The contract address identifies the merchant.** The `verifyingContract` of the EIP-712 domain is the merchant's clone address, so signatures are bound to that merchant and that chain. Any change to the contracts changes the factory's init code and therefore yields new factory, implementation and clone addresses; subscriptions on existing clones continue under their original terms. Deployment verification compares the on-chain code hash of each contract with the code the release should produce, and the console does not confirm a deployment when any required contract differs. The procedure is described under [Chains and contracts](/en/console/chains-and-contracts/). ## Security boundary: funds move only on the payer's authorization **Threat model**: any merchant system is assumed to be potentially malicious or compromised. It can sign arbitrary quotes, read the mempool, front-run transactions and deploy its own clones. **Core invariant**: every transfer the contracts make out of a payer's address must be backed by that payer's own authorization of the **complete payment terms**, either a transaction sent by the payer or the payer's EIP-712 signature. A merchant signature, a third-party submission or an existing allowance can never on its own be the basis for moving funds. ### What the payer authorizes For a one-time payment the payer authorizes a `PaymentIntent` (EIP-712, with the merchant's Router clone address and the `chainId` as the domain) containing: | Field | Meaning | |---|---| | `orderId` | The order identifier, unique within the merchant's clone | | `payer` | The paying address | | `token` | The token (the zero address for the native coin) | | `amount` | The total amount | | `payTo` | The split array: every receiving address with its amount | | `deadline` | The deadline | - The splits are part of the signed structure as an array, not merely as a hash, so the wallet's signing screen can show each receiving address and amount. - The domain contains the `chainId` and the clone address, so a signature cannot be replayed on another chain or another contract. The Router and Subscriptions use different domain names, and every kind of signature has its own type string. - Each order identifier can be paid only once per clone (`paid[orderId]`). For a subscription the payer authorizes `SubscriptionTerms`, which additionally contain the amount per period, the per-period splits, the interval, the first payment time, the maximum number of payments (which must be greater than 0), whether the first period is charged immediately, the funding source, the deadline for subscribing and a unique salt. ### Two kinds of signature | Signature | Signer | Protects | Purpose | |---|---|---|---| | Payment authorization (`PaymentIntent` / `SubscriptionTerms`) | The payer | The payer | Decides whether funds can leave the payer's address, to whom, how much and how many times. It is the contracts' only basis for moving funds | | Merchant signature (`quoteSig`) | The quote signer key written into the clone | The merchant | Proves that the amount and the payees were issued by this merchant, so that a payer cannot alter them and nobody else can use the merchant's order identifiers | Signature checks first attempt ECDSA recovery; the signature is valid if the recovered address equals the signer. Otherwise, and only when the signer has code, ERC-1271 is checked. EIP-7702 delegated accounts can therefore sign with their own private key, contract wallets use ERC-1271, and the zero address is never valid. ### Payment authorization methods | Method | Payer's authorization | Enforced by the contract | |---|---|---| | Native coin | A transaction sent by the payer | `msg.sender == payer`, `msg.value == amount`; each split in the transaction parameters is transferred | | Allowance | A transaction sent by the payer | `msg.sender == payer`. The contract pulls only from `msg.sender`, so a leftover allowance can be used only by the payer | | EIP-3009 | A `receiveWithAuthorization` signature | The contract computes `nonce = hash(PaymentIntent)` on chain and requires it to equal the nonce in the signature; `to` is the contract itself. The signature is therefore usable only for this order and these payees | | Permit2 | A `permitWitnessTransferFrom` signature | `witness = hash(PaymentIntent)`; the signed structure shows the complete terms in the wallet | | EIP-2612 permit / DAI permit | The permit signature itself carries no order information | One of two: the payer submits the transaction (`msg.sender == payer`), or the payer's EIP-712 signature over the `PaymentIntent` is attached and someone else may submit it. A permit signature alone is always refused | Allowances are kept minimal: one-time payments approve the exact amount, and Permit2 and EIP-3009 are signed per payment; only the witness variant of Permit2 is used. A DAI permit can only grant an unlimited allowance, which the checkout states explicitly before signing. ### The quote signer key cannot move funds The quote signer key can only prove that a quote was issued by the merchant. The contracts never treat a merchant signature as a basis for moving funds, so a holder of a leaked key cannot take a payer's funds or redirect a payment. The effect of a leaked key is limited to its clones: - signing phishing quotes that look genuine (the payer must still authorize the complete terms); - occupying order identifiers on the clone; - canceling subscriptions on the clone with `cancelByMerchant` (an interruption of revenue, not a loss of funds). The response is an emergency rotation; see [Key management](#key-management). ### The contracts hold no balance - The allowance, EIP-2612 and DAI permit paths execute `transferFrom(payer → payee)` for each payee, so funds go directly. - The EIP-3009 and Permit2 paths pull the funds into the clone and distribute them within the same transaction, leaving the clone's balance at zero. - Native coin is sent to each payee in turn. - If a transfer to any payee fails, the whole transaction reverts. Direct paths check each payee's balance delta; paths through the clone check the amount the clone actually received and send all of it on. - Every state-changing entry point has a re-entrancy lock, and state is written before external calls. - Split rules are enforced by the contract: 1–10 payees, non-zero and distinct addresses, none equal to the clone itself or to the payer, every amount greater than 0, and a sum equal to the total. ## Subscription guarantees The subscriptions contract (`FlowPaySubscriptions`) charges according to the terms signed by the payer. An allowance is a precondition, never the basis for a charge: - **Creation**: only by the payer calling `subscribe`, or by someone submitting the payer's signature over the `SubscriptionTerms` (`subscribeWithSig`). - **At most once per period**: `charge(subId)` can be triggered by anyone, but the amount, payees and frequency are fixed by the terms. - **No catch-up**: a missed period is never charged later. - **Capped**: cumulative charges never exceed `amount per period × maximum payments`. The maximum must be greater than 0, so there are no open-ended subscriptions. Nothing can be charged before the first payment time. - **Immutable terms**: after creation, the amount, interval, payees and splits cannot be modified; the contract has no function that changes terms. Plan changes are made by creating a new subscription that the payer authorizes again. - **Cancel at any time**: the payer can cancel at any time (`cancel`, or `cancelWithSig` submitted by someone else with the payer's signature) or revoke the allowance (`approve(0)`, Permit2 `lockdown`). The main payee (`payTo[0]`) can cancel, and the merchant's quote signer can sign `cancelByMerchant`. Canceling only stops future charges. - **Shared allowances stay within each subscription's terms**: several subscriptions of one payer on the same merchant clone and token share one allowance; the contract counts each subscription separately, and none can exceed its own terms. There are two funding sources: a token allowance for the Subscriptions clone (which an EIP-2612 permit can grant within the subscribe transaction), or a Permit2 allowance. ## TRON: the factory variant TRON uses a dedicated factory, `FlowPayFactoryTron`, which is the only contract that differs on the TRON track: - The two implementations and the clone logic are identical to EVM. The factory's ABI (`deploy`, `predict`, the `MerchantDeployed` event) matches the EVM factory, and it likewise has no owner, no upgrade path and no withdrawal; anyone can call `deploy`. - Clones are created with CREATE rather than CREATE2 and recorded in a mapping keyed by `(signer, salt)`, which makes `deploy` idempotent: for an existing key it returns the recorded pair of addresses. - As a result, clone addresses on TRON are not known before deployment, and `predict` returns the zero address until the clones are deployed. `FlowPayFactoryTron` was covered by the second internal review (see [Security reviews](/en/security/audits/)). ## Solana: the `flowpay` program On Solana, one Anchor program reproduces the semantics of the EVM contracts: one-time payments with atomic splits, pre-authorized subscriptions charged one period at a time, and merchant quote signatures that only protect the merchant. - **Payer authorization**: the payer signs the transaction whose instruction data carries the full `PaymentIntent` / `SubscriptionTerms` (order identifier, token mint, amount, every payee with its amount, deadline, interval, number of periods and so on). Every transfer out of the payer is backed by a transaction the payer signed. - **Merchant quote signature**: the quote signer is an Ed25519 key that signs a 32-byte digest of the terms. The Ed25519 program instruction must come immediately before the FlowPay instruction, and the program checks the public key, the signature and the digest by instruction introspection. The three kinds of digest (payment, subscription, cancellation) use distinct domain prefixes. A quote signature can never move funds on its own. - **Merchant account (`Merchant`)**: a PDA derived from the quote signer's public key and a salt. Every merchant shares the same program and has its own merchant account, which is the only thing a merchant creates. - **`PaidOrder` record**: a PDA derived from the merchant account and the order identifier. Its existence is the "already paid" record; a second payment of the same order identifier fails (`AlreadyPaid`), whether by token or by SOL. - **Delegate-based subscriptions**: the payer's token account delegates to the merchant's delegate PDA an amount of at least `amount per period × maximum payments`. `charge` is permissionless, but charges at most once per period, never catches up and never exceeds the cap; before transferring it checks that the delegate is still in place and the delegated amount is sufficient. The payer, the main payee or the merchant's quote signature can cancel, and canceling only stops future charges. - **Payees are paid only into their associated token accounts (ATAs)**: the receiving account must be the payee's ATA for the mint, otherwise the instruction is refused (`PayeeTokenAccountInvalid`); a missing ATA is created by the program. Every transfer is a `transfer_checked`, and the destination's balance delta is verified. - **Token-2022**: a mint's extensions are checked against an allow list, at payment, at subscription opening and at every charge. Mints carrying the transfer fee, confidential transfer fee, transfer hook, permanent delegate or non-transferable extensions are refused, and so is any extension the list does not name (including ones added to Token-2022 later). - **Rent recovery**: a `PaidOrder` record can be closed by whoever funded its rent once the paid terms' deadline has passed (`close_paid_order`); a subscription account can be closed once it is canceled or completed and its terms' deadline has passed (`close_subscription`). Only the rent payer recorded in the account may close it, so a third party cannot remove a record. - **No admin**: the program has no admin, no configuration account and no withdraw instruction, and it holds no funds after an instruction completes. One difference from EVM: a Solana quote signature does not include the payer, so any address holding a quote can pay or subscribe with its own funds. Payer funds are unaffected. Screening of the paying address at quote time is therefore not binding on Solana, and risk addresses are screened against the actual payer at booking. ## Key management ### Quote signer keys - **Storage**: when kept locally, the private key is stored in the database encrypted with the master key; the console neither displays it nor offers it for download, and offline backups are exported from the command line as a password-encrypted JSON keystore (a standard Ethereum keystore for secp256k1; the same container, marked with its scheme, for a Solana ed25519 key), checked offline and restored as the same key. A key can alternatively be kept in AWS KMS or Google Cloud KMS: the private key never leaves the KMS and cannot be exported, and the server holds only access credentials (encrypted with the master key) or an instance role. - **KMS constraints**: a signature returned by the KMS must recover to the registered signer address, otherwise it is treated as a failure. When the KMS is unavailable the system does not fall back to another key; quotes answer `503 signer_unavailable` and an alert is raised. - **Key ring and rotation**: a key moves through the states pending, active (only one at a time), retiring and retired. Because the signer address is part of the clone bytecode, replacing the key means deploying a new set of clones for the new signer address on every chain. Quotes of the replaced key are still booked while valid, and subscriptions on its clones continue to be charged under their original terms. - **Emergency rotation**: once the new key is active, the old key's valid quotes and unsent subscription terms are voided immediately. The Router of a compromised or retired key books only payments that exactly match a quote issued by this system; anything else raises the `unquoted_payment` alert and is not booked. Subscriptions on the old clones are migrated by the payers through a payment method change (`subscription.migration_requested`). - Rotation requires the admin role and step-up verification for each action, is recorded in the audit log, and notifies the other admins. ### Master key - The master key (32 bytes) encrypts sensitive database content with AES-256-GCM: RPC URLs, webhook secrets, TOTP seeds, payer and admin email addresses, mail provider and SMTP credentials, the bounce notification URL's secret, third-party risk provider credentials, alert channel configuration, KMS connection credentials, locally stored quote signer private keys and others. - **The master key exists only in configuration** (the configuration file or an environment variable) and is never written to the database. A master key leaked on its own decrypts nothing. - **Rotation**: the new key is generated in the browser and shown once. After the admin writes it to the configuration, keeps the previous key as a decryption-only key and restarts, re-encryption is started from the console. This requires the admin role and step-up verification for each action, and approval by a second admin when dual approval is on. - If the master key and the database leak together, rotate the master key and re-encrypt, treat the quote signer key as compromised, and replace the webhook secrets and the RPC, mail provider and SMTP (then connect bounce notifications again) and risk provider credentials. ### API keys and webhook secrets - An API key is shown in plaintext once and stored only as a hash. A leaked key can at most create orders or subscriptions and read data within its scopes and mode. By default the business API can only reference registered payees and cannot introduce new receiving addresses. A test key cannot create live orders. - Webhooks and return URLs are signed with HMAC-SHA256, with separate secrets for live and test mode; see [Webhooks](/en/developers/webhooks/). ## Console security | Measure | Description | |---|---| | Passkeys and security keys | Based on WebAuthn with user verification required, bound to the site's domain and resistant to phishing. An account with a registered key can sign in without a password | | Authenticator app (TOTP) | Available only while the account has no passkey or security key registered; it is disabled automatically once a key is registered | | Recovery codes | 10 single-use codes stored as argon2 hashes; a session started with a recovery code can only open the account security page to register a factor again | | Sign-in protection | A security factor must be registered at first sign-in; 5 consecutive failed verifications during or after sign-in lock the account for 15 minutes (passkeys and security keys still sign in); wrong passwords at the sign-in page never lock the account and are limited per account name and IP; sessions expire after 12 hours and after 30 minutes of inactivity; passwords have at least 12 characters | | Step-up verification | Each sensitive action is issued a grant with a scope, a digest of the action and a 5-minute lifetime. With a key, the signature itself covers the action and can be used only once. Changing payee addresses, split rules, API keys, security settings, quote signer keys and the master key requires verification every time; for general configuration one verification within 5 minutes is sufficient | | Payee address protection | Payee addresses can only be configured in the console; besides step-up verification, a change requires entering the last 4 characters of the new address | | Dual approval | When enabled, changing a payee address, replacing the main payee, turning the split whitelist off, withdrawing from the hot wallet, and adding a member, resetting a member's factors, re-enabling a member or changing a role take effect only after a second admin approves with a key. Requests expire after 24 hours, and turning dual approval off itself requires a second admin's approval. Quote signer key rotation does not go through dual approval | | Audit log | Every sensitive action is written to the audit log with the values before and after the change; key actions are also emailed to the other admins | | Roles | `admin` (all permissions), `operator` (operational actions), `finance` (read-only and exports, with email addresses masked); permissions are enforced on the server as well | The procedures are described under [Admins and passkeys](/en/console/admins-and-passkeys/). Further protections: - Amounts, splits and deadlines are signed by the back end and checked by the contracts. The static assets of the checkout and the console are embedded in the program and served with a CSP. - Gas sponsorship submits transactions only for currently valid quotes, simulates them and screens the paying address first, and is bounded by submission limits, a daily budget and a gas price cap. - Payments are booked after the required confirmations; on a chain reorganization, bookings are rolled back by block hash and a notification is sent. - Token listing probes for and refuses fee-on-transfer and rebasing tokens; a token is used through EIP-3009 only if it passes the caller check (`receiveWithAuthorization` accepts calls from the receiving address only); an upgradeable token whose implementation changes is paused pending review. ## Residual risks The following limitations are known and accepted, and are stated as they are: - **Interface spoofing.** A malicious or compromised merchant system can present a forged checkout and induce a payer to sign unfavourable terms. The contracts cannot prevent this. The mitigation is that the signed structures use readable field names and list every receiving address and amount for the wallet to display. Payers should check what the wallet's signing screen shows. - **Quote signer key compromise.** Payer funds are not at risk, but phishing quotes can be signed, order identifiers occupied, and every subscription on the affected clones canceled; this requires an emergency rotation and migration of the subscriptions by the payers. - **Pausing a subscription is off-chain only.** The keeper does not charge while a subscription is paused, but the on-chain subscription remains valid and anyone can still call `charge`; such charges are booked as usual. - **The window between canceling in the system and on chain.** `charge` is open to anyone, so a period may be charged before the on-chain cancel lands. The system books the charge and raises an alert, and the merchant refunds it. - **Charge timing.** "At most once per period" is a rule on the period grid, not a minimum interval: if a period is charged only at its end, the next period can be charged as soon as it starts, so two charges may be close together. - **A signed payment authorization cannot be revoked on the Router before its deadline.** It can only be revoked at the token level (for example by canceling the EIP-3009 authorization, invalidating the Permit2 nonce, or `approve(0)`). Quotes are valid for 10 minutes. - **DAI permits are unlimited.** This is a property of DAI's permit; the checkout states it before signing. - **Token behaviour.** Paths through the clone check only the amount the clone received, so a token that charges a fee only on outgoing transfers leaves payees short. Balance-delta checks constrain what payees receive, so a token that takes extra from the sender makes the payer pay more. A non-compliant EIP-3009 token could leave funds locked in a clone. These cases are excluded by token listing requirements and probes, not by the contracts. - **Receiving addresses the contracts cannot recognize.** A payee that is the same merchant's other clone, an implementation contract, Permit2 or a token contract is not rejected by the contracts; the back end refuses such addresses when payees are registered. - **Funds sent to a clone by mistake cannot be recovered.** Clones have no withdrawal function; this is the cost of having no admin. - **`subscribeWithSig` can be front-run with its funding data stripped.** Funds are not at risk; when the back end detects that a landed subscription lacks its allowance, it follows up with the authorization. - **After a Solana record is closed.** Once a `PaidOrder` record is closed, another quote of the same order identifier with a later deadline could be paid again (with the payer's own funds and signature). The back end accounts for payments by their on-chain events and treats this as a duplicate payment. - **Duplicate payments across chains.** A single valid quote, in-flight locking and short validity reduce the likelihood; when it happens, the order is marked `duplicate_paid` and a refund is opened. - **Parts that depend on the operator.** Risk address screening depends on the quality of the lists and third-party data. Protecting the server, the master key and the admin accounts is the responsibility of the party running the deployment. --- # Security reviews URL: https://docs.flowpayra.com/en/security/audits/ This page lists the security reviews carried out on FlowPayra Lite's on-chain components, the tooling that tests and analyses them, and the addresses of the shared contracts on each network. The structure and the security boundary are described in the [security model](/en/security/model/). :::note Every review on this page is an **internal review**, carried out within the project. ::: ## Internal reviews | Review | Date | Scope | Conclusion | Findings fixed | |---|---|---|---|---| | Contract self-review | 2026-10-18 | All sources in `contracts/src` | No issue found that could lead to loss of funds or unauthorized transfers. 1 medium (compatibility and availability), 2 low and 10 informational items | 1 medium and 1 low fixed in the contracts, plus one hardening (R4); the other low is handled by the back end | | Subscriptions self-review (contract and back end) | 2026-10-18 | The subscriptions contract and the subscription back end, keeper and checkout | Contract: 1 medium, 1 low. Back end: 2 medium and several low. A second pass (keeper, accounting, checkout) raised 17 items, one of them a high-severity functional issue in the back-end keeper | All fixed | | Internal review round 1 | 2026-10-21 | All sources in `contracts/src` (EVM contracts) | No issue found that could lead to loss of funds or unauthorized transfers; no high or medium findings. 4 low and 10 informational items | 3 low fixed by contract hardening on 2026-10-22; the fourth is a token listing requirement | | Internal review round 2 | 2026-11-09 | All sources in `contracts/src` (including `FlowPayFactoryTron`) and all sources of the Solana program | No new high, medium or low findings in the EVM and TRON contracts. 2 low findings in the Solana program; 1 design difference confirmed and left as is | Both low findings fixed | | Internal review round 3 | 2026-11-16 | All sources in `contracts/src`, all sources of the Solana program, and the back-end paths its findings involve | No new findings in the EVM and TRON contracts. Solana: 1 high (quotes not bound to the cluster) and 3 low; 4 informational items | The high and the 3 low findings fixed (program and back end); 3 informational items fixed, 1 (TRON) left unchanged for now | Each review was a line-by-line manual review with reproduction tests written for its findings. Round 1 merged three independent reviews, and each of its findings was reproduced as a Foundry test. ## Findings and their disposition ### Contract self-review | ID | Severity | Issue | Disposition | |---|---|---|---| | M-1 | Medium | Addresses with code were checked through ERC-1271 only, so EIP-7702 accounts signing with their own key were refused | Fixed: ECDSA recovery first, then ERC-1271 | | L-1 | Low | After the last period of a subscription was missed, `remainingCap` still reported a chargeable amount | Fixed | | L-2 | Low | `subscribeWithSig` can be front-run with its funding data stripped | Contract unchanged; handled by the back end | | R4 (addition) | — | A split whose receiving address is the clone itself would lock that share in the clone permanently | Fixed: the contract refuses a payee equal to the clone itself | ### Subscriptions self-review | ID | Severity | Issue | Disposition | |---|---|---|---| | S-M1 | Medium | Canceling off chain did not stop on-chain charges: `charge` is open to anyone and the merchant back end could not cancel on chain | Fixed: `cancelByMerchant` added | | S-L1 | Low | `cancelWithSig` recorded the relayer as the canceling party | Fixed | | B-M1, B-M2, B-L1 – B-L4 | Medium / low | Back-end issues: a cancel racing the subscribe transaction, plan edits affecting existing subscriptions, charges after cancel not alerted, and others | Fixed (the plan is snapshotted when a subscription is created; alerts added) | | R-1 – R-17 | High – low | 17 items in the keeper, accounting and checkout from the second pass | Fixed | ### Internal review round 1 (2026-10-21) | ID | Severity | Issue | Disposition | |---|---|---|---| | L-1 | Low | The cancel functions had no re-entrancy protection: a cancel during a charge produced an event order that misled the back end | Fixed: re-entrancy lock on the three cancel functions; the `Subscribed` event moved before the funding call | | L-2 | Low | `chargeFirstNow` did not guarantee that period 0 was charged: a subscribe transaction landing too late skipped it | Fixed: terms with `chargeFirstNow` must land within period 0, otherwise they are refused | | L-3 | Low | When the payer was also a payee, direct paths and paths through the clone behaved differently | Fixed: the contract refuses a payee equal to the payer | | L-4 | Low | With a non-compliant EIP-3009 token (one that does not check `to == msg.sender`), a front-runner could push the payer's funds into the clone and lock them | Contract unchanged: treated as a token listing requirement. Since 2026-11-21 the capability probe at listing checks it, and a token that fails is not used through EIP-3009; the 10 EIP-3009 stablecoins re-probed on mainnet that day (USDC, USDG, USDT0 and PYUSD on Ethereum, Base, X Layer, Arc and others) all comply | | I-1 – I-10 | Informational | Documentation corrections, optional hardening, back-end probes and additional tests | Recorded | These contract changes altered the release bytecode, and the canonical factory address became `0xEA9846354f6325D6f4161c54b4944882f7f5c539`. ### Internal review round 2 (2026-11-09) | ID | Severity | Where | Issue | Disposition | |---|---|---|---|---| | S-1 | Design difference | Solana | The quote signature does not include the payer, so any address holding a quote can pay or subscribe | Left as is: payer funds are unaffected; risk addresses are screened against the actual payer at booking | | S-2 | Low | Solana | The receiving account was not required to be the associated token account (ATA): a caller of the permissionless `charge` could route a period into an auxiliary token account the payee does not watch | Fixed: only the payee's ATA is accepted | | S-3 | Low | Solana | `PaidOrder` records and subscription accounts could not be closed, locking their rent permanently | Fixed: `close_paid_order` and `close_subscription` added; the back end reclaims rent automatically | | S-4 | Informational | Solana | A source comment about the program's upgrade authority did not match the devnet deployment | Comment corrected | | E-1 | Informational | EVM | A period can be charged at any moment within it, so charges for two adjacent periods can be close together | Recorded: consistent with "once per period" in the terms | | Tooling | Informational | EVM | Slither: nothing at medium or above, 8 informational results. Aderyn: 0 high, 5 low (all code style) | Recorded | Round 2 made no change to the EVM and TRON contract sources; the release bytecode and the factory address are unchanged. The program on Solana devnet was upgraded to the build with the fixes on 2026-11-09. ### Internal review round 3 (2026-11-16) | ID | Severity | Where | Issue | Disposition | |---|---|---|---|---| | H-1 | High | Solana | A SOL quote was not bound to its cluster: the official program has the same address on every cluster, so one quote signer key and salt gave the same merchant account on mainnet and devnet, a mainnet order's SOL quote could be executed on devnet with free SOL, and devnet's booking marked the mainnet order paid | Fixed: the merchant account has its cluster (genesis hash) as a seed and a field, quote digests include it, and creating a merchant account needs the quote signer's signature; the back end derives the salt per cluster and does not book a payment on a chain where its order has no quote or whose network does not serve the order's mode | | L-1 | Low | Solana | The quote does not bind the payer, so whoever held a trial subscription quote could open it first from an empty account, take its address and block the customer | Fixed: the payer is a seed of the subscription address; another payer's subscription with the same terms is canceled on chain by the back end, with an alert | | L-2 | Low | Solana (back end) | A payee could close its token account after every payment and have the hot wallet pay its rent again and again | Fixed: the accounts the hot wallet funded are recorded; when one is missing again, sponsoring stops funding it (the payer pays) and the keeper's charges fund it only a limited number of times | | L-3 | Low | Solana (back end) | The keeper closed a payment record as soon as the paid quote expired, while a later quote of the same order could still be paid | Fixed: closed only once every quote of the order on that chain has expired | | I-1 – I-4 | Informational | Solana, TRON | `charge` does not re-check the mint's extensions; the Token-2022 extension screen is a deny list; a subscription whose periods were all missed stays `Active`; the return value of TRON mainnet USDT's `transfer` | The first three fixed: every charge re-checks the extensions; the extension screen is an allow list; the back end sends the merchant's cancellation for a subscription that has ended but is still `Active` on chain. The TRON item is left unchanged for now: TRON uses the allowance path only, and the item is handled before any other path is enabled there | Round 3 made no change to the EVM and TRON contract sources; the release bytecode and the factory address are unchanged. The Solana program build with these fixes was upgraded onto devnet on 2026-11-16; merchant accounts and subscriptions created on devnet before then must be created again. ## Testing and analysis tooling ### EVM contracts | Tool | Coverage | How it runs | |---|---|---| | Foundry unit and adversarial tests | Every authorization path, token behaviours (mocks without return values, with fees, blocklists, rebasing, upgradeable and others) and failure branches; hostile merchants, front-runners, re-entrancy, cross-chain and cross-clone replay | `forge test` on every CI run | | Foundry fuzz tests | Random amounts, numbers of splits and numbers of periods | As above | | Foundry invariant tests | Clones hold no balance; payees receive exactly their splits; no order is paid twice; each period is charged at most once; cumulative charges stay within the terms; nothing is charged before the first period or after cancellation or completion; only authorized parties can cancel | As above | | Foundry fork tests | Real tokens on Ethereum mainnet (USDC, USDT, DAI, Permit2) and Arbitrum One (USDT0) | In CI when the corresponding RPC endpoints are configured | | Slither | Static analysis; fails on medium or above | CI | | Aderyn | Static analysis; fails on any high finding | CI | | Release bytecode check | The release bytecode committed to the repository must match a build from source | CI | At the time of round 2, `forge test` reported 124 passing tests, with the two fork suites skipped when no RPC endpoint is configured. Accepted Slither findings are annotated in the source with the reason. ### Solana program The Solana program has a LiteSVM test suite (26 tests) covering merchant account creation (the quote signer must sign, one account per cluster), a quote of another cluster being refused, another payer's early subscription no longer blocking the customer, split payments, missing, mismatched and tampered quote signatures, duplicate payments, the Token-2022 extension allow list (checked again at every charge), subscription charge windows and caps, cancellation by each party, a replaced or revoked delegate, payment into ATAs only, and rent recovery. The suite is run with the commands in `solana/README.md` in the repository. ## Shared contract deployments Shared contracts are deployed by FlowPayra once per network and used by every merchant. Merchant contracts (EVM / TRON clones, the Solana merchant account) are created by each merchant. The shared contracts are deployed on these networks: | Network | Shared contract | Address | |---|---|---| | Ethereum, BNB Smart Chain, Base, X Layer, Arc, Robinhood Chain (mainnets) | `FlowPayFactory` (the EVM factory, with its two implementations) | `0xEA9846354f6325D6f4161c54b4944882f7f5c539` | | Sepolia, Arc testnet | `FlowPayFactory` (the EVM factory, with its two implementations) | `0xEA9846354f6325D6f4161c54b4944882f7f5c539` | | TRON Nile | `FlowPayFactoryTron` | `TZ4h1akv6MTKMjuYy52z9oJdpT3J6eogj6` | | Solana devnet | The `flowpay` program | `3ygRG5JMN1U3EcEFPtmAkHc32Mwg9vNeUB3Q8tYKMAcd` | The EVM factory is deployed through the CREATE2 deployment proxy and has the same address on every chain that uses the canonical deployment path. Deploying the factory creates the two implementations, which also have the same addresses on every chain: | Contract | Address | |---|---| | `FlowPayFactory` | `0xEA9846354f6325D6f4161c54b4944882f7f5c539` | | `FlowPayRouterImpl` | `0x189689F9D88b76eecA4461575dAb31A9EdE92c3a` | | `FlowPaySubscriptionsImpl` | `0x431637A43aB755181c0Ca82eF36A7b9D54d62D8f` | - The shared contracts on the six EVM mainnets were deployed on 2026-11-21, those on Sepolia and the Arc testnet on 2026-10-24. The sources of all three contracts are verified on Sourcify on each of these networks. - The TRON Nile factory was deployed on 2026-10-25, and its source is verified on Sourcify. - The Solana devnet program was deployed on 2026-10-26 and upgraded on 2026-11-09 and 2026-11-16. The sha256 of the program code is `8fb15193a5748f2b9f2fbc39865804aa066328af7d9a7a1e0c6b42993b44ddfd`, the build after round 3. ### Release bytecode The addresses of the EVM contracts are determined by the release bytecode: any change to the contracts changes it, and with it the addresses of the factory, the implementations and the merchant contracts. The keccak256 hashes of the init code can be used to check it: | File | keccak256(init code) | |---|---| | `FlowPayFactory.initcode.hex` | `0x1064f8c8197753790f8cae318b2246380e62718a63d07c6f160acf81801506ad` | | `FlowPayRouterImpl.initcode.hex` | `0x749f13f91b75c0296b6a1e4cdfe5e39d73e20f830de8534bb3cb55e65cb40579` | | `FlowPaySubscriptionsImpl.initcode.hex` | `0xda68b6cd190170d22e79c8aae9099c0880e8c86ef5157cf82400ba02ad0d1806` | | `FlowPayFactoryTron.initcode.hex` | `0x457061a0017d63ecb949d55e81e98aa18afa85b55211f6a41925856199ee15ed` | The build settings are fixed at solc 0.8.28, `evm_version = paris`, 10000 optimizer runs and no CBOR metadata, so builds are reproducible. ## Review reports The full reports are in the repository's `docs/` directory: `CONTRACT-REVIEW.md`, `SUBSCRIPTIONS-REVIEW.md`, `AUDIT-ROUND1.md`, `AUDIT-ROUND2.md` and `AUDIT-ROUND3.md`.