> ## 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

> Partially updates an existing payment code with new values, rules, or account bindings.



## OpenAPI

````yaml patch /v1/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: v1
servers:
  - url: https://api.monime.io/
security:
  - bearerAuth: []
paths:
  /v1/payment-codes/{id}:
    patch:
      tags:
        - Payment Code
      summary: Update Payment Code
      description: >-
        Partially updates an existing payment code with new values, rules, or
        account bindings.
      operationId: UpdatePaymentCode
      parameters:
        - name: id
          in: path
          description: The unique ID of the payment code to update.
          required: true
          schema:
            pattern: ^pmc-.*$
            type: string
            description: The unique ID of the payment code to update.
        - name: Monime-Version
          in: header
          description: Specifies which version of the Monime API will handle this request.
          schema:
            enum:
              - caph.2025-08-23
              - caph.2025-06-20
            type: string
            description: >-
              Specifies which version of the Monime API will handle this
              request.
            nullable: true
        - name: Monime-Space-Id
          in: header
          description: >-
            The value is the tenancy parameter that Monime uses to determine
            which space the request is intended for.
          required: true
          schema:
            maxLength: 64
            pattern: ^spc-.*$
            type: string
            description: >-
              The value is the tenancy parameter that Monime uses to determine
              which space the request is intended for.
      requestBody:
        content:
          application/json:
            schema:
              title: UpdatePaymentCode
              type: object
              properties:
                name:
                  maxLength: 64
                  minLength: 3
                  type: string
                  description: Updated display name or label for the payment code.
                  nullable: true
                amount:
                  type: object
                  properties:
                    currency:
                      type: string
                      description: >-
                        The [3-letter](https://en.wikipedia.org/wiki/ISO_4217)
                        ISO currency code. Currently supported: 'SLE'
                    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.
                  additionalProperties: false
                  description: Updated amount to charge per use.
                  nullable: true
                duration:
                  type: string
                  description: New expiration duration for the code.
                  nullable: true
                enable:
                  type: boolean
                  description: Flag to activate or deactivate the payment code.
                  nullable: true
                customer:
                  type: object
                  properties:
                    name:
                      maxLength: 100
                      type: string
                      description: >-
                        Optional name of the customer associated with the
                        payment code. Displayed in the USSD prompt for
                        contextual reference.
                      nullable: true
                      example: Musa Kamara
                  additionalProperties: false
                  description: Updated customer information for this payment code.
                  nullable: true
                reference:
                  maxLength: 64
                  type: string
                  description: New reference string for tagging the payment code.
                  nullable: true
                authorizedProviders:
                  maxItems: 10
                  minItems: 1
                  uniqueItems: true
                  type: array
                  items:
                    enum:
                      - m17
                      - m18
                    type: string
                    description: >-
                      The ID of the MOMO as identified by Monime. E.g. m17 to
                      denote Orange Money SL
                  description: >-
                    Updated list of mobile money providers allowed to use this
                    code.
                  nullable: true
                authorizedPhoneNumber:
                  type: string
                  description: New MSISDN authorized to use this payment code exclusively.
                  nullable: true
                recurrentPaymentTarget:
                  type: object
                  properties:
                    expectedPaymentCount:
                      minimum: 1
                      type: integer
                      description: >-
                        Minimum expected number of payments after which the
                        recurrent payment code may be considered complete.
                        Optional.
                      nullable: true
                      example: 10
                    expectedPaymentTotal:
                      type: object
                      properties:
                        currency:
                          type: string
                          description: >-
                            The
                            [3-letter](https://en.wikipedia.org/wiki/ISO_4217)
                            ISO currency code. Currently supported: 'SLE'
                        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.
                      additionalProperties: false
                      description: >-
                        Minimum total amount to be collected before the
                        recurrent payment code is considered complete. Optional.
                  additionalProperties: false
                  description: >-
                    Updated target count or amount for completing a recurrent
                    payment code.
                  nullable: true
                financialAccountId:
                  maxLength: 64
                  pattern: ^fac-.*$
                  type: string
                  description: Updated destination financial account for funds settlement.
                  nullable: true
                metadata:
                  maxProperties: 64
                  type: object
                  additionalProperties:
                    maxLength: 100
                    type: string
                    description: >-
                      Metadata values are free-form strings up to 100
                      characters.
                  description: >-
                    Updated metadata for storing additional context about the
                    payment code.
                  nullable: true
              additionalProperties: false
              description: >-
                Partially updates an existing payment code with new values,
                rules, or account bindings.
      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:
      title: Payment Code
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the payment code object.
        mode:
          enum:
            - one_time
            - recurrent
          type: string
          description: >-
            Usage mode of the payment code:

            - 'one_time': Can be used only once

            - 'recurrent': Can be used multiple times until a target is met or
            it expires.
        status:
          enum:
            - pending
            - cancelled
            - processing
            - expired
            - completed
          type: string
          description: >-
            Lifecycle status of the payment code: 'pending' (created but not in
            use), 'processing' (currently in use), 'expired' (duration elapsed),
            'completed' (usage or target fulfilled), or 'cancelled' (manually
            invalidated).
        name:
          type: string
          description: >-
            Optional human-readable name for the payment code, useful for
            labeling or tracking.
          nullable: true
          example: Home EDSA Meter Top-up
        amount:
          type: object
          properties:
            currency:
              type: string
              description: >-
                The [3-letter](https://en.wikipedia.org/wiki/ISO_4217) ISO
                currency code. Currently supported: 'SLE'
            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.
          additionalProperties: false
          description: >-
            Amount charged per use of the payment code. For 'recurrent' mode,
            this applies to each payment instance.
        enable:
          type: boolean
          description: Indicates whether the payment code is currently enabled for use.
        expireTime:
          type: string
          description: >-
            The time at which the payment code expires, provided the code is
            still pending.
          format: date-time
        customer:
          type: object
          properties:
            name:
              maxLength: 100
              type: string
              description: >-
                Optional name of the customer associated with the payment code.
                Displayed in the USSD prompt for contextual reference.
              nullable: true
              example: Musa Kamara
          additionalProperties: false
          description: >-
            Optional customer information linked to this payment code. Often
            used for USSD or receipt context.
          nullable: true
        ussdCode:
          type: string
          description: >-
            The USSD dial string customer(s) can use to initiate a payment for
            this code.
        reference:
          type: string
          description: >-
            Reference string associated with the payment code. Useful for
            transaction tagging or reconciliation.
          nullable: true
        authorizedProviders:
          type: array
          items:
            enum:
              - m17
              - m18
            type: string
            description: >-
              The ID of the MOMO as identified by Monime. E.g. m17 to denote
              Orange Money SL
          description: >-
            List of mobile money providers permitted to process payments using
            this code.
          nullable: true
          example:
            - m17
            - m18
        authorizedPhoneNumber:
          type: string
          description: >-
            MSISDN of the mobile money account exclusively allowed to use this
            code. Other users will be rejected.
        recurrentPaymentTarget:
          type: object
          properties:
            expectedPaymentCount:
              minimum: 1
              type: integer
              description: >-
                Minimum expected number of payments after which the recurrent
                payment code may be considered complete. Optional.
              nullable: true
              example: 10
            expectedPaymentTotal:
              type: object
              properties:
                currency:
                  type: string
                  description: >-
                    The [3-letter](https://en.wikipedia.org/wiki/ISO_4217) ISO
                    currency code. Currently supported: 'SLE'
                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.
              additionalProperties: false
              description: >-
                Minimum total amount to be collected before the recurrent
                payment code is considered complete. Optional.
          additionalProperties: false
          description: >-
            Target payment count or amount that determines when a recurrent
            payment code is considered complete.
          nullable: true
        financialAccountId:
          type: string
          description: >-
            ID of the financial account where collected funds will be settled.
            Defaults to the main account if not provided.
          nullable: true
        processedPaymentData:
          type: object
          properties:
            amount:
              type: object
              properties:
                currency:
                  type: string
                  description: >-
                    The [3-letter](https://en.wikipedia.org/wiki/ISO_4217) ISO
                    currency code. Currently supported: 'SLE'
                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.
              additionalProperties: false
            orderId:
              type: string
            paymentId:
              type: string
            orderNumber:
              type: string
            channelData:
              type: object
              properties:
                providerId:
                  type: string
                accountId:
                  type: string
                reference:
                  type: string
            financialTransactionReference:
              type: string
            metadata:
              maxProperties: 64
              type: object
              additionalProperties:
                maxLength: 100
                type: string
                description: Metadata values are free-form strings up to 100 characters.
              description: >-
                Metadata is a flexible map of string key-value pairs for tagging
                or attaching additional information. A maximum of 64 pairs is
                allowed per object.
              nullable: true
          description: >-
            The data of the payment that was processed for this payment code.
            This field is available only during the 'payment_code.processed'
            webhook event.
          nullable: true
        createTime:
          type: string
          description: Timestamp indicating when the payment code was created.
          format: date-time
        updateTime:
          type: string
          description: Timestamp indicating when the payment code was last updated.
          format: date-time
          nullable: true
        ownershipGraph:
          title: OwnershipGraph
          type: object
          properties:
            owner:
              title: OwnershipObject
              type: object
              properties:
                id:
                  type: string
                  description: '**Unique ID** of the object instance that owns this entity.'
                  readOnly: true
                type:
                  type: string
                  description: >-
                    **Type of the object** that owns this entity. Examples
                    include: 'internal_transfer', 'checkout_session',
                    'payment_code'.
                  readOnly: true
                metadata:
                  maxProperties: 64
                  type: object
                  additionalProperties:
                    maxLength: 100
                    type: string
                    description: >-
                      Metadata values are free-form strings up to 100
                      characters.
                  description: '**Arbitrary metadata** describing the owning object.'
                  nullable: true
                  readOnly: true
                owner:
                  $ref: '#/components/schemas/CoreresourcesParentOwningObject'
              additionalProperties: false
              description: >-
                **Immediate object** that owns this entity. This is the direct
                originator or source object.
              readOnly: true
          additionalProperties: false
          description: >-
            Full ownership graph tracing the origin of this payment code objects
            across multiple objects.
          nullable: true
        metadata:
          maxProperties: 64
          type: object
          additionalProperties:
            maxLength: 100
            type: string
            description: Metadata values are free-form strings up to 100 characters.
          description: >-
            Custom metadata attached to the payment code for storing
            business-specific context or tags.
          nullable: true
      description: >-
        A **Payment Code** is a programmable, short-lived token that allows
        users to collect payments from others.  

        It is especially useful in **USSD-like** or **QR-based** flows, where
        the payer enters or scans a code to complete a transaction.  


        Payment Codes provide flexibility for both **one-time** and
        **recurrent** collections, with configurable restrictions and targets.


        ---


        ### Use Cases


        - **USSD Payment Collection**  
          A merchant generates a Payment Code and displays it in USSD. Customers enter the code to make payments.  
          *Example*: A vendor creates a one-time code for **SLE 50** which a customer redeems via their mobile money wallet.  

        - **QR Code at Point of Sale**  
          The Payment Code is encoded as a QR displayed at checkout. Customers scan the QR to pay.  
          *Example*: A shop generates a QR-based Payment Code for **SLE 200**, which is redeemed on the spot.  

        - **Recurring Subscription Collection**  
          A fitness center issues a recurrent Payment Code for monthly fees.  
          *Example*: The code accepts up to **12 payments** of **SLE 500** each, after which it auto-completes.  

        - **Targeted Collection**  
          Restrict a Payment Code to a specific MSISDN or provider.  
          *Example*: Only customers on **Orange Money** with a registered number can redeem the code.  

        ---
    CoreresourcesParentOwningObject:
      title: OwnershipObject
      type: object
      properties:
        id:
          type: string
          description: '**Unique ID** of the object instance that owns this entity.'
          readOnly: true
        type:
          type: string
          description: >-
            **Type of the object** that owns this entity. Examples include:
            'internal_transfer', 'checkout_session', 'payment_code'.
          readOnly: true
        metadata:
          maxProperties: 64
          type: object
          additionalProperties:
            maxLength: 100
            type: string
            description: Metadata values are free-form strings up to 100 characters.
          description: '**Arbitrary metadata** describing the owning object.'
          nullable: true
          readOnly: true
        owner:
          $ref: '#/components/schemas/CoreresourcesParentOwningObject'
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: auth-scheme
      description: >-
        Bearer HTTP authentication specified with the header Authorization:
        Bearer <access_token>

````