Skip to content
Docs / API reference

API reference

Every endpoint, with its parameters, its errors and a request you can copy. For the narrative versions see Checkout sessions and Payment links.

Conventions

Item Value
Base URL https://app.flik.co.nz
Authentication Authorization: Bearer <accessToken> on every endpoint except /api/token
Token lifetime Five minutes. Reuse a token until it expires rather than fetching one per request; expiresIn on the token response says how long
Request body application/json, except /api/token which is application/x-www-form-urlencoded
Response body application/json
Success status 200 on every endpoint here, creates included
Timestamps ISO 8601, UTC
Amounts Major units as a number — 25.00 is twenty-five dollars
Webhooks webhookUrl on the session or link you create. There is no account-wide endpoint. See Webhooks
Test vs live Determined by the API key, not the URL. Same host for both

Errors always take the shape { "error": { code, message, param, doc_url } }. Branch on code, never on message. See Errors for the full catalogue.

Create an access token

post /api/token

Exchanges an API key pair for a bearer token valid for five minutes. The body is form-encoded, not JSON — this is the one endpoint where that is true.

Cache the token for its hour. Fetching a fresh one per request works but doubles your round trips for no benefit. Full detail on Authentication.

Parameters

clientId string Required
Client ID from your API key.
clientSecret string Required
Matching client secret. Server-side only — anyone holding it can create payments that settle to your account.
curl -X POST https://app.flik.co.nz/api/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "clientId=$FLIK_CLIENT_ID" \
  -d "clientSecret=$FLIK_CLIENT_SECRET"
200 OK
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "tokenType": "Bearer",
  "expiresIn": "1h"
}

Errors

This endpoint predates the error envelope: on a failure error is a plain string, not an object with a code. Branch on the HTTP status here.

Status Code When
400 "Invalid credentials - missing or malformed clientId/clientSecret" clientId or clientSecret is missing, or the body was sent as JSON.
401 "Invalid credentials" The pair does not match a key. An unknown client ID and a wrong secret get the same answer, on purpose.
500 internal_error Flik's end failed. Retry with backoff.

Create a checkout session

post /api/checkout-sessions

One payment, by one customer, for an amount you set. The response carries the URL to send them to. Narrative version: Checkout sessions.

Parameters

Idempotency-Key header, string Optional
Makes the request safe to retry for 24 hours. Strongly recommended — without one, a timeout leaves you unable to tell whether a payment exists.
type string Required
Always single.
amount object Required
What you are charging.
amount.total number Required
Greater than 0, at most 2 decimal places, maximum 10000.
amount.currency string Optional
NZD or AUD. Must match your organisation's settlement currency. Omit it and Flik fills it in — that is the safer choice.
creditorReference object Required
What the payer sees on their bank statement. The length limits come from the banking system, not from Flik.
creditorReference.reference string Required
1–12 chars, [0-9A-Za-z '.,@_-]. Usually your invoice or order number.
creditorReference.particulars string Optional
Max 12 chars, [a-zA-Z0-9- ]. Typically your trading name.
creditorReference.code string Optional
Max 12 chars, [a-zA-Z0-9- ]. Generated if omitted, and returned as code.
redirectUrl string Required
Where to send the payer on success. Flik appends ?transactionId=<uuid>&checkoutSessionId=cs_…, preserving any query parameters of your own. An id in a URL is not proof of payment — read it back before you act on it.
checkoutMethod string Required
open_banking, card, or both. Checked against your organisation at creation.
webhookUrl string Optional
Where Flik posts this session's events. HTTPS, publicly reachable. There is no account-wide endpoint: a session created without this notifies nobody, and it cannot be added afterwards.
foreignTransactionId string Optional
Your own identifier. Echoed back on reads and in the webhook, so you can match a payment to an order without storing Flik's ids.
description string Optional
Max 255 chars. Shown against the transaction in the portal. For your team, not your customer.
curl -X POST https://app.flik.co.nz/api/checkout-sessions \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-5591" \
  -d '{
    "type": "single",
    "amount": { "total": 25.00 },
    "creditorReference": {
      "reference": "INV-1001",
      "particulars": "Acme Ltd",
      "code": "ACME"
    },
    "checkoutMethod": "both",
    "redirectUrl": "https://example.com/thanks",
    "webhookUrl": "https://example.com/flik/webhook",
    "foreignTransactionId": "order-5591",
    "description": "Order 5591, two items"
  }'
