Preview OCS Invoice

The PreviewOcsInvoice API is used to create a document of type 'OCS Invoice' in preview mode in OCS.io.

API Overview

Fields Required for Previewing OCS Invoice

The following table lists and describes the fields required to preview an OCS invoice through the PreviewOcsInvoice API:

Field Description

account

ID (Ref ID/ External ID) of the Account.

invoiceType

Type of the Invoice. If not provided, default is generated.

billCycleType

Type of the Billing Cycle. Allowed values:

  • PERIODICAL

  • INITIAL

  • ADJUSTMENT

  • FINAL

billingPeriodStartDate

Start Date of the Billing Period (truncated time). If not provided, Invoice Preview will be generated for current Billing Cycle.

compact

Indicates whether Invoice is generated in Compact mode.

itemizedBill

Indicates whether Invoice is generated including Itemized Bill.

Detailed API documentation and endpoint specifics are available here.

Request Validations

The following validations are performed when previewing an OCS invoice:

  • Account must be provided in the request, it must be already created in the system and must not be in Deactivated State.

  • Payer must be already created in the system.

Preview OCS Invoice Example

Use the following request’s body to preview an OCS invoice:

{
  "requestId": "{{$guid}}",
  "account": {
    "externalId": "account_external_id"
  },
  "invoiceType": "ocsInvoice",
  "billCycleType": "PERIODICAL",
  "billingPeriodStartDate": "2024-09-01T00:00:00Z",
  "compact": true,
  "itemizedBill": true
}

The outcome of the API call is as follows:

  • It is validated that the account with External ID account_external_id exists.

  • The invoice preview is generated as per the provided values.