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

# Set or update auto-recharge config for a customer

> Persists the auto-recharge configuration for a customer. When no reusable card is on file, a Stripe SetupIntent client secret is returned so the caller can collect one.



## OpenAPI

````yaml /api-reference/openapi.json put /v1/sdk/auto-recharge
openapi: 3.0.0
info:
  contact: {}
  description: The SolvaPay REST API specification
  title: SolvaPay REST API
  version: '1.0'
servers: []
security: []
tags: []
paths:
  /v1/sdk/auto-recharge:
    put:
      tags:
        - Auto Recharge
      summary: Set or update auto-recharge config for a customer
      description: >-
        Persists the auto-recharge configuration for a customer. When no
        reusable card is on file, a Stripe SetupIntent client secret is returned
        so the caller can collect one.
      operationId: AutoRechargeSdkController_putAutoRecharge
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PutAutoRechargeSdkDto'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SaveAutoRechargeResponse'
          description: Saved auto-recharge config and optional SetupIntent details.
        '400':
          description: >-
            customerRef is required, or customer email is required to configure
            auto-recharge
      security:
        - SecretKey: []
components:
  schemas:
    PutAutoRechargeSdkDto:
      properties:
        currency:
          type: string
        customerEmail:
          format: email
          type: string
        customerName:
          type: string
        customerRef:
          minLength: 1
          type: string
        deferSetupIntent:
          type: boolean
        enabled:
          type: boolean
        maxMonthlySpendMajor:
          exclusiveMaximum: false
          exclusiveMinimum: true
          maximum: 10000
          minimum: 0
          type: number
        thresholdAmountMajor:
          exclusiveMaximum: false
          exclusiveMinimum: true
          maximum: 10000
          minimum: 0
          type: number
        topupAmountMajor:
          exclusiveMaximum: false
          exclusiveMinimum: true
          maximum: 10000
          minimum: 0
          type: number
        triggerType:
          enum:
            - balance
          type: string
      required:
        - enabled
        - triggerType
        - currency
        - customerRef
      type: object
    SaveAutoRechargeResponse:
      properties:
        config:
          $ref: '#/components/schemas/AutoRechargeConfigDto'
        display:
          $ref: '#/components/schemas/AutoRechargeDisplayDto'
        publishableKey:
          description: Stripe publishable key for the resolved environment
          type: string
        setupClientSecret:
          description: Stripe SetupIntent client secret for card collection
          type: string
        stripeAccountId:
          description: Connected Stripe account ID
          type: string
      required:
        - config
      type: object
    AutoRechargeConfigDto:
      properties:
        enabled:
          description: Whether auto-recharge is enabled
          example: true
          type: boolean
        failureCount:
          description: Consecutive failure count
          example: 0
          type: number
        fundingSourceType:
          description: Funding source type
          enum:
            - saved_card
            - tokenized_card
          type: string
        inFlightPaymentIntentId:
          description: PaymentIntent ID of an in-flight recharge
          type: string
        lastChargeAt:
          description: Timestamp of the last successful charge
          type: string
        lockAcquiredAt:
          description: Timestamp the processing lock was acquired
          type: string
        maxMonthlySpendMinor:
          description: Optional monthly spend cap in topup.currency minor units
          example: 10000
          type: number
        monthlySpendMinor:
          description: Successful auto-recharge spend in the current UTC month
          example: 4500
          type: number
        monthlySpendPeriod:
          description: UTC YYYY-MM period key for monthlySpendMinor
          example: 2026-07
          type: string
        paymentMethodId:
          description: Saved payment method ID backing the recharge
          type: string
        status:
          description: Current config status
          enum:
            - active
            - disabled
            - failed
            - pending_setup
          type: string
        topup:
          $ref: '#/components/schemas/AutoRechargeTopupDto'
        trigger:
          $ref: '#/components/schemas/AutoRechargeTriggerDto'
        updatedAt:
          description: Last update timestamp
          type: string
      required:
        - enabled
        - trigger
        - topup
        - fundingSourceType
        - status
        - failureCount
        - monthlySpendMinor
        - updatedAt
      type: object
    AutoRechargeDisplayDto:
      properties:
        currency:
          description: Display currency code
          example: USD
          type: string
        exchangeRate:
          description: Exchange rate used for display conversion
          example: 1
          type: number
        formatted:
          $ref: '#/components/schemas/AutoRechargeDisplayFormattedDto'
        rateSource:
          description: Source of the exchange rate
          example: live
          type: string
        thresholdAmountMajor:
          description: Threshold amount in display-currency major units
          example: 5
          type: number
        topupAmountMajor:
          description: Top-up amount in display-currency major units
          example: 20
          type: number
      required:
        - thresholdAmountMajor
        - topupAmountMajor
        - currency
        - formatted
        - exchangeRate
        - rateSource
      type: object
    AutoRechargeTopupDto:
      properties:
        amountMinor:
          description: Top-up amount in currency minor units
          example: 2000
          type: number
        currency:
          description: ISO 4217 currency code
          example: USD
          type: string
        mode:
          description: Top-up mode
          enum:
            - fixed
          example: fixed
          type: string
      required:
        - mode
        - amountMinor
        - currency
      type: object
    AutoRechargeTriggerDto:
      properties:
        thresholdAmountMinor:
          description: Display-currency minor units for the balance threshold
          example: 500
          type: number
        type:
          description: Trigger kind
          enum:
            - balance
          example: balance
          type: string
      required:
        - type
        - thresholdAmountMinor
      type: object
    AutoRechargeDisplayFormattedDto:
      properties:
        threshold:
          description: Formatted threshold amount
          example: $5.00
          type: string
        topup:
          description: Formatted top-up amount
          example: $20.00
          type: string
      required:
        - threshold
        - topup
      type: object
  securitySchemes:
    SecretKey:
      bearerFormat: JWT
      description: >-
        Provider secret API key (sk_live_… / sk_test_…) supplied as a Bearer
        token.
      scheme: bearer
      type: http

````