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

# Update a wallet



## OpenAPI

````yaml /api-reference/ubb_openapi_inline.json put /wallets/{wallet_id}
openapi: 3.0.1
info:
  title: Usage Based Billing API
  version: 1.0.0
  description: An Orchestrator for Usage Based Billing and Payments
servers:
  - url: https://api-m.sandbox.paypal.com/v1/commerce/billing
security:
  - BearerAuth:
      - read
      - write
tags:
  - name: Alerts
    description: API endpoints for managing subscription alerts
  - name: Events
    description: API endpoints for managing events
  - name: Metrics
    description: API endpoints for metrics and usage data
  - name: Merchant Activation
    description: API endpoint for merchant activation
  - name: Credit Notes
    description: API endpoints for credit notes management
  - name: Customers
    description: API endpoints for customer management
  - name: Invoices
    description: API endpoints for invoice management
  - name: Plans
    description: API endpoints for subscription plans
  - name: Subscriptions
    description: API endpoints for subscriptions
  - name: Wallets
    description: API endpoints for wallet management
  - name: Taxes
    description: API endpoints for tax management
  - name: Billing Entities
    description: API endpoints for billing entities
  - name: Features
    description: API endpoints for managing features and privileges
  - name: Entitlements
    description: API endpoints for managing plan and subscription entitlements
