Dry Run ignores account Billing Cycle Day (BCD) and uses startDate as period anchor, producing incorrect proration

4 views
Skip to first unread message

Julia Nunes

unread,
May 15, 2026, 1:47:34 PM (2 days ago) May 15
to Kill Bill users mailing-list

Summary: When calling POST /1.0/kb/invoices/dryRun with dryRunType: SUBSCRIPTION_ACTION and dryRunAction: START_BILLING, KillBill calculates the invoice item period starting from the startDate instead of aligning to the account's configured Billing Cycle Day (BCD). The real billing engine aligns correctly to the BCD — the dry run does not replicate this behavior, producing an incorrect prorated amount.

Expected: Period from 2026-05-15 to the next BCD date (e.g. 2026-05-20 if BCD = 20), prorated accordingly. Actual: Period returned is 2026-05-15 → 2026-06-14 (startDate + 30 days), BCD is completely ignored. Amount: 12,765 CLP instead of the correct prorated value.

Account ID: 41f01d55-82d8-4314-999a-1cdf74ab09d3 Bundle ID: 93f8fbac-2ca5-4dbc-a79f-1735aa4e96e7 Product: CDFHD_Chile_001 (ADD_ON) | Billing policy: IMMEDIATE | Env: bss-prd.directvgo.com

Root cause hypothesis: The dry run path does not read the account BCD when computing the cycle anchor — it falls back to startDate directly, bypassing the BCD alignment logic used in the actual invoicing engine.

Impact: Checkout flows that rely on dry run for billing preview show an incorrect amount to the customer, creating a discrepancy with what is actually charged.



curl --location 'https://killbill.bss-prd.directvgo.com/1.0/kb/invoices/dryRun?accountId=41f01d55-82d8-4314-999a-1cdf74ab09d3' \
--header 'X-Killbill-CreatedBy: <string>' \
--header 'X-Killbill-Reason: <string>' \
--header 'X-Killbill-Comment: <string>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic bWlkZGxld2FyZS5jbDoyOy0nMzkjc35CR0EqX2hHLikwaw==' \
--data '{
  "dryRunType": "SUBSCRIPTION_ACTION",
  "dryRunAction": "START_BILLING",
  "phaseType": "EVERGREEN",
  "bundleId":"93f8fbac-2ca5-4dbc-a79f-1735aa4e96e7",
  "billingPeriod": "MONTHLY",
  "productName": "CDFHD_Chile_001",
  "productCategory": "ADD_ON",
  "billingPolicy": "IMMEDIATE",
    "priceOverrides": [
        {
        "phaseType": "EVERGREEN",
        "recurringPrice": 13190
        }
    ]  
}'


{
    "amount": 12765,
    "currency": "CLP",
    "status": "COMMITTED",
    "creditAdj": 0,
    "refundAdj": 0,
    "invoiceId": "b43e6f82-a263-4a88-bac8-cb74857996e6",
    "invoiceDate": "2026-05-15",
    "targetDate": "2026-05-15",
    "invoiceNumber": null,
    "balance": 12765,
    "accountId": "41f01d55-82d8-4314-999a-1cdf74ab09d3",
    "bundleKeys": null,
    "credits": null,
    "items": [
        {
            "invoiceItemId": "c41eb4fa-f2b7-42b5-9921-7089bcf822db",
            "invoiceId": "b43e6f82-a263-4a88-bac8-cb74857996e6",
            "linkedInvoiceItemId": null,
            "accountId": "41f01d55-82d8-4314-999a-1cdf74ab09d3",
            "childAccountId": null,
            "bundleId": "93f8fbac-2ca5-4dbc-a79f-1735aa4e96e7",
            "subscriptionId": "849d4ebd-25ed-4b33-aaff-36521ad6fc72",
            "productName": "CDFHD_Chile_001",
            "planName": "PL_CDFHD_Chile_001-dryrun-1024",
            "phaseName": "PL_CDFHD_Chile_001-dryrun-1024-evergreen",
            "usageName": null,
            "prettyProductName": null,
            "prettyPlanName": null,
            "prettyPhaseName": null,
            "prettyUsageName": null,
            "itemType": "RECURRING",
            "description": "PL_CDFHD_Chile_001-dryrun-1024-evergreen",
            "startDate": "2026-05-15",
            "endDate": "2026-06-14",
            "amount": 12765,
            "rate": 13190,
            "currency": "CLP",
            "quantity": null,
            "itemDetails": null,
            "catalogEffectiveDate": "2026-05-14T15:11:21.000Z",
            "childItems": null,
            "auditLogs": []
        }
    ],
    "trackingIds": [],
    "isParentInvoice": false,
    "parentInvoiceId": null,
    "parentAccountId": null,
    "auditLogs": []
}



Reply all
Reply to author
Forward
0 new messages