View as Markdown

llms.txt

The API reference isn't available right now

This instance couldn't load its API specification. The reference returns as soon as the specification is readable again.

Back to the API reference

No such operation

This instance documents no operation under that identifier. It may have been renamed, or it may belong to a feature this installation hasn't enabled.

Back to the API reference

This reference may be out of date

This instance couldn't reach its API specification on the last attempt, so this page shows the copy fetched before that. Anything added or changed since then is missing here, and the reference updates itself as soon as the specification is readable again. Last fetched 2026-10-22 22:09 UTC.

API reference Merchant Billing

Billing Runs: Force-clears the current all-resellers fan-out batch.

POST /api/billing-runs/batch/clear deprecated

Requires: MerchantBilling.BillingRuns, MerchantBilling.BillingRuns.Manage, merchant scope.

Drives a stuck or stale batch to the terminal Cleared state and releases the single-in-flight guard. Restricted to an admin with no reseller context and gated on the dedicated Manage permission.

Signed in, you can send this request to your own sandbox merchant from the console and read the answer. Sign in to try it.

Example request

Every block below sends the same request. Replace {{BASE_URL}} with the address of the API you are calling and {{API_KEY}} with your own key.

The request body is a . See the Request body section below for its fields.

Code sample language

cURL

curl -X POST "{{BASE_URL}}/api/billing-runs/batch/clear" \
  -H "api-key: {{API_KEY}}"

PowerShell

$headers = @{
    'api-key' = '{{API_KEY}}'
}

