Skip to main content
This Quickstart takes you from a fresh Fluz account to a completed staging purchase. You’ll register an app, mint a scoped access token, then deposit funds, browse the merchant catalog, purchase a gift card, and reveal its redemption details — all in the sandbox, where no real money moves.
Prerequisites
  • A Fluz account — you’ll create staging API credentials and mint an access token in Steps 1–2 below.
  • Requests go to the sandbox GraphQL endpoint. Nothing here charges a real card — see Staging vs. Live Environment.
  • Every mutation needs a unique idempotencyKey (a client-generated UUID) so a request is only ever processed once — see Idempotency.

Before you begin

Except for minting your token (Step 2), every call is a POST request to a single GraphQL endpoint, authenticated with your bearer token:
Your sandbox account ships with a pre-added test bank card, so you can run this entire flow immediately. Add more test cards or bank accounts from the Sandbox Accounts page using values from the Test Bank Cards list.

The full flow

Sign up and register an app

Create a Fluz account at fluz.app, then open the Developer Console and create a new Staging application. When the credentials appear, copy your clientId and clientSecret — the secret is shown only once.Full walkthrough: Prepare your accounts.

Exchange credentials for an access token

Mint a short-lived, scoped user access token from your app credentials. This call goes to the OAuth service; every later call uses the returned token as a Bearer credential.
Store the returned accessToken and send it as Authorization: Bearer <accessToken> on every request below. Tokens are short-lived (expiresIn is in seconds) — mint them server-side and refresh before expiry. Full details: API credentials.
Scopes gate what the token can do — include only what your flow needs: MANAGE_PAYMENT to add funding sources and deposit, LIST_OFFERS to browse the catalog, and PURCHASE_GIFTCARD / REVEAL_GIFTCARD to buy and reveal.
Never expose clientSecret in a browser or mobile client. Mint tokens server-side and forward only the token.

Deposit funds to your Fluz balance

Pre-loading a Fluz balance generally makes gift card purchases faster and can bypass certain velocity checks. You can deposit two ways:
  • Manually, via the sandbox Fluz website.
  • Programmatically, via the depositCashBalance mutation (shown below).
To deposit via API you need the ID of a funding source (e.g. a bankCardId). Run getWallet and save the ID you want to use.
Grab the bankCardId or bankAccountId from the response. Managing funding sources via the API requires the MANAGE_PAYMENT scope. More detail: View Funding Sources.

Make the deposit

Use the depositCashBalance mutation. It takes a DepositCashBalanceInput object.

Input fields

idempotencyKey
string
required
A unique client-generated UUID that guarantees the deposit is processed only once.
amount
Float
required
The amount to deposit.
depositType
CashBalanceDepositType
Destination balance. One of CASH_BALANCE, GIFT_CARD_BALANCE, or RESERVE_BALANCE.
Funding source
UUID
Where the money comes from — provide one of bankAccountId, bankCardId, or paypalVaultId.
merchantCategoryCode
Int
Only for GIFT_CARD_BALANCE. A four-digit MCC classifying the business. Use getMccList to retrieve valid values.
userCashBalanceId
UUID
When CASH_BALANCE is selected, the specific spend account to deposit into.
Deposits may settle instantly or within 2–5 business days depending on the funding source and settlement type. The balances object in the response reflects your current available balance. See Check Account Balance to re-query it at any time.

Browse merchants and pick an offer

With a balance ready, fetch the catalog of available merchants and their cashback offers using getMerchants.
The catalog is sorted by cashback percentage by default, so the highest offers appear first.

Useful arguments

name
String
Filter merchants by name.
paginate
OffsetInput
{ limit, offset }. Default and max limit is 20.
offerTypes
OfferTypesInput
Boolean flags for which offer types to return, e.g. { giftCardOffer: true, cardLinkedOffer: false }.
filterBy
FilterByInput
Filter offers within each merchant, e.g. by deliveryFormat (URL, CODES, PIN_AS_CODE, PIN_WITH_URL).
Pagination: the response may return fewer results than your limit. To pull the full catalog, keep incrementing offset by your limit and stop when the API returns an empty array ([]). The unfiltered catalog is large — fetch it at most once per day, and use name or offerTypes for targeted lookups.
If you already know the merchant and amount, getOfferQuote returns the top available offer directly — including live stock info.
slug and denomination are required. paymentMethod defaults to FLUZPAY (your Fluz balance) and also accepts BANK_CARD, BANK_ACCOUNT, PAYPAL, APPLE_PAY, and GOOGLE_PAY.
Cashback rates change regularly. Always confirm the current rate before purchasing.

Purchase a gift card

Use the purchaseGiftCard mutation. You can identify what to buy in two ways:

Input fields

idempotencyKey
string
required
A unique client-generated UUID so the purchase is processed only once.
offerId / merchantSlug
UUID / String
required
Provide one. merchantSlug auto-selects the best rate; offerId targets a specific offer.
amount
Float
required
The gift card amount to purchase.
Funding source
UUID / Float
How to pay. Use balanceAmount (Fluz balance), bankAccountId, bankCardId, or paypalVaultId. You may combine your Fluz balance with another source.
defaultToBalance
Boolean
default:"true"
Falls back to your Fluz balance if another payment method fails. Set to false to disable that fallback.
minRewardRate
Float
Minimum reward rate to accept when purchasing via merchantSlug.
exclusiveRateId
UUID
Forces a specific exclusive rate. Found in getMerchants for offers of type EXCLUSIVE_RATE_OFFER.
userCashBalanceId
UUID
The spend account (cash balance) to charge.
memo / transactionCategory / attachmentId
String / String / UUID
Optional expense metadata. memo max 255 chars; categories are created on first use. See Add Expense Details.
Hold on to the giftCardId from the response — you’ll use it to reveal the card in the next step. If a purchase fails, check Gift Card Error Codes.

Reveal the gift card details

Finally, retrieve the redeemable details (code, PIN, and/or URL).
Skip this if you just captured a giftCardId in Step 3. Otherwise, list your gift cards:
You can filter with status and userCashBalanceId, and page with paginate.

Reveal redemption details

Call revealGiftCardByGiftCardId with the giftCardId.
Redemption fields vary by merchant. Some cards return an alphanumeric code with no pin; others return only a url. Always render based on the deliveryFormat returned by getGiftCards (not getMerchants) — a merchant’s active offer can change after purchase, and getGiftCards reflects the format the card was actually bought under.
Details not returned immediately? Poll revealGiftCardByGiftCardId with exponential backoff: start at 300ms, then double (300 → 600 → 1200 → 2400ms…) up to a max delay of 180000ms (3 minutes). Stop as soon as details come back. This balances responsiveness with load and avoids unnecessary timeouts.

You’re done 🎉

You’ve run a complete transaction — funded a balance, browsed offers, purchased a gift card, and revealed it. From here, explore the rest of the API:

Virtual Cards

Issue and manage network-accepted virtual cards.

Wallets & Transfers

Open spend accounts and move funds between them.

Transaction Activity

Pull, filter, and annotate transaction history.

Embedded Widgets

Drop Fluz flows straight into your own UI.
Want to learn more? Contact us at support@fluz.app to speak with our experts or request a demo.