Example: Preview a policy issuance

Before issuing a policy, you can see how the charges in the policy will be sliced into invoice items. You can do this by previewing the issuance.

Cloud API allows you to preview a policy issuance by POSTing an issuance object using the following endpoint:
  • POST /billing/v1/accounts/{accountId}/issuance-preview

This endpoint functions the same as the POST /issuances endpoint, except no data from the POST is persisted to the database. The endpoint returns an array of preview invoice items.

Example issuance preview

This example demonstrates previewing a policy with one $1000 premium charge and one $50 tax charge. The payment plan is 30% down with three max installments.

Command

POST /billing/v1/accounts/bc:122/issuance-preview

Request body

{
  "data": {
    "attributes": {
      "charges": [
        {
          "amount": {
            "amount": "1000",
            "currency": "USD"
          },
          "chargePattern": {
            "id": "default_data:1",
            "displayName": "Premium"
          }
        },
        {
          "amount": {
            "amount": "50",
            "currency": "USD"
          },
          "chargePattern": {
            "id": "default_data:6",
            "displayName": "Taxes"
          }
        }
      ],
      "paymentPlan": {
        "id": "quarterly-30-percent-down-3-max-installments_pmntplan"
      },
      "policy": {},
      "policyPeriod": {
        "effectiveDate": "2025-08-01",
        "expirationDate": "2026-08-01",
        "policyNumber": "PA-234553"
      }
    }
  }
}

In the response, there are 5 items included in the previewItems array.

  • One $300 down payment item
  • Three $233.34 installment premium items
  • One $50 one-time tax item

The response looks like this:

Response

{
  "data": {
    "attributes": {
      "previewItems": [
        {
          "amount": {
            "amount": "300.00",
            "currency": "usd"
          },
          "category": {
            "code": "premium",
            "name": "Premium"
          },
          "eventDate": "2025-09-01",
          "invoiceStream": {
            "displayName": "Monthly",
            "id": "bc:SmxgIR9gUrYvW6kXzCcpi",
            "type": "AccountInvoiceStream",
            "uri": "/billing/v1/accounts/bc:122/invoice-streams/bc:SmxgIR9gUrYvW6kXzCcpi"
          },
          "paidAmount": {
            "amount": "0.00",
            "currency": "usd"
          },
          "payerAccount": {
            "displayName": "Standard Account",
            "id": "bc:SSceTURXnhwJyKaDm_ZNX",
            "type": "Account",
            "uri": "/billing/v1/accounts/bc:122"
          },
          "paymentDueDate": "2025-09-22",
          "type": {
            "code": "deposit",
            "name": "Down Payment"
          }
        },
        {
          "amount": {
            "amount": "50.00",
            "currency": "usd"
          },
          "category": {
            "code": "tax",
            "name": "Tax"
          },
          "eventDate": "2025-09-01",
          "invoiceStream": {
            "displayName": "Monthly",
            "id": "bc:SmxgIR9gUrYvW6kXzCcpi",
            "type": "AccountInvoiceStream",
            "uri": "/billing/v1/accounts/bc:122/invoice-streams/bc:SmxgIR9gUrYvW6kXzCcpi"
          },
          "paidAmount": {
            "amount": "0.00",
            "currency": "usd"
          },
          "payerAccount": {
            "displayName": "Standard Account",
            "id": "bc:SSceTURXnhwJyKaDm_ZNX",
            "type": "Account",
            "uri": "/billing/v1/accounts/bc:122"
          },
          "paymentDueDate": "2025-09-22",
          "type": {
            "code": "onetime",
            "name": "One-Time"
          }
        },
        {
          "amount": {
            "amount": "233.34",
            "currency": "usd"
          },
          "category": {
            "code": "premium",
            "name": "Premium"
          },
          "eventDate": "2025-11-01",
          "invoiceStream": {
            "displayName": "Monthly",
            "id": "bc:SmxgIR9gUrYvW6kXzCcpi",
            "type": "AccountInvoiceStream",
            "uri": "/billing/v1/accounts/bc:122/invoice-streams/bc:SmxgIR9gUrYvW6kXzCcpi"
          },
          "paidAmount": {
            "amount": "0.00",
            "currency": "usd"
          },
          "payerAccount": {
            "displayName": "Standard Account",
            "id": "bc:SSceTURXnhwJyKaDm_ZNX",
            "type": "Account",
            "uri": "/billing/v1/accounts/bc:122"
          },
          "paymentDueDate": "2025-11-22",
          "type": {
            "code": "installment",
            "name": "Installment"
          }
        },
        {
          "amount": {
            "amount": "233.33",
            "currency": "usd"
          },
          "category": {
            "code": "premium",
            "name": "Premium"
          },
...
        },
        {
          "amount": {
            "amount": "233.33",
            "currency": "usd"
          },
          "category": {
            "code": "premium",
            "name": "Premium"
          },
...
        }
      ]
    }
  }
}