Skip to content
Get started

Update

invoices.update(strid, InvoiceUpdateParams**kwargs) -> InvoiceUpdateResponse
POST/invoices/{id}

Updates an invoice with line item operations

ParametersExpand Collapse
id: str

Invoice ID

line_items_update: Iterable[LineItemsUpdate]

List of line item operations to apply to the invoice

Accepts one of the following:
class LineItemsUpdateAddLineItemOperation:

Operation to add a new line item to an invoice

amount: str

Amount in smallest currency unit (e.g., cents)

currency_code: Literal["ADA", "BTC", "DAI", 176 more]

Currency code (ISO 4217 or crypto)

Accepts one of the following:
"ADA"
"BTC"
"DAI"
"ETH"
"SOL"
"USDC"
"USDT"
"USDG"
"EURC"
"CADC"
"CADT"
"XLM"
"UNI"
"BCH"
"LTC"
"AAVE"
"LINK"
"MATIC"
"PTS"
"AED"
"AFN"
"ALL"
"AMD"
"ANG"
"AOA"
"ARS"
"AUD"
"AWG"
"AZN"
"BAM"
"BBD"
"BDT"
"BGN"
"BHD"
"BIF"
"BMD"
"BND"
"BOB"
"BRL"
"BSD"
"BTN"
"BWP"
"BYR"
"BZD"
"CAD"
"CDF"
"CHF"
"CLP"
"CNY"
"COP"
"CRC"
"CUC"
"CUP"
"CVE"
"CZK"
"DJF"
"DKK"
"DOP"
"DZD"
"EGP"
"ERN"
"ETB"
"EUR"
"FJD"
"FKP"
"GBP"
"GEL"
"GGP"
"GHS"
"GIP"
"GMD"
"GNF"
"GTQ"
"GYD"
"HKD"
"HNL"
"HRK"
"HTG"
"HUF"
"IDR"
"ILS"
"IMP"
"INR"
"IQD"
"IRR"
"ISK"
"JMD"
"JOD"
"JPY"
"KES"
"KGS"
"KHR"
"KMF"
"KPW"
"KRW"
"KWD"
"KYD"
"KZT"
"LAK"
"LBP"
"LKR"
"LRD"
"LSL"
"LYD"
"MAD"
"MDL"
"MGA"
"MKD"
"MMK"
"MNT"
"MOP"
"MUR"
"MVR"
"MWK"
"MXN"
"MYR"
"MZN"
"NAD"
"NGN"
"NIO"
"NOK"
"NPR"
"NZD"
"OMR"
"PAB"
"PEN"
"PGK"
"PHP"
"PKR"
"PLN"
"PYG"
"QAR"
"RON"
"RSD"
"RUB"
"RWF"
"SAR"
"SBD"
"SCR"
"SDG"
"SEK"
"SGD"
"SHP"
"SLL"
"SOS"
"SPL"
"SRD"
"SVC"
"SYP"
"STN"
"SZL"
"THB"
"TJS"
"TMT"
"TND"
"TOP"
"TRY"
"TTD"
"TVD"
"TWD"
"TZS"
"UAH"
"UGX"
"USD"
"UYU"
"UZS"
"VEF"
"VND"
"VUV"
"WST"
"XAF"
"XCD"
"XOF"
"XPF"
"YER"
"ZAR"
"ZMW"
"LOGICAL"
"CUSTOM"
description: str

Description of the line item

op: Literal["add"]

Operation type - add a new line item

product_id: str

ID of the product/catalog item

type: Literal["payin", "payout"]

The type of the line item

Accepts one of the following:
"payin"
"payout"
user_id: str

External ID of the user associated with this line item

class LineItemsUpdateUpdateLineItemOperation:

Operation to update an existing line item amount

id: str

ID of the line item to update

amount: str

New amount in smallest currency unit

op: Literal["update"]

Operation type - update an existing line item

class LineItemsUpdateDeleteLineItemOperation:

Operation to delete a line item from an invoice

id: str

ID of the line item to delete

op: Literal["delete"]

Operation type - delete an existing line item

version: float

The version of the invoice being updated. Must match the current version for the update to succeed.

ReturnsExpand Collapse
class InvoiceUpdateResponse:
data: Data

Invoice object

id: str

Unique identifier for the invoice

created: datetime

ISO 8601 timestamp when the invoice was created

formatdate-time
status: Literal["active"]

The status of the invoice

version: float

The current version of the invoice. Pass this value when updating to ensure thread safety.

workspace_id: str

Workspace ID this invoice belongs to

line_items: Optional[List[DataLineItem]]

List of line items associated with this invoice

id: str

Unique identifier for the line item

amount: str

Amount in smallest currency unit (represented as string for bigint)

