DevelopersBuild safely
Testing
Test with signed sample events, a real test.event, forwarded live events, the devnet sandbox, and a self-hosted or local backend.
Each application has a live key (fian_sk_live_…) for mainnet and a test key (fian_sk_test_…) for
the devnet sandbox; neither works on the other network. You test your webhook route with signed sample events from the CLI, check real delivery with a test.event,
forward your application's real events to your own machine, and run payments with test USDC on
devnet. To try a whole integration on devnet, see Testing on devnet.
One cluster per deployment
Each Fianto deployment runs on exactly one Solana cluster: mainnet-beta, devnet or localnet.
On the hosted APIs, the live key works only on https:// and the test key only on
https://. The SDK and CLI choose the hosted devnet sandbox for a test key (from
version 0.6.0), or with network: 'devnet' or --network devnet; a FIANTO_BASE_URL points them at a backend you run
yourself, wins over network, and is not checked against the key.
Before you start
- Node.js 20.3 or later, to run the CLI with
npx @fianto/cli. - Your webhook route runs on your machine, for example at
http://.localhost:3000/ api/ webhooks/ fianto - For the steps that call the API: your app id and secret, exported in your shell as
FIANTO_APP_IDandFIANTO_APP_SECRET. A.envfile is not enough; the CLI reads the shell. FIANTO_exported too, or passed withWEBHOOK_ SECRET --secret.
Steps
Send your webhook route a signed sample
fianto trigger signs a realistic sample of any event type and posts it to your route. It makes no
API call and needs only the webhook secret.
npx @fianto/cli trigger order.paid \
--forward-to http://localhost:3000/api/webhooks/fianto \
--secret "$FIANTO_WEBHOOK_SECRET"--forward-to accepts only a local address (localhost, 127.0.0.0/8 or [::1]) unless you add
--allow-remote. Try each event type your route handles, such as subscription. or
order.expired.
Check the credentials the CLI uses
npx @fianto/cli whoamiIt calls GET /v1/application and prints the application and merchant your FIANTO_APP_ID and
FIANTO_APP_SECRET belong to, and the webhook URL with its status. The remaining steps call the API
with these credentials. On devnet before your business is approved, whoami and the test event answer 403
merchant_: see Before approval.
Send a real test.event
Ask Fianto to deliver a signed test.event to your application's verified webhook URL. Its data
is { "message": "This is a test event from Fianto." }. It is the only event you can ask for:
Fianto never sends business events such as order.paid on request.
npx @fianto/cli trigger test.eventYou can send 10 test events per hour per application. The dashboard's test button uses the same budget.
Forward your real events to your machine
fianto events tail polls your application's events and posts each new one, re-signed with your
webhook secret, to a URL you give it, such as your local route. It runs until you press Ctrl-C.
npx @fianto/cli events tail \
--forward-to http://localhost:3000/api/webhooks/fianto \
--since 5mEach event is forwarded once per run, with no retry. If your route is down when an event arrives, that event is not forwarded again in this run. This is a development aid; real deliveries go to your verified webhook URL.
Run payments on devnet, or against a self-hosted or local backend
To pay and subscribe without mainnet funds, use the hosted devnet sandbox with your application's test
key (fian_sk_test_…): from version 0.6.0 of the SDK and CLI it selects devnet by itself, or set FIANTO_, or pass
network: 'devnet' and --network devnet. See Testing on devnet.
To use a self-hosted or local Fianto backend that runs on devnet or localnet instead, create an application on that deployment and point the SDK and the CLI at it:
export FIANTO_BASE_URL=http://localhost:3000 # your local fianto backendFIANTO_BASE_URL must be https, except for localhost, 127.0.0.1 and [::1], and must not end
in /v1.
Test card payments
On the devnet sandbox the merchant connects Stripe test keys, so a card payment there uses Stripe's test cards. Stripe says: "Use a valid future date, such as 12/34." and "Use any three-digit CVC (four digits for American Express cards)."
| Card number | What happens |
|---|---|
4242424242424242 | Visa |
4000000000000002 | A generic decline (card_declined / generic_decline) |
4000000000000259 | "With default account settings, payment succeeds, and Stripe creates a fraudulent dispute during the payment request" |
4000000000000077 | "Funds are added directly to your available balance, bypassing your pending balance" |
To try your route without a payment, send the card form of a sample: fianto trigger order.paid --method card --forward-to <url>, or sampleEvent('order. in a test. See
Card payments.
Check it worked
fianto trigger order.paid --forward-to … prints → 200 order.paid (local sample) and your route
logs the sample order. After trigger test.event, your route receives a test.event, and it shows
up in npx @fianto/cli events list --type test.event.
Troubleshooting
| You see | Why | Fix |
|---|---|---|
The CLI refuses the --forward-to URL | trigger posts signed samples only to a local address. | Forward to localhost, or add --allow-remote if you really mean a remote URL. |
trigger order.paid without --forward-to exits with code 2 | Only test.event can be sent through Fianto. Other types exist only as local samples. | Add --forward-to, or trigger test.event. |
409 webhook_ on test-event | The application has no verified webhook URL, so there is nowhere to deliver. | Set the URL in the dashboard and let it pass verification. |
429 on test-event | You sent 10 test events in the last hour, counting the dashboard button. | Wait and use trigger --forward-to meanwhile. |
401 api_ | You sent the live key to devnet or the test key to mainnet. | Send the test key (fian_sk_test_…) to devnet and the live key (fian_sk_live_…) to mainnet. |
401 invalid_ against a self-hosted or local backend | Your keys belong to another deployment, or FIANTO_BASE_URL is not set and the call went to https://. | Create an application on the deployment you test against, and set FIANTO_BASE_URL to it. |
Your route answers 400 invalid_webhook to samples | The route and the CLI use different webhook secrets. | Pass the same whsec_… secret your route verifies with. |
See also
Was this page helpful? Tell us
fianto.xyz