Skip to Content
FluxStore is currently invite-only. Some sections of this documentation are still being written and expanded.
APIManagement APICheckout SessionsOverview

Checkout Sessions

Checkout sessions enable merchants to build a headless catalog on their own domain and defer the paid checkout experience to the FluxStore-hosted storefront. Your backend creates a session via the API, redirects the customer to the returned URL, and the customer returns to a configured URL after payment completes or is cancelled.

Prerequisites

Before creating checkout sessions, you must configure allowed return-URL origins in your dashboard:

  1. Navigate to Dashboard > Configuration > API Keys > Checkout return URLs
  2. Add the exact origin of your storefront (e.g., https://shop.example.com). Origins only, paths are not part of the match
  3. Without at least one origin configured, session creation returns 400 with the message: "API checkout is not enabled for this store."

The flow

  1. Your backend calls Create a checkout session with the cart items, customer info, and return URLs.
  2. You redirect the customer to the url returned in the response (or render a “Continue to checkout” button).
  3. The customer completes payment on the FluxStore-hosted checkout.
  4. FluxStore redirects them to your successUrl or cancelUrl.

Trust webhooks for state

The successUrl is a UX hint only. Always use the order.completed webhook to confirm payment and fulfill the order. The webhook payload includes checkout_session_id so you can correlate the webhook to the original session.

The URL placeholders {CHECKOUT_SESSION_ID} and {ORDER_ID} are filled in before redirecting the customer.

Idempotency

Pass an Idempotency-Key header with your create request. If the same key is used on retry:

  • Prior session is Open → returns the same session with HTTP 200 (safe to retry)
  • Prior session is Completed, Cancelled, or Expired → returns HTTP 400 with the prior session’s ID and status; use a fresh key for a new session

Polling (optional)

For merchants who cannot run a webhook receiver, retrieve the session and check status. When status is Completed, orderId is populated.

Gifting

Gifting is opt-in per store and off by default. The store owner enables it under Store settings > Checkout > Allow gifting. A gift object sent to a store that has not enabled it is rejected, so check with the store owner before building against it. See Gifting for what the feature does.

Including a gift object is what makes a session a gift; there is no separate boolean. Its presence routes delivery, tier upgrade pricing and per-package purchase limits to recipientUsername / recipientUuid. customer remains who pays, and who earns and spends loyalty points.

The response echoes gift back so you can reconcile which session was a gift, and carries a warnings array of non-fatal conditions your integration should know about, since there is no checkout UI to surface them to the buyer. gift is omitted entirely when the session is not a gift, and warnings is an empty array when there is nothing to report. Fields FluxStore returns as null are omitted rather than sent as null, so gift.recipientUuid is simply absent when it could not be resolved.

WarningMeaning
discord_actions_skipped_on_giftA package in the cart carries a Discord role action. It was not granted to anyone, because FluxStore only holds the buyer’s linked Discord account, not the recipient’s.
recipient_username_not_verifiedThis store can’t verify Minecraft usernames (offline-identity mode), so recipientUsername was not checked against Mojang. Goods delivered to a mistyped username can’t be recovered.

Common errors

Error messageCauseSolution
"API checkout is not enabled for this store."No return-URL origins configuredAdd an origin in Dashboard > Configuration > API Keys > Checkout return URLs
"successUrl: URL origin (https://attacker.com) is not in the allow-list"Origin mismatchAdd the origin to the dashboard allow-list
"successUrl: URL scheme must be https"Non-HTTPS URL (http is only allowed on localhost in development)Use https://
"Idempotency-Key already used by Completed session cs_xxx"Reused key after session completedUse a new idempotency key
"One or more packages are not found or inactive"Package ID does not exist or is inactiveVerify package IDs and that they are active
"Package '...' requires a server selection"Package has userServerSelectionEnabled but no serverId was providedSet serverId on the item
"couponCode: ... (expired / exhausted / does not meet minimum)"Coupon is invalid for this orderRetry without the coupon or use a valid one
"The RecipientUsername field is required."gift is present but recipientUsername is missing or emptySupply a recipient, or drop the gift object
"Recipient username must not contain spaces or control characters."gift.recipientUsername failed validation. The name reaches server console commands, so this is a security rule, not formattingSend a plain Minecraft username, 1-32 characters
"Recipient UUID must contain only hexadecimal characters and dashes."gift.recipientUuid is not a UUIDSend hex and dashes, or omit it and let FluxStore resolve it
"This store does not accept gift purchases."The store has not enabled gifting (Store settings > Checkout > Allow gifting, off by default)Ask the store owner to enable gifting, or drop the gift object
"'Rank 1' is already owned."The beneficiary already holds this tiered package. On a gift the beneficiary is the recipient, not the buyerNothing to sell - they already have it
"'Rank 1' cannot be purchased because 'Rank 3' is already owned, which is the same or a higher tier."The beneficiary holds a higher tier in the same chain, so this would be a downgradeOffer a higher tier, or a package outside that chain
"Purchase limit reached. This package has already been purchased N time(s), and the limit is M."The beneficiary has hit the package’s per-user or cumulative limitReduce the quantity, or offer a different package
"You cannot gift a package to yourself."gift.recipientUsername matches customer.playerUsername (case-insensitive)Remove the gift object, or use a different recipient
"Subscription packages cannot be gifted."A subscription package is in items while gift is presentRemove the subscription package from the cart, or remove gift
"The recipient username was not found. A paid Minecraft account is required to receive gifts from this store."Store’s player identity mode is premium_required and gift.recipientUsername doesn’t resolve to a real Minecraft accountFix the recipient’s username, or gift to a player with a paid account