## Top Up Organization Prepaid Balance

`client.Organizations.Billing.TopUp(ctx, organizationID, params) (*OrganizationBillingSummary, error)`

**post** `/v1/organizations/{organization_id}/billing/topup`

Charge the card on file and credit the prepaid balance. A unique Idempotency-Key header is required; reuse it across retries so a timed-out top-up is not charged twice.

### Parameters

- `organizationID string`

- `params BillingTopUpParams`

  - `Amount param.Field[string]`

    Body param: Amount to charge and credit, in USD. Must be greater than 0, at most two decimal places, and at most 10000.

  - `IdempotencyKey param.Field[string]`

    Header param: Unique idempotency key scoping the charge; reuse the same value across retries so a timed-out top-up is not charged twice

### Returns

- `type OrganizationBillingSummary struct{…}`

  Forward-looking billing summary for an organization. All costs are run-rate projections from the organization's current active usage ("≈ $X/mo at current usage").

  - `DailyCost string`

    Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `EffectiveBalance string`

    Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `MonthlyCost string`

    Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `RechargeThresholdFraction string`

    Arbitrary-precision decimal serialized as a string (e.g. "58.40").

  - `EstimatedNextChargeAt Time`

    Projected date the balance reaches the recharge threshold at the current run-rate. Null when there is no active usage (never charges).

  - `RunwayMonths string`

    Arbitrary-precision decimal serialized as a string (e.g. "58.40").

### Example

```go
package main

import (
  "context"
  "fmt"

  "github.com/nirvana-labs/nirvana-go"
  "github.com/nirvana-labs/nirvana-go/option"
  "github.com/nirvana-labs/nirvana-go/organizations"
)

func main() {
  client := nirvana.NewClient(
    option.WithAPIKey("My API Key"),
  )
  organizationBillingSummary, err := client.Organizations.Billing.TopUp(
    context.TODO(),
    "organization_id",
    organizations.BillingTopUpParams{
      Amount: "50.00",
      IdempotencyKey: "Idempotency-Key",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", organizationBillingSummary.DailyCost)
}
```

#### Response

```json
{
  "daily_cost": "-69125",
  "effective_balance": "-69125",
  "monthly_cost": "-69125",
  "recharge_threshold_fraction": "-69125",
  "estimated_next_charge_at": "2025-01-01T00:00:00Z",
  "runway_months": "-69125"
}
```
