Interface CustomCharge.Builder

  • Method Details

    • chargeId

      CustomCharge.Builder chargeId(String 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).

      Parameters:
      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).
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • description

      CustomCharge.Builder description(String description)

      Human-readable description, surfaced on the invoice line.

      Parameters:
      description - Human-readable description, surfaced on the invoice line.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • amount

      CustomCharge.Builder amount(String amount)

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

      Parameters:
      amount - The charge, as a decimal string in major currency units (for example, "12.50").
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • currency

      CustomCharge.Builder currency(String currency)

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

      Parameters:
      currency - The ISO 4217 currency of the amount. Only USD is supported; a non-USD value is rejected.
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • metricId

      CustomCharge.Builder metricId(String metricId)

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

      Parameters:
      metricId - Optional metric this charge derives from. Omitted for a charge not tied to a metric (a flat or custom fee).
      Returns:
      Returns a reference to this object so that method calls can be chained together.
    • taxCode

      CustomCharge.Builder taxCode(String taxCode)

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

      Parameters:
      taxCode - Optional product tax code; defaults to the service default when omitted.
      Returns:
      Returns a reference to this object so that method calls can be chained together.