> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base44.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Buy top-up with saved card

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

<Warning>This endpoint charges real money right away. When the workspace has a saved card, a call charges it immediately, with no confirmation step and no approval from the card owner. Call it only when the workspace owner has explicitly asked you to buy this exact amount. To let the card owner review and approve the payment first, use [Create top-up checkout](/api-reference/create-top-up-checkout) instead.</Warning>

Buys top-up credits for your workspace by charging a saved payment method, with no checkout page. Get the amounts and prices from [List top-up packs](/api-reference/list-top-up-packs). Send at least one of `message_credits` (a multiple of 50, up to 400) or `integration_credits` (a multiple of 1,000, up to 8,000), so one purchase buys at most 8 packs of each type.

Get `payment_method_id` from [Get billing info](/api-reference/get-billing-info). On a workspace billed through Stripe, use `default_card_payment_method_id`, the card that pays for the plan, or the `id` of another card in `payment_methods`. `default_card_payment_method_id` is `null` when the plan isn't paid by card, and always `null` on a workspace billed through Wix, so use an `id` from `payment_methods` there.

Send a new key (8 to 100 characters) with every purchase, in the `Idempotency-Key` header or the `idempotency_key` field. If you send both and they differ, you get 422 `idempotency_key_mismatch`. On a workspace billed through Stripe, repeating a request with the same key within 24 hours doesn't charge the card a second time. The repeat doesn't return the first result, though: once the first request reached the charge step, the repeat fails, and so does reusing a key with different amounts. A key is only remembered for 24 hours, so reusing it later can start a new purchase. On a workspace billed through Wix, don't rely on the key to prevent a second charge. Before you retry a request whose response you didn't get, check the workspace's invoices in Get billing info.

A `charge_accepted` status means the payment went through. Base44 adds the credits once it processes the payment confirmation, so they can take a few moments to show up. A `fallback_required` status means the card couldn't be charged without the card owner, for example because it was declined or the bank asked them to authenticate. Nothing is charged, and the card owner can pay with Create top-up checkout. On a workspace billed through Wix, a declined payment returns a 402 instead, and checkout isn't available there.

Only the workspace owner can buy top-ups, and the workspace needs a paid plan other than Enterprise that isn't past due. A workspace with an open payment dispute can't buy top-ups, and neither can one whose plan is paid through the App Store or Google Play. A workspace billed through Wix can buy them only where Base44 has turned on Wix top-ups. Purchases billed through Stripe in shekels have VAT added. This endpoint is limited to 5 requests an hour per user, and requests it rejects count toward the limit. Some workspaces have a different limit. A read-only token is refused, and workspace API keys aren't accepted.

<Note>Top-ups are only available to accounts Base44 has enrolled in top-up credits. Other accounts get a 403.</Note>