currency_code: Literal["ADA", "BTC", "DAI", 176 more]

Currency code (ISO 4217 or crypto)

Accepts one of the following:
"ADA"
"BTC"
"DAI"
"ETH"
"SOL"
"USDC"
"USDT"
"USDG"
"EURC"
"CADC"
"CADT"
"XLM"
"UNI"
"BCH"
"LTC"
"AAVE"
"LINK"
"MATIC"
"PTS"
"AED"
"AFN"
"ALL"
"AMD"
"ANG"
"AOA"
"ARS"
"AUD"
"AWG"
"AZN"
"BAM"
"BBD"
"BDT"
"BGN"
"BHD"
"BIF"
"BMD"
"BND"
"BOB"
"BRL"
"BSD"
"BTN"
"BWP"
"BYR"
"BZD"
"CAD"
"CDF"
"CHF"
"CLP"
"CNY"
"COP"
"CRC"
"CUC"
"CUP"
"CVE"
"CZK"
"DJF"
"DKK"
"DOP"
"DZD"
"EGP"
"ERN"
"ETB"
"EUR"
"FJD"
"FKP"
"GBP"
"GEL"
"GGP"
"GHS"
"GIP"
"GMD"
"GNF"
"GTQ"
"GYD"
"HKD"
"HNL"
"HRK"
"HTG"
"HUF"
"IDR"
"ILS"
"IMP"
"INR"
"IQD"
"IRR"
"ISK"
"JMD"
"JOD"
"JPY"
"KES"
"KGS"
"KHR"
"KMF"
"KPW"
"KRW"
"KWD"
"KYD"
"KZT"
"LAK"
"LBP"
"LKR"
"LRD"
"LSL"
"LYD"
"MAD"
"MDL"
"MGA"
"MKD"
"MMK"
"MNT"
"MOP"
"MUR"
"MVR"
"MWK"
"MXN"
"MYR"
"MZN"
"NAD"
"NGN"
"NIO"
"NOK"
"NPR"
"NZD"
"OMR"
"PAB"
"PEN"
"PGK"
"PHP"
"PKR"
"PLN"
"PYG"
"QAR"
"RON"
"RSD"
"RUB"
"RWF"
"SAR"
"SBD"
"SCR"
"SDG"
"SEK"
"SGD"
"SHP"
"SLL"
"SOS"
"SPL"
"SRD"
"SVC"
"SYP"
"STN"
"SZL"
"THB"
"TJS"
"TMT"
"TND"
"TOP"
"TRY"
"TTD"
"TVD"
"TWD"
"TZS"
"UAH"
"UGX"
"USD"
"UYU"
"UZS"
"VEF"
"VND"
"VUV"
"WST"
"XAF"
"XCD"
"XOF"
"XPF"
"YER"
"ZAR"
"ZMW"
"LOGICAL"
"CUSTOM"
description: str

Description of the line item

product_id: str

ID of the product/catalog item

type: Literal["payin", "payout"]

The type of the line item

Accepts one of the following:
"payin"
"payout"
user_id: str

External ID of the user associated with this line item

modified: Optional[datetime]

ISO 8601 timestamp when the invoice was last modified

formatdate-time

Update

from fragment import Fragment

client = Fragment()
invoice = client.invoices.update(
    id="inv_1234567890",
    line_items_update=[{
        "amount": "1000",
        "currency_code": "USD",
        "description": "Professional services for January 2026",
        "op": "add",
        "product_id": "prod_1234567890",
        "type": "payout",
        "user_id": "user_ext_456",
    }],
    version=1,
)
print(invoice.data)
{
  "data": {
    "id": "inv_1234567890",
    "created": "2024-01-13T00:00:00Z",
    "status": "active",
    "version": 1,
    "workspaceId": "ws_1234567890",
    "lineItems": [
      {
        "id": "item_1234567890",
        "amount": "1000",
        "currencyCode": "USD",
        "description": "Professional services for January 2026",
        "product_id": "prod_1234567890",
        "type": "payout",
        "user_id": "user_ext_456"
      }
    ],
    "modified": "2024-01-13T00:00:00Z"
  }
}
Returns Examples
{
  "data": {
    "id": "inv_1234567890",
    "created": "2024-01-13T00:00:00Z",
    "status": "active",
    "version": 1,
    "workspaceId": "ws_1234567890",
    "lineItems": [
      {
        "id": "item_1234567890",
        "amount": "1000",
        "currencyCode": "USD",
        "description": "Professional services for January 2026",
        "product_id": "prod_1234567890",
        "type": "payout",
        "user_id": "user_ext_456"
      }
    ],
    "modified": "2024-01-13T00:00:00Z"
  }
}