$response = Invoke-RestMethod -Method POST -Uri '{{BASE_URL}}/api/billing-runs/batch/clear' `
    -Headers $headers

npm install @winkpg/winkpg-api

TypeScript (SDK)

import { Configuration, MerchantBillingApi } from '@winkpg/winkpg-api';

const api = new MerchantBillingApi(new Configuration({
  basePath: '{{BASE_URL}}',
  apiKey: '{{API_KEY}}',
}));

const { data } = await api.billingRunClearActiveBatch();

TypeScript (raw HTTP)

const response = await fetch('{{BASE_URL}}/api/billing-runs/batch/clear', {
  method: 'POST',
  headers: {
    "api-key": "{{API_KEY}}",
  },
});

const data = await response.json();

dotnet add package WinkPg.Api.Client

C# (SDK)

using WinkPg.Api.Client.Api;
using WinkPg.Api.Client.Client;

var config = new Configuration { BasePath = "{{BASE_URL}}" };
config.AddApiKey("api-key", "{{API_KEY}}");

var api = new MerchantBillingApi(config);
var result = await api.BillingRunClearActiveBatchAsync();

C# (raw HTTP)

using var http = new HttpClient { BaseAddress = new Uri("{{BASE_URL}}") };

var request = new HttpRequestMessage(new HttpMethod("POST"), "/api/billing-runs/batch/clear");
request.Headers.Add("api-key", "{{API_KEY}}");

var response = await http.SendAsync(request);
response.EnsureSuccessStatusCode();
var json = await response.Content.ReadAsStringAsync();

pip install winkpg-api

Python (SDK)

import winkpg_api

configuration = winkpg_api.Configuration(host="{{BASE_URL}}")
configuration.api_key["ApiKey"] = "{{API_KEY}}"

with winkpg_api.ApiClient(configuration) as client:
    api = winkpg_api.MerchantBillingApi(client)
    result = api.billing_run_clear_active_batch()

pip install requests

Python (raw HTTP)

import requests

headers = {
    "api-key": "{{API_KEY}}",
}

response = requests.request(
    "POST",
    "{{BASE_URL}}/api/billing-runs/batch/clear",
    headers=headers,
)
response.raise_for_status()
data = response.json()

Parameters

Name In Type Description
suppressNulls required query boolean If true, omit properties with null values.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

Request body

application/json , required

Field Type Description

This request body has no documented fields.

Responses

200 The batch was cleared.

Body: BillingRunBatchStatusDto BillingRunBatchStatusDto Each item has these fields.

Field Type Description
batchId required string (uuid) Batch document id (the tracking id returned at trigger time).
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
orchestrationInstanceId required string Identifier of the background job processing the batch. Null until processing has started. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
periodKey required string Billing period key (yyyyMM) the batch is running for. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
isDryRun required boolean True when charges are previewed without generating invoices/charges.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
status required MerchantBillingRunBatchStatus MerchantBillingRunBatchStatus Current batch status.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
Pending Batch created and the workflow has been started but discovery has not run yet.
Running The fan-out workflow is running per-reseller billing runs.
Completed Every reseller that ran completed without a failed reseller run.
PartiallyCompleted At least one reseller ran successfully and at least one reseller run failed.
Failed No reseller ran successfully and at least one reseller run failed.
Cleared An admin force-cleared the batch from the Billing Runs page. A terminal, non-failure state distinct from Failed: it records a deliberate operator action (releasing a stuck or stale batch) rather than a run that errored. Like every other terminal status it is reclaimable by the next fan-out's lock-recovery, and is never treated as in-progress.
triggeredByUserId required string (uuid) User that triggered the batch. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
triggeredByUserName required string Display name of the user that triggered the batch. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
startedAt required string (date-time) When the fan-out workflow started processing. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
completedAt required string (date-time) When the batch reached a terminal status. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
clearedByUserName required string Display name of the admin that force-cleared the batch, when `status` is `Cleared`. nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
resellersConsidered required integer (int32)
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
resellersRun required integer (int32)
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
resellersSkipped required integer (int32)
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
resellersFailed required integer (int32)
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
totalMerchantsBilled required integer (int32)
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
totalMerchantsFailed required integer (int32)
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
outcomes required array of BillingRunResellerOutcomeDto array of BillingRunResellerOutcomeDto Per-reseller outcomes (populated once the batch completes). nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

Fields of each BillingRunResellerOutcomeDto:

Field Type Description
resellerId required string (uuid)
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
resellerName required string Display name of the reseller, when resolvable (admin fan-out only). nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
billingRunId required string (uuid) The created run's id, when a run executed (null for skipped resellers). nullable
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
outcome required BillingRunResellerOutcome BillingRunResellerOutcome 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: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
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 required integer (int32) Merchants successfully billed in this reseller's run.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
failureCount required integer (int32) Merchants that failed in this reseller's run.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.
totalBilledAmount required number (double) Total amount billed in this reseller's run.
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This body has no documented fields.

isInProgress required boolean True while the batch is non-terminal (Pending or Running). read only
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

204 No batch existed to clear.

Body: Each item has these fields.

Field Type Description

This response has no body.

403 Forbidden

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

401 Unauthorized

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

400 Bad Request

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

404 Not Found

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

501 Not Implemented

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

500 Internal Server Error

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

default The request failed. The body carries the standard error envelope: a machine-readable `error.code`, a human-readable `error.message`, and `error.validationErrors` when the failure was a validation rejection. The error reference lists the values `error.code` can take. The request failed. The body carries the standard error envelope: a machine-readable `error.code`, a human-readable `error.message`, and `error.validationErrors` when the failure was a validation rejection. The error reference lists the values `error.code` can take.

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

429 The request was refused because a rate limit was exceeded, or because something a later retry can clear stopped it. A rate limit refusal carries an `application/problem+json` body: wait at least the interval `Retry-After` names before retrying, then back off. Limits are tuned per deployment, so read the allowance from the response headers rather than assuming a fixed ceiling. Any other refusal carries the standard error envelope as `application/json`, and its `error.code` names the cause.

Body: RemoteServiceErrorResponse RemoteServiceErrorResponse Each item has these fields.

Field Type Description
error required RemoteServiceErrorInfo RemoteServiceErrorInfo
Values: Values combine: send one or more member names separated by a comma and a space, or the integer sum of their values. Responses carry the names.

This response has no documented body fields.

Errors

A failed request returns the platform error envelope. The error reference lists every value error.code can carry and shows the four response shapes.

Codes declared by Merchant Billing

Authentication

    Reconnecting to the server

    Could not reconnect

    This session has ended

    Attempt 1

    Your work on this page is still here. Retrying keeps it; reloading starts the page again.

    The server no longer holds this page's state, so it has to be loaded again.