Prepaid Payment Risk Pack Reference
The prepaid-payment-risk pack (v1) is an Enterprise add-on for self-hosted Enterprise deployments. It applies on the Decision API (POST /api/v1/decide) only; Hosted is out of scope for v1, and the pack name refuses boot on a Community build.
What it does
A prepaid-wallet payment service asks AxonFlow for a decision before a top-up, a card authorization, a refund or a balance correction, and reports the payment's outcome afterwards. Each request carries one typed event in context.prepaid_payment. The pack turns the event, and the thresholds an operator reviewed for that organization and tenant, into a decision on the existing wire: allow, deny or needs_approval.
- It moves no money. AxonFlow decides and records. It never initiates a top-up, a capture, a refund or a balance correction, and this pack calls no action gateway. The customer's payment system executes or cancels the action and keeps final authority.
- It cannot prevent a duplicate payment by itself. A duplicate request returns the same decision. The customer still enforces idempotency at its own payment execution boundary.
- The rules are explainable first-pass rules, not a model. Every rule compares a fact the caller supplies against a threshold the operator set.
Targets
The pack decides for one tool server, prepaid-payments, with one tool per event type:
| Tool | Event type | Decided as |
|---|---|---|
prepaid-payments.authorize_top_up | top_up_attempt | by the rules |
prepaid-payments.authorize_card | card_authorization | by the rules |
prepaid-payments.request_refund | refund_request | by the rules |
prepaid-payments.correct_balance | balance_correction | by the rules |
prepaid-payments.record_payment_outcome | payment_outcome | always allowed once well formed |
A covered decision needs the exact server and tool, byte for byte. For an activated tenant, a near miss (a server or tool that normalizes to one of these, for example Prepaid-Payments) is held for review, never decided as if the pack were absent. A request that declares the event on any other target is held as well.
The rules
| Rule | Fires when | Effect |
|---|---|---|
| Restricted geography | the event country is in the profile's restricted_countries | refuse |
| Failed attempts | the failed-attempt count reaches the refuse threshold | refuse |
| Failed attempts | the failed-attempt count reaches the step-up threshold | step-up |
| Cross-border | the event country differs from the home region | step-up |
| Velocity | the velocity count is above the profile's maximum | step-up |
| Cross-border with velocity | both of the above | hold |
| New device, new instrument | the caller says so | step-up |
| Amount change | the amount exceeds the prior amount by the profile's percentage | step-up |
| Identity mismatch | identity_match is mismatch | hold |
| Overlap, stated | a refund or correction references an earlier refund, chargeback or correction | hold |
| Overlap, recorded | the pack's own record already has another live or executed refund or correction of the same original payment | hold |
| Adverse prior event | a top-up or card authorization references an earlier refund or chargeback | hold |
A fact that is absent, unknown or not complete holds; a value of the wrong type or outside the contract is refused. One disposition per decision, in this order: refuse, then hold, then step-up, then allow. A step-up is a deny naming prepaid_risk_step_up_required; a hold is needs_approval with a pending approval. The pack keeps no counters: velocity, failed attempts and newness are the caller's own aggregates.
Step-up. The customer's own challenge service challenges the customer. AxonFlow does not send, receive or check a passcode, and ships no challenge service. The enforcement point retries the same action as a new event with the verifier's outcome, which AxonFlow records as relied on and does not check. A verification discharges only the reasons its step-up named, admits one retry, and lifts no hold or refusal.
Who approves a hold. The pack's approver pool is prepaid-payment-risk-reviewers, quorum 1. Until an organization owner binds it to a directory group, a hold's pending_approval.approver_pools reports approver_pool_unbound and every review is refused. See Pack Approvers. An approval releases exactly the held request: the retry names the approval id and repeats the request unchanged.
The operator guide in the Enterprise source tree (technical-docs/PREPAID_PAYMENT_RISK_PACK_OPERATOR_GUIDE.md) gives the field table, the challenge-reference and action-digest forms, and the duplicate rules in full.
Enabling it
Before you activate it:
- Decide which organization and tenants the pack covers. Activation is per tenant, by exact name.
- Set every threshold in the profile with the customer's payment risk owner. The example values are placeholders for a demonstration, not recommendations.
- Name the person who reviewed the thresholds, the review date and its expiry.
- Bind the pack's approver pool to a directory group. Until it is bound, nobody can release a hold.
- Confirm the enforcement point sends references only. A card number, an email address, a phone number, a name or a passcode has no field it could be sent in.
Then set, on the agent:
AXONFLOW_POLICY_PACKS=prepaid-payment-risk
AXONFLOW_PREPAID_PAYMENT_RISK_EXPECTED_VERSION=1
AXONFLOW_PREPAID_PAYMENT_RISK_PROFILE_FILE=/etc/axonflow/prepaid-payment-risk-profile.json
- The agent refuses to start without the version pin, without the profile, with an invalid profile, or when the pack cannot be instantiated. Every required threshold must be present; an absent one is refused at boot, never read as zero.
- A profile reviewed against another pack version, or past its
review_expires_on, holds every decision until it is reviewed again. - Rollback: remove the pack from
AXONFLOW_POLICY_PACKSand restart. Every request is then decided as if the pack were never installed. Stored decisions stay in the table.
A step-up and a refusal are deny verdicts, and the platform counts a client's policy denies toward that client's circuit breaker. By default, 20 pack denies from one client within 5 minutes open its breaker, and while it is open every decide call from that client is answered 503, allows included. A hold does not count. Set AXONFLOW_CB_POLICY_VIOLATION_THRESHOLD on the agent, or the tenant's own threshold through the circuit breaker configuration API, to a value sized for the expected step-up and refusal rate.
What it records
Migration enterprise/172 creates prepaid_payment_decisions, one row per event keyed by organization, tenant and idempotency key, under forced row-level security. A row holds the stable decision id, digests of the request and action, the event type and the pack's own disposition, the control ids and reason codes, the pack and profile digests, opaque customer, instrument and device references, prior-event references, the accepted challenge, the original payment a refund names, the decision time and expiry, and the recorded payment outcome.
No amount, currency, country, count, caller-stated timestamp, channel, source system or passcode is stored. The application role may insert and read rows and update only the three outcome columns; a trigger allows an update to record an outcome once and nothing else. The table's owner and a superuser can still delete rows or disable the trigger, so protect the owner role as you protect the database. The Decision API's audit row names the pack and its controls and does not store the event; the approval queue row carries a digest of the held request, not the request.
If the decision store is unavailable, a storable covered request is answered 503, because a duplicate could not be told from a new request.
Limits
The pack's own statements, quoted from its sources:
The rules are explainable first-pass rules over facts the caller supplies. They are not a trained model, the pack states no detection rate, and installing it makes no deployment compliant with any law or scheme rule.
The rules are explainable first-pass rules, not a model. Every rule compares a fact the caller supplies against a threshold the operator set. Nothing here is trained, and the pack states no detection rate, no false-positive rate and no accuracy figure.
It is not a compliance statement. Installing it does not make a deployment compliant with any law, regulation or scheme rule. The policy category the controls carry is named
compliance-prepaid-riskbecause that is the category family the Decision API admits pack controls under; the name claims nothing.
A synthetic demonstration is not a production gate. Production use needs the customer's real event and payment-authority map, representative transactions and labels, a shadow period, agreed false-positive and latency targets, monitoring and a rollback plan.
Scope of v1:
- Decision API only. The MCP planes, the gateway and proxy request planes, the orchestrator and the AuthZEN adapter are not covered.
- Rules over the caller's aggregates. The one thing the pack reads from its own record is whether an original payment already has a refund or correction, and it compares that original payment reference as text: use one canonical reference per payment.
- No challenge service. The customer supplies the challenge and its verifier.
- Cases are the approval queue row plus the decision row; there is no separate case table, and the two rows share no column.
- A duplicate between an approval being spent and the outcome being recorded can open a second approval for the same decision. The enforcement point must de-duplicate by its own idempotency key, and should report outcomes promptly.
- The
payment-exceptionandsupport-refundmodules keep their own targets. This pack flags an overlapping refund; approving the execution of a refund stays with thesupport-refundmodule on its own target.
