charge() and pay() settle in it
with the same calls they use for HSUSD. The only difference is one field.
Mint it
Your token must be 9 decimals, with one token worth one dollar inside your app. That is the only shape charges settle in — Bankroll refuses any other scale before it signs, so this is not a preference. Create the mint with your treasury as the mint authority, and mint the supply to your treasury: it needs to hold the supply to pay anyone back.The starter ships the
CLI for this:
npx bankroll token create --name "Acme Credits" does all of the
above with the treasury key it already has, and writes the mint into
app-tokens.json — the appTokens claim your manifest serves, which is what
names the token inside Bankroll. The Metaplex metadata below is still yours to
add: it is what names the token everywhere else.Name it
A mint holds no name, symbol, or logo. Those live in a separate Metaplex metadata account, andspl-token create-token does not create one — you add
it with a CreateMetadataAccountV3 instruction signed by your mint authority,
pointing at JSON you host:
appTokens entry in your manifest, so it displays correctly with or without
this. Everywhere else does read it: with no metadata account your token is
“Unknown Token” in explorers, in other wallets, and in your users’ own
transaction history. Host the JSON somewhere you control long term; the URI is
capped at 200 characters and changing it later costs an on-chain update, while
editing the JSON behind a stable URI costs nothing.
Declare it
Add the mint to your manifest underappTokens. This is what
lets a charge settle in it, and what makes Bankroll show it as your app’s funds
rather than an unattributed holding.
Charge in it
Name the mint oncharge(). Omit token and the charge settles in HSUSD, as
before.
Check which asset paid
confirmCharge reports the mint that paid. Checking it is not optional.
The signature is supplied by the client, so anything settled on-chain reaches
your server — including a worthless token the sender minted themselves, which
passes every other check.
Node.js
Pay it out
pay() takes the same field. Pay back in the asset that paid — if you sell
something for tokens and pay out HSUSD, you have built a way to turn free credit
into real money.
Node.js