---
title: "Top up wallet"
method: POST
path: "/wallets/{id}/top-up"
tags: ["Wallets"]
---

# Top up wallet

`POST /wallets/{id}/top-up`

Use when adding funds to a wallet (e.g. top-up, refund, or manual credit). Supports optional idempotency via reference.

## Path parameters

- `id` string, required

## Request body

- TopUpWalletRequest
  - `amount` string — amount is the amount in the currency of the wallet to be added NOTE: this is not the number of credits to add, but the amount in the currency amount = credits_to_add * conversion_rate if both amount and credits_to_add are provided, amount will be ignored ex if the wallet has a conversion_rate of 2 then adding an amount of 10 USD in the wallet wil add 5 credits in the wallet
  - `bonus_credits_expiry_date_utc` string — bonus_credits_expiry_date_utc is the expiry (UTC, full precision) applied to the bonus credits transaction. Independent of expiry_date_utc, which governs the purchase credits. Only honored when bonus credits are actually granted (explicit BonusCreditsToAdd or slab).
  - `bonus_credits_to_add` string — bonus_credits_to_add is an explicit override for the bonus credits granted alongside this purchase. When nil/omitted, the bonus is resolved from the tenant's bonus_credits_topup_config slabs (if enabled). When set, it must be greater than 0 and is used as-is, skipping slab resolution. To grant no bonus, omit this field entirely.
  - `checkout` CheckoutParams
    - `cancel_url` string
    - `failure_url` string
    - `idempotency_key` string
    - `metadata` object
    - `payment_provider` 'razorpay', required
    - `payment_provider_config` TypesCheckoutPaymentProviderConfig
      - `collection_method` 'charge_automatically' | 'send_invoice'
      - `max_mandate_limit` string
      - `payment_method` 'CARD' | 'ACH' | 'OFFLINE' | 'CREDITS' | 'PAYMENT_LINK' | 'UPI'
    - `success_url` string
  - `credits_to_add` string — credits_to_add is the number of credits to add to the wallet
  - `description` string — description to add any specific details about the transaction
  - `expiry_date_utc` string — expiry_date_utc is the expiry date in UTC timezone ex 2025-01-01 00:00:00 UTC
  - `force_sync_invoice` boolean
  - `idempotency_key` string — idempotency_key is a unique key for the transaction
  - `metadata` TypesMetadata
  - `priority` integer — priority is the priority of the transaction lower number means higher priority default is nil which means no priority at all
  - `transaction_reason` 'INVOICE_PAYMENT' | 'FREE_CREDIT_GRANT' | 'SUBSCRIPTION_CREDIT_GRANT' | 'PURCHASED_CREDIT_INVOICED' | 'PURCHASED_CREDIT_DIRECT' | 'CREDIT_NOTE' | 'CREDIT_EXPIRED' | 'WALLET_TERMINATION' | 'MANUAL_BALANCE_DEBIT' | 'CREDIT_ADJUSTMENT' | 'INVOICE_VOID_REFUND' | 'PURCHASED_CREDIT_BONUS', required

## Response `200`

OK