<Warning>The response includes fields beyond the ones documented here. Don't rely on undocumented response fields, as they can change at any time.</Warning>



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json post /api/billing/topup/confirm-saved-payment
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - PersonalAccessTokenAuth: []
paths:
  /api/billing/topup/confirm-saved-payment:
    post:
      summary: Buy top-up with saved card
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        <Warning>This endpoint charges real money right away. When the workspace
        has a saved card, a call charges it immediately, with no confirmation
        step and no approval from the card owner. Call it only when the
        workspace owner has explicitly asked you to buy this exact amount. To
        let the card owner review and approve the payment first, use [Create
        top-up checkout](/api-reference/create-top-up-checkout)
        instead.</Warning>


        Buys top-up credits for your workspace by charging a saved payment
        method, with no checkout page. Get the amounts and prices from [List
        top-up packs](/api-reference/list-top-up-packs). Send at least one of
        `message_credits` (a multiple of 50, up to 400) or `integration_credits`
        (a multiple of 1,000, up to 8,000), so one purchase buys at most 8 packs
        of each type.


        Get `payment_method_id` from [Get billing
        info](/api-reference/get-billing-info). On a workspace billed through
        Stripe, use `default_card_payment_method_id`, the card that pays for the
        plan, or the `id` of another card in `payment_methods`.
        `default_card_payment_method_id` is `null` when the plan isn't paid by
        card, and always `null` on a workspace billed through Wix, so use an
        `id` from `payment_methods` there.


        Send a new key (8 to 100 characters) with every purchase, in the
        `Idempotency-Key` header or the `idempotency_key` field. If you send
        both and they differ, you get 422 `idempotency_key_mismatch`. On a
        workspace billed through Stripe, repeating a request with the same key
        within 24 hours doesn't charge the card a second time. The repeat
        doesn't return the first result, though: once the first request reached
        the charge step, the repeat fails, and so does reusing a key with
        different amounts. A key is only remembered for 24 hours, so reusing it
        later can start a new purchase. On a workspace billed through Wix, don't
        rely on the key to prevent a second charge. Before you retry a request
        whose response you didn't get, check the workspace's invoices in Get
        billing info.


        A `charge_accepted` status means the payment went through. Base44 adds
        the credits once it processes the payment confirmation, so they can take
        a few moments to show up. A `fallback_required` status means the card
        couldn't be charged without the card owner, for example because it was
        declined or the bank asked them to authenticate. Nothing is charged, and
        the card owner can pay with Create top-up checkout. On a workspace
        billed through Wix, a declined payment returns a 402 instead, and
        checkout isn't available there.


        Only the workspace owner can buy top-ups, and the workspace needs a paid
        plan other than Enterprise that isn't past due. A workspace with an open
        payment dispute can't buy top-ups, and neither can one whose plan is
        paid through the App Store or Google Play. A workspace billed through
        Wix can buy them only where Base44 has turned on Wix top-ups. Purchases
        billed through Stripe in shekels have VAT added. This endpoint is
        limited to 5 requests an hour per user, and requests it rejects count
        toward the limit. Some workspaces have a different limit. A read-only
        token is refused, and workspace API keys aren't accepted.


        <Note>Top-ups are only available to accounts Base44 has enrolled in
        top-up credits. Other accounts get a 403.</Note>


        <Warning>The response includes fields beyond the ones documented here.
        Don't rely on undocumented response fields, as they can change at any
        time.</Warning>
      operationId: confirm_topup_saved_payment_api_billing_topup_confirm_saved_payment_post
      parameters:
        - name: Idempotency-Key
          in: header
          required: false
          schema:
            type: string
            minLength: 8
            maxLength: 100
            description: >-
              A key you generate for this purchase, sent instead of or with the
              `idempotency_key` field.
            title: Idempotency-Key
          description: >-
            A key you generate for this purchase, sent instead of or with the
            `idempotency_key` field.
          example: topup-2026-10-25-7f3c9a1e
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConfirmTopupSavedPaymentRequest'
      responses:
        '200':
          description: >-
            The card was charged, or the card owner has to pay through checkout
            instead.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopUpPurchaseResult'
              example:
                status: charge_accepted
                invoice_id: in_1QxYz2AbCdEf3GhIjKlMnOpQ
        '400':
          description: >-
            An amount isn't a multiple of its pack size, is negative or over the
            cap, or both are 0. Also returned when the workspace has no active
            paid plan (free, Enterprise, or past due) or its billing doesn't
            support top-ups. On a workspace billed through Wix, also when it has
            no saved payment method or Base44 can't reach its billing account.
        '401':
          description: Missing or invalid credentials.
        '402':
          description: 'Workspaces billed through Wix only: the payment method was declined.'
        '403':
          description: >-
            Your account isn't enrolled in top-up credits, you aren't the
            workspace owner, a payment dispute is open on the workspace,
            `payment_method_id` isn't saved for this workspace, or your token is
            read-only.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
              example:
                detail:
                  - type: string_too_short
                    loc:
                      - body
                      - idempotency_key
                    msg: String should have at least 8 characters
                    input: abc
                    ctx:
                      min_length: 8
        '429':
          description: Rate limit exceeded (5 requests an hour).
      security:
        - PersonalAccessTokenAuth:
            - full_access
components:
  schemas:
    ConfirmTopupSavedPaymentRequest:
      properties:
        message_credits:
          type: integer
          title: Message Credits
          description: 'Message credits to buy: a multiple of 50, up to 400. Defaults to 0.'
          default: 0
          example: 100
        integration_credits:
          type: integer
          title: Integration Credits
          description: >-
            Integration credits to buy: a multiple of 1,000, up to 8,000.
            Defaults to 0.
          default: 0
          example: 1000
        payment_method_id:
          type: string
          maxLength: 200
          minLength: 1
          title: Payment Method Id
          description: >-
            ID of the saved payment method to charge, from
            `default_card_payment_method_id` or `payment_methods[].id` in Get
            billing info.
          example: pm_1QxYz2AbCdEf3GhIjKlMnOpQ
        idempotency_key:
          anyOf:
            - type: string
              maxLength: 100
              minLength: 8
            - type: 'null'
          title: Idempotency Key
          description: >-
            A key you generate for this purchase. Send a new one for every
            purchase. Required unless you send the `Idempotency-Key` header
            instead.
          example: topup-2026-10-25-7f3c9a1e
      type: object
      required:
        - payment_method_id
      title: ConfirmTopupSavedPaymentRequest
      description: >-
        Request model for confirming a top-up purchase with a saved payment
        method.
    TopUpPurchaseResult:
      properties:
        status:
          type: string
          enum:
            - charge_accepted
            - fallback_required
          title: Status
          description: >-
            `charge_accepted` when the payment went through. The credits are
            added shortly after. `fallback_required` when the card couldn't be
            charged without the card owner. Nothing is charged, and the card
            owner can pay with Create top-up checkout.
          example: charge_accepted
        invoice_id:
          type: string
          title: Invoice Id
          description: >-
            ID of the invoice for this purchase. Present only when `status` is
            `charge_accepted`.
          example: in_1QxYz2AbCdEf3GhIjKlMnOpQ
        reason:
          type: string
          title: Reason
          description: >-
            Why the card couldn't be charged. Present only when `status` is
            `fallback_required`. `payment_confirmation_failed` when the card was
            declined or the bank asked the card owner to authenticate. Otherwise
            it's the invoice's status, such as `open`.
          example: payment_confirmation_failed
      type: object
      required:
        - status
      title: TopUpPurchaseResult
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    PersonalAccessTokenAuth:
      type: http
      scheme: bearer
      description: >-
        Personal access token, sent as `Authorization: Bearer <token>`. Each
        operation lists the permission it needs: `read_only` or `full_access`. A
        full-access token can call every operation. A read-only token can call
        only the operations that list `read_only`; anything else returns 403
        `read_only_credential_route_not_allowed`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.