Skip to main content

Overview

Wallet endpoints let an authenticated user inspect recharge configuration, create a payment link, redeem a code, review recharge history, and manage automatic recharge.
Payment and auto-recharge endpoints create financial operations. Call them only from a trusted backend after explicit user confirmation.

Read recharge configuration

Always read the current configuration before presenting amounts or payment options:
Important fields can include: These values are deployment and campaign configuration. Validate the selected amount immediately before creating a payment link. The current wallet flow accepts an integer USD amount and one of the payment methods shown below:
Redirect the user to pay_link in a browser. Receiving a link does not mean the wallet has been credited; credit is applied after the payment provider confirms completion.
Do not embed the system access token in the redirect URL or send it to the payment provider.

Redeem a recharge code

Redemption codes are single-use. Do not log them or retry a successful redemption.

Recharge history

The response uses items, page, page_size, and total. After the checkout completes, refresh both recharge history and account balance:
Account quota is in internal units. Convert it using quota_per_unit as described in Authentication and quota.

Read automatic-recharge status

The response reports:
  • bound: whether a reusable payment method is bound
  • card_last4: masked card identifier
  • enabled: whether automatic recharge is active
  • threshold: wallet balance in USD that triggers a recharge
  • amount: USD amount charged on each trigger
  • stripe_ready: whether automatic recharge can be configured

Bind a payment method

When no payment method is bound, start the setup flow:
Redirect the user to setup_link. Wait for the provider callback, then call GET /api/user/auto-recharge again and confirm bound: true before enabling the feature.

Configure automatic recharge

After binding, update all three settings together:
threshold must be non-negative. The current console requires a recharge amount of at least USD 10, but clients should also honor current server and payment-provider limits. Disable automatic recharge without removing the bound method by sending the same payload with enabled: false.

Remove the binding

Removing the binding also disables automatic recharge and removes the saved card reference. Require explicit confirmation before calling this endpoint.
  1. Read /api/user/topup/info and validate the amount and method.
  2. Create the payment or binding link once.
  3. Redirect the user to the returned link.
  4. Treat the provider redirect as pending, not final proof of credit.
  5. Refresh /api/user/topup/self, /api/user/self, or /api/user/auto-recharge until the expected state appears.
  6. Make retries idempotent in your application and avoid creating multiple checkout links for the same user action.