Invoicing and Payment Schedules

Overview

Note

The scheduling of invoices is controlled by the Payment Schedule Plugin. See Legacy Invoice Scheduling below for details on how Socotra works if the payment schedule plugin is not implemented.

The payment schedule name is set on new policies on creation, either in the UI or when calling the Create Policy endpoint by including the paymentScheduleName in the PolicyCreateRequest4. If not included, the payment schedule will use the default, as described below.

The payment schedule name (along with other data) is provided to the payment schedule plugin which then determines how to interpret and implement the schedule.

Manual Schedule Changes

Along with the ability to control the behavior of a payment schedule, the payment schedule plugin can change an existing policy’s payment schedule from one schedule to another. This affects only future invoices; already-generated invoices will not be affected. To change a policy’s payment schedule, use the following endpoint:

Change Payment Schedule

POST /policy/{policyLocator}/paymentSchedule
  • Request:

    Name

    Position

    Type

    Required

    paymentScheduleChangeRequest

    body

    PaymentScheduleChangeRequest

    required

    policyLocator

    path

    string

    required

  • Response:void

PaymentScheduleChangeRequest

{
  // Required
  newPaymentScheduleName : string
}

Note

The new payment schedule will be persisted on the policy, and future transactions will be invoiced with the new schedule.

Note

Manually changing the payment schedule requires use of the payment schedule plugin.

Payment Schedule Changes with Endorsements and Renewals

Sometimes policy pricing is dependant on the policy’s payment schedule. For example, you may charge a slightly higher premium for monthly schedules vs. those that are paid up front. For these cases, a payment schedule change must be accompanied by an endorsement in order to trigger the price change.

The payment schedule change operation can be combined with the endorsement or renewal operation to prevent scheduling invoices twice, which could cause problems if any invoices in the first set are issued before they can be rescheduled.

Set the newPaymentScheduleName property on the endorsement or renewal to have the schedule change take place within the policy transaction.

When the Endorsement or Renewal becomes accepted, the new payment schedule is used to generate invoices.

When the Endorsement or Renewal becomes issued, the new payment schedule is persisted on the policy itself and used for all invoice scheduling thereafter.

Note

The policy only has one payment schedule at a time. If an out of sequence transaction is executed, there will be no attempt to resolve what the payment schedule was at the time of the first transaction.

Note

Changing payment schedules in conjunction with an endorsement or renewal requires use of the Payment Schedule Plugin. Please enable it before using this feature.

Payments

A payment object marks an invoice as paid and stores data about the payment. Data fields may be configured on payments, except the Group and Lookup field types.

Note

Socotra does not support partial payment or cash allocation.

Configuration

Payment schedules and terms are defined in policy/policy.json. The contents of invoices are generated automatically. The data to be stored on payments is defined in /payment/payment.json.

Policy Configuration

Add defaultPaymentTerms and paymentSchedules to policy.json, as follows.

  • Both paymentSchedules and defaultPaymentTerms must be in the configuration.

  • Each configured payment schedule option will be available in a dropdown when creating a policy in the Socotra UI.

  • The first payment schedule in the list will be the default.

  • defaultPaymentTerms determines how long before the due date the system will issue the invoice.

{
  "fields": [ ],
  "documents": [ ],
  "defaultPaymentTerms": {
    "amount": 7,
    "unit": "day"
  },
  "paymentSchedules": [
    {
      "type": "total",
      "name": "upfront",
      "displayName": "Up Front"
    },
    {
      "type": "monthly",
      "name": "monthly",
      "displayName": "Monthly"
    },
    ,
    {
      "type": "every_two_weeks",
      "name": "every_two_weeks",
      "displayName": "Biweekly"
    }
  ]
}

Payment Configuration

The file payment.json contains payment configuration. The only configuration for payments is what fields should be saved on them. For the available data types, see Fields. The Group and Lookup field types are not available on payments.

{
  "fields": [
    {
      "name": "payment_ref",
      "title": "Payment reference number",
      "type": "string"
    }
  ]
}

Invoice Templates

When Socotra issues an invoice, it renders the document template policy/invoice.template.liquid. This template has access to the same data available to other Document Templates, as well as data.invoice_financials:

data.invoice_financials: {
    "total_due": number,
    "total_due_currency": string
    "gross_premium": number,
    "gross_premium_currency": string,
    "gross_taxes": number,
    "gross_taxes_currency": string
    "gross_fees": number,
    "gross_fees_currency": string,
    "fees": [
        {
            "name": string,
            "display_name": string,
            "amount": number,
            "amount_currency": string,
            "description": string
        }
    ],
    "tax_groups": [
        {
            "name": string,
            "display_name": string,
            "amount": number,
            "amount_currency": string
        }
    ],
    "financial_transactions": [
        {
            "amount": number,
            "amount_currency": string,
            "posted_timestamp": long,
            "policy_modification_locator": string,
            "policy_modification_name": string,
            "type": "premium" | "tax" | "fee",
            "peril_locator": string,
            "peril_name": string,
            "peril_display_name": string,
            "tax_locator": string,
            "tax_name": string,
            "tax_display_name": string,
            "fee_locator": string,
            "fee_name": string,
            "fee_display_name": string
        }
    ]
}

Invoice Rendering

For policy issuance, the first invoice may be rendered either when the governing quote is accepted or the policy is issued. This is controlled with the generatingEvent property in policy.json. See the quotes documentation for details.

For endorsements, renewals, cancellations, and reinstatements, invoices are rendered when the associated transaction reaches accepted state.

For premium reports, invoices are rendered when the premium report is issued.

Legacy Invoice Scheduling

Invoices are normally scheduled with the Payment Schedule Plugin. If the plugin is not implemented, Socotra will fall back to legacy behavior as desribed here.

Socotra supports the following payment schedules:

  • total

  • monthly

  • annually

  • semiannually

  • quarterly

  • every_two_weeks

  • every_week

Billing Periods

Billing periods start on the start date of the policy, and stay on the same date of each month (except for the week-based schedules). Invoices become due at the start of the billing period.

The first invoice is issued immediately, and subsequent invoices are issued before the due date according the configured payment terms. Endorsements, cancellations, and withdrawal trigger also immediate invoice issuance.

Invoices

Installments have equal amounts where possible, except for partial periods at the end of the term. Charges are split equally among billing periods, with straight-line, to-the-millisecond proration for partial periods. See also Premium allocation documentation.

Rounding errors are collected on the last invoice for a period of coverage. If the policy duration is not a whole number of months (for example, a policy that runs 2020-01-01 to 2020-06-17), the last billing period will be for less coverage and therefore be for less than the other invoices.

Fees are split evenly across invoices the same manner as premiums.

Backdated Policy Invoicing

When creating a policy with an effective date in the past, multiple invoices may be generated. For example, a monthly invoiced policy created with an effective date three months ago will have four invoices created instead of just one.

Note

When multiple invoices are to be created, only the first will be guaranteed to be generated synchronously in the finalize or issue request. Others will be generated after a few minutes.