# Enable auto recharge

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v2/wallet/enable-auto-recharge:
    post:
      summary: Enable auto recharge
      deprecated: false
      description: >-
        This endpoint allows users to enable or disable auto-recharge for their
        wallet.


        ### Request Body


        | Name                   | Type     | Description |

        |------------------------|---------|-------------|

        | `enable`               | boolean | Set to `true` to enable
        auto-recharge or `false` to disable it. |

        | `threshold`            | number  | Optional. The wallet balance
        threshold to trigger auto-recharge. Defaults to `20`. |

        | `minimumRechargeAmount`| number  | Optional. The minimum amount to
        recharge when auto-recharge triggers. Defaults to `50`. |


        ### Behaviour


        - Set `enable: false` to disable auto-recharge immediately

        - When`enable` is `true` and a payment method exists: Auto-recharge is
        enabled immediately.

        - When `enable` is `true` but no payment method exists:
            - A Stripe Checkout session is created to add a payment method.
            - The `paymentLink` in the response allows the user to complete the setup.
      tags:
        - payments & wallet
      parameters:
        - name: x-auth-zapmail
          in: header
          description: ''
          required: true
          example: ''
          schema:
            type: string
        - name: x-workspace-key
          in: header
          description: ''
          required: false
          example: ''
          schema:
            type: string
        - name: ' x-service-provider'
          in: header
          description: ''
          required: false
          example: ''
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                enable:
                  type: boolean
                threshold:
                  type: integer
                minimumRechargeAmount:
                  type: integer
              required:
                - enable
                - threshold
                - minimumRechargeAmount
              x-apidog-orders:
                - enable
                - threshold
                - minimumRechargeAmount
            example:
              enable: true
              threshold: 25
              minimumRechargeAmount: 100
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties: {}
              example:
                message: Add your payment method to enable auto-recharge
                paymentLink: https://example.com/payment-link/12345
          headers: {}
          x-apidog-name: Success
      security: []
      x-apidog-folder: payments & wallet
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/797058/apis/api-13490713-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.zapmail.ai/api
    description: Prod Env
security: []

```
