Skip to content

CustomCharge

Source code in docs_src/capo_appmonetization/types/custom_charge.py
class CustomCharge(TypedDict, closed=True):
    charge_id: "capo_appmonetization.types.charge_id.ChargeId"
    """Caller-chosen stable id for THIS charge. It is the idempotency and replace key: re-submitting the same chargeId within its assigned period upserts the charge in place. A chargeId is bound to the first period it is accepted into; re-submitting it after that period rolls over is refused (ConflictException) rather than billing it again, so it must be unique per charge for this user across all periods — use a UUID or your own invoice-line id (the caller does not know the billing period, so it cannot be encoded in the id)."""
    description: (
        "capo_appmonetization.types.custom_charge_description.CustomChargeDescription"
    )
    """Human-readable description, surfaced on the invoice line."""
    amount: "capo_appmonetization.types.price_amount.PriceAmount"
    """The charge, as a decimal string in major currency units (for example, "12.50")."""
    currency: "capo_appmonetization.types.currency_code.CurrencyCode"
    """The ISO 4217 currency of the amount. Only USD is supported; a non-USD value is rejected."""
    metric_id: NotRequired["capo_appmonetization.types.metric_id.MetricId"]
    """Optional metric this charge derives from. Omitted for a charge not tied to a metric (a flat or custom fee)."""
    tax_code: NotRequired["capo_appmonetization.types.product_tax_code.ProductTaxCode"]
    """Optional product tax code; defaults to the service default when omitted."""

amount instance-attribute

amount: PriceAmount

The charge, as a decimal string in major currency units (for example, "12.50").

charge_id instance-attribute

charge_id: ChargeId

Caller-chosen stable id for THIS charge. It is the idempotency and replace key: re-submitting the same chargeId within its assigned period upserts the charge in place. A chargeId is bound to the first period it is accepted into; re-submitting it after that period rolls over is refused (ConflictException) rather than billing it again, so it must be unique per charge for this user across all periods — use a UUID or your own invoice-line id (the caller does not know the billing period, so it cannot be encoded in the id).

currency instance-attribute

currency: CurrencyCode

The ISO 4217 currency of the amount. Only USD is supported; a non-USD value is rejected.

description instance-attribute

Human-readable description, surfaced on the invoice line.

metric_id instance-attribute

metric_id: NotRequired[MetricId]

Optional metric this charge derives from. Omitted for a charge not tied to a metric (a flat or custom fee).

tax_code instance-attribute

tax_code: NotRequired[ProductTaxCode]

Optional product tax code; defaults to the service default when omitted.