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

# Update Draft Invoice

> Invoices are created automatically once payment is successful for prepaid subscriptions and session-based payments. No invoice is created for unsuccessful session payments.

For subscriptions, invoices with `DRAFT` status can be updated to change the invoice amount based on the resources consumed by the customer. After updating the invoice, use [Approve Draft Invoice](/api-reference/invoice/approve-draft-invoice) to make the invoice available to the customer.

**Note:** This API works only for subscriptions and does not work for session-based payments.



## OpenAPI

````yaml /api-reference/invoices/invoice.json post /invoice/v1.0/updateDraftInvoice
openapi: 3.0.3
info:
  title: Invoice API
  description: API's to get invoice information.
  version: 1.0.0
servers:
  - url: https://sandbox-api.transactbridge.com
    description: Sandbox Environment
  - url: https://api.transactbridge.com
    description: Production Environment
security:
  - ApiKeyAuth: []
    SignatureAuth: []
paths:
  /invoice/v1.0/updateDraftInvoice:
    post:
      tags:
        - Invoice
      summary: Update Draft Invoice
      description: >-
        Invoices are created automatically once payment is successful for
        prepaid subscriptions and session-based payments. No invoice is created
        for unsuccessful session payments.


        For subscriptions, invoices with `DRAFT` status can be updated to change
        the invoice amount based on the resources consumed by the customer.
        After updating the invoice, use [Approve Draft
        Invoice](/api-reference/invoice/approve-draft-invoice) to make the
        invoice available to the customer.


        **Note:** This API works only for subscriptions and does not work for
        session-based payments.
      operationId: updateDraftInvoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - invoiceId
                - items
              properties:
                invoiceId:
                  type: string
                  description: The ID of the invoice for which an update needs to be done.
                items:
                  type: array
                  description: >-
                    Items that need to be updated in the invoice to change the
                    amount of the invoice.
                  items:
                    type: object
                    required:
                      - name
                      - quantity
                      - amount
                    properties:
                      name:
                        type: string
                        description: Name of the product the customer wants to buy.
                      quantity:
                        type: number
                        description: Number of products the customer wants to buy.
                      amount:
                        type: number
                        description: Price of the product.
                      description:
                        type: string
                        description: Description of the product.
      responses:
        '200':
          description: Updated Invoice data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/updateDraftinvoice'
components:
  schemas:
    updateDraftinvoice:
      type: object
      properties:
        status:
          type: string
          description: The response from the API
        sub_status:
          type: string
          description: Used for internal purposes only
        data:
          type: object
          description: Updated Invoice data
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Merchant API Key
    SignatureAuth:
      type: apiKey
      in: header
      name: x-signature
      description: Generated request signature

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.