Skip to main content

What it is

When the network is down, a device cannot ask your systems whether to accept an operation. The offline policy is how your organisation answers that question in advance: your own limits, which every device keeps and applies on its own, with no network. wede never sets a limit. You write the rules, wede carries them to your devices and checks afterwards that every device followed them. There is no limit of time without network. A device keeps working with the policy it has for as long as the network is down, whether that is a few minutes or several weeks. A policy never expires; it is only replaced by a newer version. Without a policy, nothing changes: devices accept every operation without network, as before.

The rules

One rule per operation type and currency: An example: payments up to 50.00 EUR each, and at most 200.00 EUR or 10 payments per device until it syncs again.
An operation without a rule for its type and currency, or without an amount, goes ahead. The amount is read from the payload exactly as wede reads it everywhere else: amount_minor, or amount in the decimals of its currency, with currency. The cumulative of a device starts again from zero once everything it captured has reached wede.

On the device

From version 2.9.0, the wede SDKs fetch the policy in use after every sync with network and keep it on the device. Each operation captured without network is decided on the device before it is kept:
  • allowed: the operation is queued and syncs as usual, with the decision and the version of the policy it was decided under;
  • refused: nothing is queued, and your app receives WedePolicyDeclined with the rule that refused it (max_amount, cumulative_amount or cumulative_count), so it can tell the user.
A device installed and used for the first time with no network has never received the policy. Your organisation chooses what it does then, with the SDK option whenNoPolicy (when_no_policy in Python): allow (default) lets operations go ahead, as before; decline refuses every operation with an amount and a currency until the policy arrives. See SDKs.

What wede checks

When the operations reach wede, wede checks every decision against the same rules. An operation that does not match is marked, never refused: it is kept like any other, and you decide what to do with it. Operations captured by an SDK earlier than 2.9.0 carry no decision and are not checked. In the dashboard, Offline policy shows the decisions that did not match, in production or in the sandbox, with a count for each reason. With the API, use GET /v1/policies/decisions.

Versions

A version never changes once saved. A new version takes the next number; one version is in use at a time, and devices receive it at their next sync. Archiving the version in use turns the policy off, and devices stop applying limits once they sync. Nothing is deleted, and every change is recorded in the audit log. Each version has a sha256, computed on its document in canonical JSON (object keys sorted at every level, no spaces), the same way as the seal of the proof kit. The SDKs keep a policy only when its sha256 matches.

Who can use it

The policy belongs to your organisation. Administrators and technical staff write it, choose the version in use and read the decisions, in the dashboard or with an API key. Devices read the version in use with the credential they sync with.