Instant charges in Sequence allow you to charge your customers instantly for each usage event, instead of accumulating charges over the whole billing period. Instant charges are excluded from invoices, and are tracked in a separate statement instead. This is particularly useful for FinTech companies that deduct a percentage fee from each transaction processed, directly at the point of transaction.

To use instant charges:

  • Add a product with a linear pricing model to your billing schedule
  • Choose a usage metric
  • Select a percentage or unit charge
  • Select the charge instantly option
  • Optionally, specify whether you want instant charges to include discounts and taxes

Instant charge prices will be skipped by Sequence when generating invoices. Instead, charges are calculated in real-time for each individual usage event. To calculate the instant charge for a usage event, submit the event to the api/usage-event-for-instant-charges endpoint. The API call looks the same as sending a standard usage event:

curl --request POST \
     --url https://eu.sequencehq.com/api/usage-event-for-instant-charges \
     --header 'Authorization: your_token' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "eventType": "transaction",
  "customerAlias": "018bcd91-3d7f-7a5e-8977-faf184e6cf7d",
  "eventTimestamp": "2023-10-08T23:00:00Z",
  "customerEventId": "event-id-H4twuTWpYx1rkd8OMTki2hTUcZ",
  "eventProperties": {
    "amount": 1000,
    "currency": "GBP",
    "method": "bank_transfer"
  }
}

but in this case the response will include the instant charge associated with the event:

{
    "usageEvent": {
        "id": "018bcdad-ef55-7249-b836-9ae9ec52a9c8",
        "customerEventId": "018bcdad-ef55-7249-b836-9ae9ec52a9c8",
        "customerAlias": "018bcd91-3d7f-7a5e-8977-faf184e6cf7d",
        "eventType": "transaction",
        "sequenceAccountId": "018bcd7b-b141-73f4-8702-dce6b39d8355",
        "eventTimestamp": "2023-10-08T23:00:00Z",
        "eventProperties": {
            "amount": "1000.0",
            "currency": "GBP",
            "method": "bank_transfer"
        }
    },
    "instantCharges": [
        {
            "usageMetricId": "018bcd92-285a-79d9-899a-fa69e44c8518",
            "amount": "1000.0",
            "priceId": "018bcd92-3a89-7b36-8e36-565d01903823",
            "charge": 100.0
        }
    ]
}

The charge is calculated on the fly based on the transaction amount and the specific pricing configuration for the corresponding customer, e.g. their percentage fee and discount.

Unlike standard usage events, usage events for instant charges need to pass certain validation criteria in order for the charge to be well-defined:

  • The customer alias must be linked to an existing customer in Sequence
  • The linked customer must have an active billing schedule containing at least one instant charges price
  • The event type and properties must match a usage metric associated with an instant charge price

In particular, you should only submit events for instant charges after creating the corresponding price and adding it to a billing schedule in Sequence.

The event is ingested as normal into Sequence, and it will appear in the usage events table in the Sequence dashboard. However, the corresponding instant charges will not appear on invoices, but in the instant charges statement at the end of each billing period.

Estimated charges

In some scenarios you may want to calculate the charge associated with an event, but not ingest the event into Sequence. For example, this is useful to display a transaction fee to your customer before the transaction is processed. To achieve this, use the estimated charges endpoint: this behaves the same as api/usage-event-for-instant-charges, except that in this case the event will not be ingested in Sequence, and will not appear in the instant charges statement.