# BillingRunBatchResultDto

A model the API reference uses in a request or a response. The operation pages link every field typed as this model here.

Result of a `CreateAndRunAsync` call. A billing run is
always reseller-scoped, so this batch wraps one-or-more per-reseller runs:
<list type="bullet">
<item>A reseller user (or an admin acting inside a single reseller's operating context)
produces a batch of exactly one (`wasFanOut` = false).</item>
<item>An admin with no reseller context fans out across every reseller that has billable
merchants for the period (`wasFanOut` = true). Resellers with nothing to bill
are skipped without creating a run row.</item>
</list>

## Fields
- `periodKey` (string): Billing period key (yyyyMM) the batch was run for. (nullable)
- `isDryRun` (boolean): True when charges were previewed without generating invoices/charges.
- `wasFanOut` (boolean): True when this was an admin cross-reseller fan-out; false for a single-reseller run.  Drives whether the UI shows the multi-reseller summary or the single-run message.
- `isAsyncStarted` (boolean): True when the fan-out was started as a Durable background process rather than  run inline: the per-reseller counts in this result are not yet populated. Callers track  progress via `BillingRunBatchStatusDto` (`batchId`).
- `batchId` (string(uuid)): The background batch id when `isAsyncStarted` is true; otherwise null. (nullable)
- `resellersConsidered` (integer(int32)): Number of resellers evaluated (the full set considered for the run).
- `resellersRun` (integer(int32)): Number of resellers for which a billing run actually executed.
- `resellersSkipped` (integer(int32)): Number of resellers skipped without running: no billable merchants for the period,  or a completed run already exists / is in progress for the period.
- `resellersFailed` (integer(int32)): Number of resellers whose run failed.
- `totalMerchantsBilled` (integer(int32)): Total merchants successfully billed across every reseller run in the batch.
- `totalMerchantsFailed` (integer(int32)): Total merchants that failed within the executed reseller runs. A run can complete at the  reseller level while individual merchants fail; this surfaces those so the toast severity  reflects them (a fan-out with merchant failures is not a clean success).
- `outcomes` (array<[BillingRunResellerOutcomeDto](https://devportal.demo.winkpg.io/docs/api/models/BillingRunResellerOutcomeDto.md)>): Per-reseller outcomes. (nullable)
  Fields of each item:
  - `resellerId` (string(uuid))
  - `resellerName` (string): Display name of the reseller, when resolvable (admin fan-out only). (nullable)
  - `billingRunId` (string(uuid)): The created run's id, when a run executed (null for skipped resellers). (nullable)
  - `outcome` ([BillingRunResellerOutcome](https://devportal.demo.winkpg.io/docs/api/models/BillingRunResellerOutcome.md)): Classifies how a single reseller fared within an admin billing-run batch. Lives in  Domain.Shared so the Domain aggregate (`MerchantBillingRunBatch`'s embedded  outcome) and the Application.Contracts DTOs can both reference it without a layer violation.
    Values:
    - `Completed`: A run executed for the reseller (may include per-merchant failures within it).
    - `SkippedNoBillableMerchants`: No merchants were assigned to a price plan for the period: no run was created.
    - `SkippedAlreadyRun`: A completed (non-dry) run already exists for this reseller and period.
    - `SkippedRunInProgress`: A run is already in progress for this reseller.
    - `Failed`: The reseller's run failed before completion (or failed to enqueue).
    - `Scheduled`: The reseller's run was accepted and queued as a background job. Merchants are billed asynchronously; the run's final status (Completed, PartiallyCompleted or Failed) appears on the run once processing finishes. An all-resellers batch reports progress through the batch status instead.
    - `SkippedMerchantBillingDisabled`: The reseller has the "Merchant Billing" master switch (ResellerFeatures.MerchantBilling) turned off, so no run was created and no invoices were generated for its merchants.
  - `successCount` (integer(int32)): Merchants successfully billed in this reseller's run.
  - `failureCount` (integer(int32)): Merchants that failed in this reseller's run.
  - `totalBilledAmount` (number(double)): Total amount billed in this reseller's run.

## See also

- [All documentation](https://devportal.demo.winkpg.io/llms.txt): the machine-readable index of every public page on this site.
