DevelopersStart
Authentication
Authenticate v1 requests with your app id and secret over HTTP Basic, read the 401, and roll or disable a secret safely.
Every v1 request carries your application's app id and app secret in one HTTP Basic header. There are no other credentials: no bearer tokens and no publishable key.
The header
Authorization: Basic base64(app_id:app_secret)| Credential | Prefix | Where it lives |
|---|---|---|
| App id | fian_app_ | Your server's environment, as FIANTO_APP_ID for the SDK and CLI |
| Live secret | fian_sk_live_ | Your mainnet server's environment, as FIANTO_APP_SECRET. Never in a browser |
| Test secret | fian_sk_test_ | Your devnet server's environment, as FIANTO_APP_SECRET. Never in a browser |
An application keeps one app id and has two secrets. The live secret works only on the mainnet API,
https://. The test secret works only on the devnet API, https://.
A new application gets a live secret only; you create its test secret in the dashboard in Test
mode. Before your account is approved, a new application gets a test secret only, and its live
secret comes after approval. See Testing on devnet.
curl --user builds the Basic header from app_id:app_secret for you.
curl https://api.fianto.xyz/v1/application \
--user "$FIANTO_APP_ID:$FIANTO_APP_SECRET"When authentication fails
Every credential problem but one gets the same answer: a malformed header, an unknown, revoked or
expired secret, a disabled application, or a merchant account that is not approved and active. Fianto
does not say which one it was. The exception is a real, valid key sent to the other network's API: see
Wrong network. On devnet, a test key of a merchant still being set up or reviewed
is accepted on some routes and answers 403 merchant_ on the others: see
Before approval.
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="fianto"{
"statusCode": 401,
"error": "Unauthorized",
"code": "invalid_api_credentials",
"message": "Invalid API credentials. Send \"Authorization: Basic base64(app_id:app_secret)\".",
"request_id": "req_…"
}In the SDK this is an AuthenticationError.
Wrong network
A real, valid key sent to the other network's API, a live key to devnet or a test key to mainnet, gets
401 with the code api_ and the same WWW-Authenticate header. Its message says which
kind of key it is. The app id must still match the key; otherwise the answer is
invalid_. Send the live key to mainnet and the test key to devnet.
From version 0.6.0, the SDK checks the key's prefix before any request: a network, or a
baseUrl that is the other network's API, that contradicts the key throws a FiantoError locally.
Credentials stop working when the account does
Your live keys work only while your merchant account is approved and active. If it is not, for example
after the Fianto team stops collecting for your account, every v1 request answers 401
invalid_, even with the right secret. Before approval, only a test key works, on
devnet, on the routes listed in Before approval.
Applications
The dashboard calls an application an API key: you create one under Developers with New API key. See Developer settings.
- A merchant can have up to 10 active applications and 100 in total.
- Creating an application needs your password, plus your two-factor code. Its live secret is shown once: copy it straight away.
- Creating, renaming and disabling an application happen in Live mode and apply to both networks (before approval, see the next point).
- Before approval you can create, rename and roll applications in Test mode. Each one gets
a test secret, and the step-up asks for your two-factor code only when two-factor sign-in is on.
Rolling a live secret answers 403
merchant_. Once you are approved, with two-factor sign-in on, you create each application's live secret in Live mode.not_ approved
Roll a secret
Roll a secret in the dashboard, on the API key's page: Roll secret. Rolling needs your password and two-factor code, and shows the new secret once. In Live mode it rolls the live secret; in Test mode, the test secret. Rolling one network's secret never affects the other's.
Under The old secret, you choose when the current secret stops working: "Stop the old one now" (preselected), "Keep the old one for 1 hour" or "Keep the old one for 24 hours". Until then, both secrets work, so you can deploy the new one before the old one stops. At most two secrets of each network are valid at a time.
The preselected choice stops the old secret at once
With "Stop the old one now", requests that send the old secret fail with 401 as soon as the roll finishes. Pick a grace period unless the old secret has leaked.
Disable an application
On the API key's page, Disable asks you to confirm, naming the key. Disabling an application is permanent. It revokes its secrets, disables its webhook endpoint and cancels its pending webhook deliveries. To connect again, create a new application.
See also
Was this page helpful? Tell us
fianto.xyz