Documentation

POST /api/adbalance

Start a balance top-up.

RequestPOST /api/adbalance
AuthenticationSession cookie required
Handlerbackend/adbalance.py

What it does

Opens a payment session for the named amount and returns its URL and reference. `charged_yet` is false: the balance moves only when the provider confirms the payment.

Authentication

Session cookie required. Send the ff_session cookie. Without one the engine treats the caller as a new visitor with no holds and no claims, and returns a new cookie to use from then on.

Parameters

ParameterInTypeRequiredDescription
ff_sessioncookiestringOptionalThe session identifier. Omit it on the first call and store the value the response sets; every later call must send the same one or the engine treats the caller as a new visitor with no holds and no claims.
amount_minorbodyintegerRequiredThe amount to add, in the currency's minor units.

Request

The cookie jar carries the session between calls. Angle-bracketed values are the parameter types from the table above.

curl -s -b cookies.txt -c cookies.txt \
  -X POST -H 'Content-Type: application/json' \
  -d '{"amount_minor":"<integer>"}' \
  "https://flowfinds.ai/api/adbalance"
const res = await fetch("https://flowfinds.ai/api/adbalance", {
  method: "POST",
  credentials: "include",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "amount_minor": "<integer>"
  }),
});
const data = await res.json();
import requests

s = requests.Session()
r = s.post("https://flowfinds.ai/api/adbalance", json={
    "amount_minor": "<integer>"
  })
data = r.json()

Recorded example

curl -s -b cookies.txt -c cookies.txt \
  -X POST -H 'Content-Type: application/json' \
  -d '{"amount_minor":5000}' \
  "$FLOWFINDS_ORIGIN/api/adbalance"

Responses

200A payment session opened.

FieldTypeDescription
statusstring`topup_started`.
referencestringThe provider's order reference.
pay_urlstringWhere to send the browser.
amountstringThe amount formatted for display.
amount_minorintegerThe amount in minor units.
currencystringThe ledger currency.
charged_yetbooleanFalse.

Errors

StatusReasonWhen
400`amount_minor` is missing or not a usable amount.
401The session has no account.
502The payment provider answered with an error.

Related

Back to the API reference index, or read the cookbook for recipes that compose this endpoint with others.