paths:
  /wallets/{wallet_id}:
    put:
      tags:
        - Wallets
      summary: Update a wallet
      operationId: UpdateWalletById
      parameters:
        - $ref: '#/components/parameters/wallet_id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WalletUpdate'
      responses:
        '200':
          description: Wallet updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WalletWithId'
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    wallet_id:
      in: path
      name: wallet_id
      required: true
      description: ' Wallet ID'
      schema:
        type: string
      example: 8ef02857-a71e-4ea2-bcf9-57d3a41bc6ba
  schemas:
    WalletUpdate:
      type: object
      properties:
        name:
          type: string
          description: Updated wallet name
          example: Updated Wallet Name
        expiration_at:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
          description: Cancelled date of the subscription
          example: '2025-01-01T00:00:00Z'
        applies_to:
          allOf:
            - $ref: '#/components/schemas/PrepaidCreditAppliesTo'
        recurring_transaction_rules:
          type: array
          description: List of recurring transaction rules for automatic top-ups
          items:
            allOf:
              - $ref: '#/components/schemas/RecurringTransactionRule'
    WalletWithId:
      allOf:
        - $ref: '#/components/schemas/Wallet'
        - type: object
          properties:
            id:
              $ref: '#/components/schemas/WalletId'
              description: Unique identifier for the wallet
              example: sub_01H3YT8P7Q5R3S1T2U0V4W9X8
    DateTimeWithZone:
      type: string
      format: date-time
      description: Date and time in ISO 8601 format.
      example: '2023-10-01T12:00:00Z'
    PrepaidCreditAppliesTo:
      type: object
      description: >-
        Indicates whether the prepaid credit applies to the entire invoice or
        only to specific line items.
      properties:
        fee_types:
          type: array
          items:
            $ref: '#/components/schemas/FeeType'
          example:
            - SUBSCRIPTION
    RecurringTransactionRule:
      type: object
      description: >-
        Defines a recurring wallet transaction rule that triggers based on
        specific conditions.
      required:
        - method
        - trigger
      properties:
        trigger:
          $ref: '#/components/schemas/RecurringTransactionTrigger'
        paid_credits:
          type: string
          description: >-
            Number of paid credits to be added when the rule is triggered. Must
            be a positive value
          example: '20.0'
          pattern: ^(0|[1-9]\d*)(\.\d+)?$
        granted_credits:
          type: string
          description: >-
            Number of granted credits to be added when the rule is triggered.
            Must be a positive value
          example: '10.0'
          pattern: ^(0|[1-9]\d*)(\.\d+)?$
        method:
          $ref: '#/components/schemas/RecurringTransactionMethod'
        interval:
          $ref: '#/components/schemas/BillingCycle'
        started_at:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
          description: Start date of the recurring wallet transaction rule
          example: '2025-01-01T00:00:00Z'
        expiration_at:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
          description: Expiration date of the recurring wallet transaction rule
          example: '2025-01-01T00:00:00Z'
        threshold_credits:
          type: string
          description: Threshold of credits that triggers the recurring transaction rule.
          example: '5.0'
        target_ongoing_balance:
          type: string
          description: Target ongoing balance that triggers the recurring transaction rule.
          example: '200.0'
    Wallet:
      type: object
      required:
        - external_customer_id
        - rate_amount
        - status
      properties:
        external_customer_id:
          type: string
          description: External system reference to the customer
          example: client-12345
        status:
          $ref: '#/components/schemas/WalletStatus'
        available_balance:
          allOf:
            - $ref: '#/components/schemas/Amount'
        ongoing_usage:
          allOf:
            - $ref: '#/components/schemas/Amount'
            - description: >-
                The ongoing usage of the wallet, and it reflects all current
                usage and draft invoices including taxes.
              example:
                value: 100
                currency_code: USD
        net_balance:
          allOf:
            - $ref: '#/components/schemas/Amount'
            - description: >-
                This represents the real-time balance after accounting for
                current usage,.
              example:
                value: 50
                currency_code: USD
        name:
          type: string
          description: Human-readable wallet name
          example: Prepaid Wallet
        rate_amount:
          type: string
          description: Price charged per credit unit
          example: '1.5'
        available_credits:
          type: string
          description: Current credit balance available
          example: '28.0'
        ongoing_usage_credits:
          type: string
          description: This reflects all current usage and draft invoices.
          example: '10.0'
        net_balance_credits:
          type: string
          description: >-
            This represents the real time balance after accounting for current
            usage.
          example: '18.0'
        consumed_credits:
          type: string
          description: Total credits consumed so far
          example: '2.0'
        created_at:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
          description: >-
            Date and time when the wallet was created, represented in ISO 8601
            datetime format and expressed in Coordinated Universal Time (UTC).
          example: '2025-01-01T00:00:00Z'
        expiration_at:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
          description: >-
            Date and time when the wallet is set to expire, represented in ISO
            8601 datetime format and expressed in Coordinated Universal Time
            (UTC).
          example: '2025-01-01T00:00:00Z'
        terminated_at:
          allOf:
            - $ref: '#/components/schemas/DateTimeWithZone'
          description: >-
            Date and time when the wallet was terminated, represented in ISO
            8601 datetime format and expressed in Coordinated Universal Time
            (UTC).
          example: '2025-01-01T00:00:00Z'
        applies_to:
          allOf:
            - $ref: '#/components/schemas/PrepaidCreditAppliesTo'
        recurring_transaction_rules:
          type: array
          description: List of recurring transaction rules for automatic top-ups
          items:
            allOf:
              - $ref: '#/components/schemas/RecurringTransactionRule'
    WalletId:
      type: string
      description: Unique identifier for the wallet
      example: 1a901a90-1a90-1a90-1a90-1a901a901a90
    Error:
      type: object
      properties:
        name:
          type: string
        debug_id:
          type: string
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetail'
    FeeType:
      type: string
      description: Types of fees that wallet prepaid credits can be applied to
      enum:
        - SUBSCRIPTION
        - COMMITMENT
        - CHARGE
      x-enum-varnames:
        - SUBSCRIPTION
        - COMMITMENT
        - CHARGE
      x-enum-descriptions:
        - Wallet prepaid credits used only for subscription payments
        - Wallet prepaid credits used only for commitment payments
        - Wallet prepaid credits used only for charge payments
      example: SUBSCRIPTION
    RecurringTransactionTrigger:
      type: string
      description: Condition that triggers the recurring transaction rule
      enum:
        - INTERVAL
        - THRESHOLD
      x-enum-varnames:
        - INTERVAL
        - THRESHOLD
      x-enum-descriptions:
        - Recurring transaction rule triggered at a specific interval
        - Recurring transaction rule triggered when a threshold is reached
      example: THRESHOLD
    RecurringTransactionMethod:
      type: string
      description: Method for recurring transaction execution
      enum:
        - FIXED
        - TARGET
      x-enum-varnames:
        - FIXED
        - TARGET
      x-enum-descriptions:
        - Recurring transaction rule with fixed credits
        - Recurring transaction rule with target ongoing balance
      example: FIXED
    BillingCycle:
      type: string
      description: The billing cycle indicating how often the subscription is charged
      enum:
        - WEEKLY
        - MONTHLY
        - QUARTERLY
        - YEARLY
      x-enum-varnames:
        - WEEKLY
        - MONTHLY
        - QUARTERLY
        - YEARLY
      x-enum-descriptions:
        - Recurring billing occurs every week
        - Recurring billing occurs every month
        - Recurring billing occurs every three months
        - Recurring billing occurs once a year
      example: MONTHLY
    WalletStatus:
      type: string
      description: Current status of the wallet
      enum:
        - ACTIVE
        - TERMINATED
        - PENDING
      x-enum-varnames:
        - ACTIVE
        - TERMINATED
        - PENDING
      x-enum-descriptions:
        - The wallet is active and can be used for transactions
        - The wallet has been terminated and cannot be used
        - The wallet is pending activation or processing
      example: ACTIVE
    Amount:
      allOf:
        - $ref: '#/components/schemas/AmountNoCurrency'
        - type: object
          required:
            - currency_code
          properties:
            currency_code:
              $ref: '#/components/schemas/Currency'
    ErrorDetail:
      type: object
      properties:
        field:
          type: string
        value:
          type: string
        location:
          type: string
        issue:
          type: string
        description:
          type: string
    AmountNoCurrency:
      type: object
      required:
        - value
      properties:
        value:
          type: number
          format: decimal
          description: >-
            The amount value in the corresponding currency unit (e.g., two
            decimals for USD, no decimals for JPY).
          example: 120.35
          minimum: 0
          nullable: false
          default: 0
    Currency:
      type: string
      description: Currency code in ISO 4217 format.
      example: USD
      minLength: 3
      maxLength: 3
      pattern: ^[A-Z]{3}$
  responses:
    BadRequest:
      description: Bad Request - Invalid input data
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            name: INVALID_REQUEST
            message: >-
              Request is not well-formed, syntactically incorrect, or violates
              schema.
            debug_id: dc99e3955cdd8
            details:
              - field: /email
                value: abc
                location: body
                issue: INVALID_PARAMETER_VALUE
                description: The value of a field does not conform to the expected format.
    Forbidden:
      description: Authorization failed due to insufficient permissions.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            name: NOT_AUTHORIZED
            message: Authorization failed due to insufficient permissions.
            debug_id: 565f78f101498
            details:
              - issue: PERMISSION_DENIED
                description: >-
                  You do not have permission to access or perform operations on
                  this resource.
    NotFound:
      description: Resource Not Found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal Server Error - An unexpected error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            name: INTERNAL_SERVER_ERROR
            message: An internal server error has occurred.
            debug_id: 90957fca61718
  securitySchemes:
    BearerAuth:
      type: oauth2
      description: >-
        Use the /v1/oauth2/token endpoint to obtain an access token and pass it
        as a Bearer token in the Authorization header.
      flows:
        clientCredentials:
          tokenUrl: https://api-m.sandbox.paypal.com/v1/oauth2/token
          scopes:
            read: Read access
            write: Write access

````