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

# Update Payment Method

> Updates a saved payment method, changing its friendly alias and/or the set of NVM API keys allowed to use it. Requires a Nevermined API key.



## OpenAPI

````yaml PATCH /payment-methods/{paymentMethodId}
openapi: 3.1.0
info:
  title: Nevermined API
  description: >-
    API for managing AI agents, payment plans, and x402 payments in the
    Nevermined ecosystem.


    ## Prerequisites


    You need a Nevermined API Key to authenticate. Get one at
    [nevermined.app](https://nevermined.app) under **Settings > API Keys**.


    See the [5-Minute Setup Guide](/docs/integrate/quickstart/5-minute-setup)
    for detailed instructions.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.sandbox.nevermined.app/api/v1
    description: Sandbox (Testing) - Base Sepolia
  - url: https://api.live.nevermined.app/api/v1
    description: Live (Production) - Base Mainnet
security:
  - bearerAuth: []
tags:
  - name: Protocol - Agents
    description: Endpoints for registering and managing AI agents
  - name: Protocol - Plans
    description: Endpoints for creating and managing payment plans
  - name: Protocol - Credits
    description: Endpoints for minting and redeeming credits
  - name: Protocol - Access
    description: Endpoints for access tokens and request validation
  - name: X402 - Permissions
    description: Endpoints for x402 delegated permissions
paths:
  /payment-methods/{paymentMethodId}:
    patch:
      tags:
        - Payment Methods
      summary: Update a payment method
      description: >-
        Updates a saved payment method, changing its friendly alias and/or the
        set of NVM API keys allowed to use it. Requires a Nevermined API key.
      operationId: PaymentMethodsController_updatePaymentMethod
      parameters:
        - name: paymentMethodId
          required: true
          in: path
          description: Identifier of the payment method to update
          schema:
            type: string
            example: pm_1Abc2Def3Ghi4Jkl
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePaymentMethodDto'
      responses:
        '200':
          description: The updated payment method
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentMethodSummaryDto'
        '401':
          description: Unauthorized - Invalid or missing API key
        '404':
          description: Not Found - Payment method does not exist
components:
  schemas:
    UpdatePaymentMethodDto:
      type: object
      properties:
        alias:
          type: string
          description: Optional friendly name for the card
          example: My Production Card
        allowedApiKeyIds:
          description: >-
            Array of NVM API Key skId values allowed to use this card. Null or
            empty = any key can use it.
          example:
            - sk-abc123
            - sk-def456
          nullable: true
          type: array
          items:
            type: string
        orgId:
          type: string
          description: >-
            Move the card to an org (a valid orgId) or to personal (null). Omit
            to leave unchanged.
          nullable: true
    PaymentMethodSummaryDto:
      type: object
      properties:
        id:
          type: string
          example: pm_1Abc2Def3Ghi4Jkl
        type:
          type: string
          example: card
        last4:
          type: string
          example: '4242'
        brand:
          type: string
          example: visa
        expMonth:
          type: integer
          example: 12
          nullable: true
        expYear:
          type: integer
          example: 2027
          nullable: true
        alias:
          type: string
          example: My Card
          nullable: true
        provider:
          type: string
          example: stripe
          enum:
            - stripe
            - braintree
            - erc4337
            - visa
            - vgs
        status:
          type: string
          example: Active
          enum:
            - Active
            - Revoked
        allowedApiKeyIds:
          type: array
          example:
            - sk-abc123
            - sk-def456
          nullable: true
          description: NVM API Key IDs allowed to use this card. Null = any key can use it.
          items:
            type: string
        orgId:
          type: string
          description: Organization this card belongs to (null = personal).
          nullable: true
      required:
        - id
        - type
        - last4
        - brand
        - expMonth
        - expYear
        - alias
        - provider
        - status
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your Nevermined API Key (starts with 'nvm:'). Get one at
        [nevermined.app](https://nevermined.app) under **Settings > API Keys**.

````

## Related topics

- [X402 Protocol](/docs/api-reference/typescript/x402.md)
- [Revoke Payment Method](/docs/api-reference/payment-methods/revoke-payment-method.md)
- [List Payment Methods](/docs/api-reference/payment-methods/list-payment-methods.md)
- [API Reference](/docs/api-reference/openclaw-plugin/commands.md)
- [Monetize Your AI](/docs/solutions/agent-to-agent-monetization.md)