- TopUpWalletResponse
  - `checkout_session` CheckoutSessionResponse
    - `action` 'create_subscription' | 'modify_subscription' | 'wallet_topup'
    - `cancel_url` string
    - `cancelled_at` string, date-time
    - `checkout_invoice_id` string — CheckoutInvoiceID and CheckoutPaymentID are set once the apply step creates the corresponding Flexprice entities (completed sessions only).
    - `checkout_payment_id` string
    - `checkout_status` 'initiated' | 'pending' | 'completed' | 'failed' | 'expired'
    - `completed_at` string, date-time
    - `configuration` CheckoutJSONBCheckoutConfiguration
      - `create_subscription_params` TypesCreateSubscriptionParams
        - `billing_period` 'MONTHLY' | 'ANNUAL' | 'WEEKLY' | 'DAILY' | 'QUARTERLY' | 'HALF_YEARLY' | 'ONETIME'
        - `currency` string
        - `end_date` string, date-time
        - `lookup_key` string
        - `metadata` object
        - `plan_id` string
        - `start_date` string, date-time
      - `modify_subscription_params` TypesModifySubscriptionParams
        - `line_item_modifications` TypesModifySubscriptionLineItem[]
          - `effective_date` string, date-time
          - `line_item_id` string
          - `quantity` string
        - `subscription_id` string
      - `wallet_topup_params` TypesWalletTopupParams
        - `wallet_id` string, required
        - `wallet_transaction_id` string
    - `created_at` string, date-time
    - `created_by` string
    - `customer_id` string
    - `environment_id` string
    - `expires_at` string, date-time — ExpiresAt is required. A Temporal timer fires at this time for any session still in initiated|pending, marking it expired. The caller must create a new session after expiry (expire-and-restart model).
    - `failure_reason` string — FailureReason is a human-readable string set on failed sessions.
    - `failure_url` string
    - `id` string
    - `idempotency_key` string — IdempotencyKey is caller-supplied. It is unique only while the session is active (initiated|pending). The same key may be reused once the session reaches a terminal state (completed|failed|expired).
    - `metadata` TypesMetadata
    - `payment_action` TypesPaymentAction
      - `type` 'checkout_url' | 'payment_link'
      - `url` string
    - `payment_provider` 'razorpay'
    - `payment_provider_config` CheckoutJSONBCheckoutPaymentProviderConfig
      - `collection_method` 'charge_automatically' | 'send_invoice'
      - `max_mandate_limit` string
      - `payment_method` 'CARD' | 'ACH' | 'OFFLINE' | 'CREDITS' | 'PAYMENT_LINK' | 'UPI'
    - `provider_result` CheckoutJSONBCheckoutProviderResult
      - `expires_at` string, date-time — ExpiresAt is the provider URL expiry. When set and earlier than the session expiry, executeCheckoutAction tightens the session expiry to match.
      - `next_action` TypesPaymentAction
        - `type` 'checkout_url' | 'payment_link'
        - `url` string
      - `provider_metadata` object — ProviderMetadata holds provider-specific data not needed for business logic.
      - `provider_payment_intent_id` string — ProviderPaymentIntentID is the provider-side charge/intent ID. Stripe returns this at link creation (pi_xxx); others populate it from the webhook payload.
      - `provider_session_id` string — ProviderSessionID is stored in EntityIntegrationMapping at link creation. Stripe: Checkout Session ID (cs_xxx) Razorpay: Payment Link ID (plink_xxx) Nomod: Payment Link ID (NOTE: webhook uses Charge ID; look up by PaymentLinkID field) Moyasar: Payment ID
    - `result` CheckoutJSONBCheckoutResult
      - `create_subscription_result` TypesCreateSubscriptionResult
        - `invoice_id` string
        - `payment_id` string
        - `subscription_id` string
    - `status` 'published' | 'deleted' | 'archived'
    - `success_url` string — Redirect URLs sent to the payment provider. The provider redirects the user browser to the appropriate URL after the payment flow completes.
    - `tenant_id` string
    - `updated_at` string, date-time
    - `updated_by` string
  - `invoice_id` string — Invoice ID if an invoice was created (only for PURCHASED_CREDIT_INVOICED)
  - `wallet` WalletResponse
    - `alert_settings` TypesAlertSettings
      - `alert_enabled` boolean
      - `critical` TypesAlertThreshold
        - `condition` 'above' | 'below'
        - `threshold` string
      - `info` TypesAlertThreshold
        - `condition` 'above' | 'below'
        - `threshold` string
      - `warning` TypesAlertThreshold
        - `condition` 'above' | 'below'
        - `threshold` string
    - `alert_state` 'ok' | 'info' | 'warning' | 'in_alarm'
    - `auto_topup` TypesAutoTopup
      - `amount` number
      - `cooldown` TypesDuration
        - `unit` 'second' | 'minute' | 'hour' | 'day'
        - `value` integer
      - `enabled` boolean
      - `invoicing` boolean
      - `threshold` number
    - `balance` string
    - `config` TypesWalletConfig
      - `allowed_price_types` TypesWalletConfigPriceType[] — AllowedPriceTypes is a list of price types that are allowed for the wallet nil means all price types are allowed
    - `conversion_rate` string — amount in the currency = number of credits * conversion_rate ex if conversion_rate is 1, then 1 USD = 1 credit ex if conversion_rate is 2, then 1 USD = 0.5 credits ex if conversion_rate is 0.5, then 1 USD = 2 credits
    - `created_at` string, date-time
    - `created_by` string
    - `credit_balance` string
    - `credits_available_breakdown` TypesCreditBreakdown
      - `free` string
      - `purchased` string
    - `currency` string
    - `customer_id` string
    - `description` string
    - `environment_id` string
    - `id` string
    - `metadata` TypesMetadata
    - `name` string
    - `real_time_balance` string
    - `real_time_credit_balance` string
    - `status` 'published' | 'deleted' | 'archived'
    - `tenant_id` string
    - `topup_conversion_rate` string — topup_conversion_rate is the conversion rate for the topup to the currency ex if topup_conversion_rate is 1, then 1 USD = 1 credit ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits
    - `updated_at` string, date-time
    - `updated_by` string
    - `wallet_status` 'active' | 'frozen' | 'closed'
    - `wallet_type` 'PRE_PAID' | 'POST_PAID'
  - `wallet_transaction` WalletTransactionResponse
    - `amount` string
    - `conversion_rate` string — conversion_rate is the conversion rate for the transaction to the currency
    - `created_at` string, date-time
    - `created_by` string
    - `created_by_user` UserResponse
      - `email` string — Empty for service accounts
      - `id` string
      - `metadata` object
      - `name` string
      - `roles` string[]
      - `tenant` TenantResponse
        - `billing_details` TenantBillingDetails
          - `address` Address
            - `address_city` string
            - `address_country` string
            - `address_line1` string
            - `address_line2` string
            - `address_postal_code` string
            - `address_state` string
          - `email` string
          - `help_email` string
          - `phone` string
        - `created_at` string, date-time
        - `id` string
        - `metadata` TypesMetadata
        - `name` string
        - `status` string
        - `updated_at` string, date-time
      - `type` 'user' | 'service_account'
    - `credit_amount` string
    - `credit_balance_after` string
    - `credit_balance_before` string
    - `credits_available` string
    - `currency` string
    - `customer` CustomerResponse — Customer response object containing all customer information
      - `address_city` string — AddressCity is the city of the customer's address
      - `address_country` string — AddressCountry is the country of the customer's address (ISO 3166-1 alpha-2)
      - `address_line1` string — AddressLine1 is the first line of the customer's address
      - `address_line2` string — AddressLine2 is the second line of the customer's address
      - `address_postal_code` string — AddressPostalCode is the postal code of the customer's address
      - `address_state` string — AddressState is the state of the customer's address
      - `contact` string — Contact is an optional contact number for the customer (e.g. phone)
      - `created_at` string, date-time
      - `created_by` string
      - `email` string — Email is the email of the customer
      - `environment_id` string — EnvironmentID is the environment identifier for the customer
      - `external_id` string — ExternalID is the external identifier for the customer
      - `id` string — ID is the unique identifier for the customer
      - `integrations` EntityIntegrationMappingResponse[]
        - `created_at` string, date-time
        - `created_by` string
        - `entity_id` string
        - `entity_type` 'customer' | 'plan' | 'invoice' | 'subscription' | 'payment' | 'credit_note' | 'addon' | 'item' | 'item_price' | 'price' | 'invoice_line_item'
        - `environment_id` string
        - `id` string
        - `metadata` object
        - `provider_entity_id` string
        - `provider_type` string
        - `status` 'published' | 'deleted' | 'archived'
        - `tenant_id` string
        - `updated_at` string, date-time
        - `updated_by` string
      - `metadata` object — Metadata
      - `name` string — Name is the name of the customer
      - `status` 'published' | 'deleted' | 'archived'
      - `tenant_id` string
      - `timezone` string — Timezone is the customer's IANA timezone name (e.g. "Asia/Kolkata"). Defaults to "UTC". Inherited by subscriptions at creation time.
      - `updated_at` string, date-time
      - `updated_by` string
    - `customer_id` string
    - `description` string
    - `environment_id` string
    - `expiry_date` string, date-time
    - `id` string
    - `idempotency_key` string
    - `metadata` TypesMetadata
    - `parent_transaction_id` string — ParentTransactionID is the ID of the parent wallet_transaction this row was earned from (the purchase tx, for a bonus grant). Empty for ordinary transactions.
    - `priority` integer
    - `reference_id` string
    - `reference_type` 'PAYMENT' | 'EXTERNAL' | 'REQUEST' | 'INVOICE'
    - `status` 'published' | 'deleted' | 'archived'
    - `tenant_id` string
    - `topup_conversion_rate` string — topup_conversion_rate is the conversion rate for the topup to the currency
    - `transaction_reason` 'INVOICE_PAYMENT' | 'FREE_CREDIT_GRANT' | 'SUBSCRIPTION_CREDIT_GRANT' | 'PURCHASED_CREDIT_INVOICED' | 'PURCHASED_CREDIT_DIRECT' | 'CREDIT_NOTE' | 'CREDIT_EXPIRED' | 'WALLET_TERMINATION' | 'MANUAL_BALANCE_DEBIT' | 'CREDIT_ADJUSTMENT' | 'INVOICE_VOID_REFUND' | 'PURCHASED_CREDIT_BONUS'
    - `transaction_status` 'pending' | 'completed' | 'failed'
    - `type` 'credit' | 'debit'
    - `updated_at` string, date-time
    - `updated_by` string
    - `wallet` WalletResponse
      - `alert_settings` TypesAlertSettings
        - `alert_enabled` boolean
        - `critical` TypesAlertThreshold
          - `condition` 'above' | 'below'
          - `threshold` string
        - `info` TypesAlertThreshold
          - `condition` 'above' | 'below'
          - `threshold` string
        - `warning` TypesAlertThreshold
          - `condition` 'above' | 'below'
          - `threshold` string
      - `alert_state` 'ok' | 'info' | 'warning' | 'in_alarm'
      - `auto_topup` TypesAutoTopup
        - `amount` number
        - `cooldown` TypesDuration
          - `unit` 'second' | 'minute' | 'hour' | 'day'
          - `value` integer
        - `enabled` boolean
        - `invoicing` boolean
        - `threshold` number
      - `balance` string
      - `config` TypesWalletConfig
        - `allowed_price_types` TypesWalletConfigPriceType[] — AllowedPriceTypes is a list of price types that are allowed for the wallet nil means all price types are allowed
      - `conversion_rate` string — amount in the currency = number of credits * conversion_rate ex if conversion_rate is 1, then 1 USD = 1 credit ex if conversion_rate is 2, then 1 USD = 0.5 credits ex if conversion_rate is 0.5, then 1 USD = 2 credits
      - `created_at` string, date-time
      - `created_by` string
      - `credit_balance` string
      - `credits_available_breakdown` TypesCreditBreakdown
        - `free` string
        - `purchased` string
      - `currency` string
      - `customer_id` string
      - `description` string
      - `environment_id` string
      - `id` string
      - `metadata` TypesMetadata
      - `name` string
      - `real_time_balance` string
      - `real_time_credit_balance` string
      - `status` 'published' | 'deleted' | 'archived'
      - `tenant_id` string
      - `topup_conversion_rate` string — topup_conversion_rate is the conversion rate for the topup to the currency ex if topup_conversion_rate is 1, then 1 USD = 1 credit ex if topup_conversion_rate is 2, then 1 USD = 0.5 credits ex if topup_conversion_rate is 0.5, then 1 USD = 2 credits
      - `updated_at` string, date-time
      - `updated_by` string
      - `wallet_status` 'active' | 'frozen' | 'closed'
      - `wallet_type` 'PRE_PAID' | 'POST_PAID'
    - `wallet_id` string

## Other responses

- `400` — Invalid request
- `404` — Resource not found
- `500` — Server error

---

[API](https://skmtc.net/flexprice/apis/flexprice-api.md) · [All operations](https://skmtc.net/flexprice/apis/flexprice-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/flexprice/flexprice-api/versions/f0601ed97bd3/schema)
