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

> ## Agent Instructions
> Use Stable documentation by default. Honor an explicit Beta request or a URL under /docs/beta/. If the requested version conflicts with the installed CLI package or API origin, clarify the target before writing integration code.
> Pages under /docs/beta/ document Beta; other product pages document Stable. Keep the CLI package, commands, API origin, and credentials within the selected version. State the documentation version in your answer.
> For MCP search, always pass version: Stable or version: Beta. Unfiltered search mixes both versions. For filesystem reads, keep Beta queries under /beta/ and exclude /beta/ from Stable queries; discover paths before reading them.
> The public docs base is https://photon.codes/docs. Convert MCP page paths to public URLs under that base, preserving /beta/ when present. Read https://photon.codes/docs/skill.md for version selection and https://photon.codes/docs/llms.txt for the version indexes.

# Preview an organization billing change

> Preview an organization billing change: previewOrganizationChange in the TypeScript, Python and Rust clients.

`POST /v1/organizations/{organizationId}/billing/preview`

Previews a fixed-charge quantity change on the selected organization's own subscription, such as SSO. Prices the change by the billing engine exactly as making it would bill it now: dueNow is that invoice, with taxes and the payer's credits applied. A quantity already paid for this period is not billed again, so a purchase after a release can be free. nextCharge is what is charged in advance at the next period start. For a fixed-charge change, pass quote on with the purchase so it is refused if the price or period no longer hold. This operation does not change billing.

<Tabs>
  <Tab title="TypeScript">
    ```typescript TypeScript theme={null}
    photon.organizations.billing.previewOrganizationChange(input: PreviewOrganizationChangeInput, options?: RequestOptions): Promise<PreviewOrganizationChangeOutput>
    ```
  </Tab>

  <Tab title="Python">
    ```python Python theme={null}
    photon.organizations.billing.preview_organization_change(input: PreviewOrganizationChangeInput) -> models.PreviewOrganizationChangeResponse
    ```
  </Tab>

  <Tab title="Rust">
    ```rust Rust theme={null}
    client.preview_organization_change(organization_id: String, body: &types::PreviewOrganizationChangeRequest).await -> Result<ResponseValue<types::PreviewOrganizationChangeResponse>, Error<PreviewOrganizationChangeError>>
    ```
  </Tab>
</Tabs>

<RequestExample>
  ```typescript TypeScript theme={null}
  import { Photon } from "@photon-ai/api";

  const photon = new Photon({
    headers: { Authorization: `Bearer ${process.env.PHOTON_API_TOKEN}` },
  });
  const result = await photon.organizations.billing.previewOrganizationChange({
    path: {
      organizationId: "organizationId",
    },
    body: {
      fixedCharge: {
        fixedChargeCode: "fixedChargeCode",
        increment: -10000,
      },
    },
  });
  ```

  ```python Python theme={null}
  import os

  from photon_api import Photon
  from photon_api.rpc_generated import PreviewOrganizationChangeInput

  photon = Photon(headers={"Authorization": f"Bearer {os.environ['PHOTON_API_TOKEN']}"})
  result = photon.organizations.billing.preview_organization_change(
      PreviewOrganizationChangeInput.model_validate({
          "path": {
              "organizationId": "organizationId",
          },
          "body": {
              "fixedCharge": {
                  "fixedChargeCode": "fixedChargeCode",
                  "increment": -10000,
              },
          },
      })
  )
  ```

  ```rust Rust theme={null}
  use photon_ai_api::{Credential, PhotonClientBuilder, SecretString};

  let token = std::env::var("PHOTON_API_TOKEN")?;
  let client = PhotonClientBuilder::new()
      .credential("accountServiceKey", Credential::Bearer(SecretString::from(token)))
      .build()?;
  let result = client
      .preview_organization_change(
          "organizationId".to_owned(),
          &serde_json::from_value(serde_json::json!({
              "fixedCharge": {
                  "fixedChargeCode": "fixedChargeCode",
                  "increment": -10000,
              },
          }))?,
      )
      .await
      .map_err(|error| format!("{error:?}"))?
      .into_inner();
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "balanceAfterCents": null,
    "dueNow": {
      "creditsCents": -9007199254740991,
      "currency": "string",
      "discountCents": -9007199254740991,
      "feesCents": -9007199254740991,
      "lines": [
        {
          "amountCents": -9007199254740991,
          "code": "string",
          "kind": "fixed_charge",
          "name": "string",
          "periodEnd": null,
          "periodStart": null,
          "units": "string"
        }
      ],
      "taxesCents": -9007199254740991,
      "totalCents": -9007199254740991
    },
    "nextCharge": null,
    "planChange": null,
    "quote": null,
    "timeZone": "string"
  }
  ```
</ResponseExample>

## Parameters

<ParamField path="organizationId" type={"string"} required />

## Body

<ParamField body="fixedCharge" type={"FixedChargeChange"} required>
  A quantity change made now, as a purchase or release makes it.
</ParamField>

## Returns

**`200`** What the change would bill. PreviewOrganizationChangeResponse

<ResponseField name="balanceAfterCents" type={"integer | null"} required>
  The payer's credit balance once dueNow is charged: the credit the change issues included, less what dueNow uses. In dueNow's currency. Null when the change charges nothing now (a downgrade).
</ResponseField>

<ResponseField name="dueNow" type={"BillingPreviewInvoice"} required>
  Charged when the change is made, priced as the change bills it. No lines when it charges nothing now.
</ResponseField>

<ResponseField name="nextCharge" type={"BillingNextCharge | null"} required>
  What is charged in advance at the next period start for what is held after the change. Usage and a minimum commitment are billed after the period. Null when nothing is, or the subscription ends first.
</ResponseField>

<ResponseField name="planChange" type={"BillingPlanChangeEffect | null"} required>
  Set for a plan change, null otherwise.
</ResponseField>

<ResponseField name="quote" type={"FixedChargeQuote | null"} required>
  Set for a fixed-charge change, null otherwise: the unit price, currency and period the preview was priced on. Pass them on with the purchase so it is refused if they no longer hold.
</ResponseField>

<ResponseField name="timeZone" type={"string"} required>
  The IANA time zone the payer is billed in, e.g. America/Los\_Angeles. Billing periods start and end at its midnights, so read their calendar dates in it.
</ResponseField>


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