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

# Update Payment Code



## OpenAPI

````yaml patch /payment-codes/{id}
openapi: 3.0.3
info:
  title: Monime API
  description: Monime REST API. Please visit https://docs.momime.io/api for more details.
  termsOfService: https://monime.io/legal/terms-of-service
  contact:
    name: Monime Developers
    url: https://github.com/monimesl
    email: dev@monime.io
  version: '2024-08-01'
servers:
  - url: https://api.monime.io/
security:
  - bearerAuth: []
paths:
  /payment-codes/{id}:
    patch:
      tags:
        - PaymentCode
      summary: Update Payment Code
      operationId: UpdatePaymentCode
      parameters:
        - name: id
          in: path
          description: A unique identifier for the payment code object.
          required: true
          schema:
            type: string
            description: A unique identifier for the payment code object.
        - name: Monime-Space-Id
          in: header
          description: >-
            The value is the tenancy parameter that Monime used to determine
            which space the request is intended for.
          required: true
          schema:
            maxLength: 100
            pattern: ^spc-.*$
            type: string
            description: >-
              The value is the tenancy parameter that Monime used to determine
              which space the request is intended for.
      requestBody:
        content:
          application/json:
            schema:
              title: UpdatePaymentCode
              type: object
              properties:
                name:
                  maxLength: 100
                  type: string
                  description: >-
                    The name or intent indicating the purpose or use of the
                    payment code.
                  nullable: true
                isActive:
                  type: boolean
                  description: Denotes whether the payment code is active.
                  default: true
                  nullable: true
                status:
                  enum:
                    - cancelled
                  type: string
                  description: The status of the payment code.
                  nullable: true
                expireTime:
                  type: string
                  description: The expiration time of the payment code.
                  format: date-time
                allowedProviders:
                  maxItems: 10
                  minItems: 1
                  uniqueItems: true
                  type: array
                  items:
                    type: string
                  description: >-
                    The list of MoMo provider IDs for which the payment code is
                    allowed to be used.
                  nullable: true
                metadata:
                  maxProperties: 100
                  type: object
                  description: The metadata for the payment code.
                  nullable: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    description: >-
                      Represents the status of the query operation, confirming
                      if it was successful. This field is always true
                  messages:
                    type: array
                    items: {}
                    description: >-
                      Contains a list of messages providing relevant information
                      or feedback related to the query or operation
                  result:
                    $ref: '#/components/schemas/PaymentCode'
components:
  schemas:
    PaymentCode:
      type: object
      properties:
        id:
          type: string
          description: A unique identifier for the payment code object.
          example: pmc-TJh76H8hj778hftdtu66gjio
        name:
          maxLength: 100
          type: string
          description: >-
            The name or intent indicating the purpose or use of the payment
            code.
          nullable: true
          example: Home EDSA Meter Top-up
        mode:
          enum:
            - oneTime
            - recurrent
          type: string
          description: >-
            Specifies whether the payment code can be used only once or multiple
            times.
          default: oneTime
        isActive:
          type: boolean
          description: >-
            Indicates whether the payment code is currently active and available
            for use.
          default: true
        status:
          enum:
            - pending
            - processing
            - expired
            - cancelled
            - completed
          type: string
          description: >-
            The current status of the payment code, indicating its state in the
            payment process
          default: pending
        ussdCode:
          type: string
          description: >-
            The USSD code that users can dial on their mobile money device to
            make a payment using this payment code.
          example: \*715\*1\*0123456789#
        amount:
          type: object
          properties:
            currency:
              type: string
              description: >-
                The [3-letter](https://en.wikipedia.org/wiki/ISO_4217) ISO
                currency code.
            value:
              type: integer
              description: >-
                The value representation in the currency's minor unit. E.g. For
                1 Leone (SLE 1), the value should be 100, denoting cents, the
                minor unit.
          description: >-
            The monetary amount assigned to the payment code. If mode is
            recurrent, and financial target sum is also set, this represents the
            amount to be paid for every instance of payment for this code.
        customerTarget:
          type: object
          properties:
            name:
              maxLength: 100
              type: string
              description: Name of the customer to pay for this code.
              nullable: true
              example: Musa Kamara
            reference:
              maxLength: 100
              type: string
              description: >-
                Reference that may identify this customer in some external
                system.
              nullable: true
              example: '0123456789'
            payingPhoneNumber:
              maxLength: 30
              type: string
              description: The phone number that should dial to pay for this code.
              nullable: true
              example: '078000000'
          description: >-
            Information about the specific customer that this payment code is
            targeting/
          nullable: true
        financialTarget:
          type: object
          properties:
            expectedPaymentCount:
              minimum: 1
              type: integer
              description: >-
                The number of payments expected after which the code gets
                completed.
              nullable: true
              example: 10
            expectedPaymentSum:
              type: object
              properties:
                currency:
                  type: string
                  description: >-
                    The [3-letter](https://en.wikipedia.org/wiki/ISO_4217) ISO
                    currency code.
                value:
                  type: integer
                  description: >-
                    The value representation in the currency's minor unit. E.g.
                    For 1 Leone (SLE 1), the value should be 100, denoting
                    cents, the minor unit.
              description: >-
                The sum of payment amounts expected after which the code gets
                completed.
          description: The financial target for this payment code.
          nullable: true
        allowedProviders:
          type: array
          items:
            type: string
          description: >-
            The list of MoMo provider IDs for which the payment code is allowed
            to be used.
          nullable: true
          example:
            - m17
            - m18
        progress:
          type: object
          properties:
            isCompleted:
              type: boolean
              description: Indicate whether the payment code is completed or not.
            totalPaymentCount:
              type: integer
              description: Represents the total number of payments made using this code.
            totalPaymentSum:
              type: object
              properties:
                currency:
                  type: string
                  description: >-
                    The [3-letter](https://en.wikipedia.org/wiki/ISO_4217) ISO
                    currency code.
                value:
                  type: integer
                  description: >-
                    The value representation in the currency's minor unit. E.g.
                    For 1 Leone (SLE 1), the value should be 100, denoting
                    cents, the minor unit.
              description: >-
                Represents the total sum of payment amounts made using this
                code.
          description: The progress of the payment code.
        financialAccountId:
          type: string
          description: >-
            The ID of the financial account where the amount is settled to. This
            default to the owner's *Main* financial account.'
          nullable: true
        expireTime:
          type: string
          description: The expiration time of the payment code.
          format: date-time
        createTime:
          type: string
          description: The creation time of the payment code.
          format: date-time
        metadata:
          maxProperties: 100
          type: object
          description: The metadata for the payment code.
          nullable: true
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: auth-scheme
      description: >-
        Bearer HTTP authentication specified with the header Authorization:
        Bearer <access_token>

````