200 OK
{
  "id": "cs_7Hk2pQr4TnVxWy9BdLmE",
  "status": "created",
  "url": "https://app.flik.co.nz/checkout/s/uZ8kT2vQ...",
  "code": "ACME",
  "amount": { "total": 25.00, "currency": "NZD" },
  "checkoutMethod": "both",
  "reference": "INV-1001",
  "testMode": false,
  "expiresAt": "2026-09-13T04:11:00Z"
}

Errors

Status Code When
400 validation_failed A field is missing, the wrong type, or out of range — an amount over 10000, a reference with an illegal character, a missing redirectUrl.
400 currency_mismatch amount.currency is not your organisation's settlement currency. Flik rejects rather than repricing.
400 card_not_enabled card or both asked for and card payments are not configured.
400 open_banking_not_enabled open_banking or both asked for and the application is not approved.
400 settlement_account_missing A bank rail was asked for and the organisation has no settlement account.
400 open_banking_currency_unsupported Your organisation settles in AUD, which the bank rail cannot carry. Use card.
400 idempotency_error The Idempotency-Key was used before with a different body.
401 unauthorized No Authorization header, or not in the form Bearer <token>.
401 token_expired The token has expired. Fetch a new one and retry, once.
401 invalid_token The token could not be verified — usually truncated or double-prefixed.
401 unknown_api_key The API key the token was issued for no longer exists.
500 internal_error Flik's end failed. Retry with backoff, and with the same Idempotency-Key so the retry is safe.

Retrieve a checkout session

get /api/checkout-sessions/{id}

Read a session back to find out whether it has been paid. This is the supported way to confirm a payment server-side, and the fallback if your webhook endpoint was down.

A session belonging to another organisation returns 404, not 403. Flik will not confirm that an id it is unwilling to serve you exists at all.

Parameters

id string, path Required
The cs_ id. Both signals carry it, so you need no stored mapping: the webhook body as checkoutSessionId, and the redirect as ?checkoutSessionId= on your redirectUrl.

Statuses

Status Meaning
created Session exists; nobody has paid yet.
pending A payment is in flight — awaiting bank approval, or a card charge is processing.
completed Paid. Fulfil the order.
failed Attempted and did not succeed. The payer can try again while the session is live.
expired 24 hours passed without payment. Create a new session.

Treat this list as open — handle an unrecognised status by not fulfilling, rather than by erroring. transactionType tells you which rail the money actually moved on, which for a both session is the only way to know what the payer chose. It is meaningful only once status is completed; before that it reads open_banking regardless of checkoutMethod.

curl https://app.flik.co.nz/api/checkout-sessions/cs_7Hk2pQr4TnVxWy9BdLmE \
  -H "Authorization: Bearer $TOKEN"
200 OK
{
  "id": "cs_7Hk2pQr4TnVxWy9BdLmE",
  "status": "completed",
  "code": "ACME",
  "amount": { "total": 25.00, "currency": "NZD" },
  "checkoutMethod": "both",
  "reference": "INV-1001",
  "particulars": "Acme Ltd",
  "transactionType": "card",
  "testMode": false,
  "foreignTransactionId": "order-5591",
  "expiresAt": "2026-09-13T04:11:00Z",
  "createdAt": "2026-09-12T04:11:00Z",
  "updatedAt": "2026-09-12T04:13:22Z"
}

Errors

Status Code When
401 unauthorized No Authorization header, or not in the form Bearer <token>.
401 token_expired The token has expired. Fetch a new one and retry, once.
401 invalid_token The token could not be verified — usually truncated or double-prefixed.
401 unknown_api_key The API key the token was issued for no longer exists.
404 not_found No such session, it belongs to another organisation, or you used the old GET /api/transaction/{id} path.
500 internal_error Flik's end failed. Retry with backoff.