Skip to content

SpeculaPro

Network → SpeculaPro is the link to SpeculaPro, the AML and fraud monitor (docs.speculapro.com). “PaySigna sends its live merchants and every live payment once final; SpeculaPro’s rules raise alerts and cases, worked in SpeculaPro.”

Needs risk.read to see and risk.write to change anything. The console never holds a SpeculaPro key: the keys are sealed on the gateway.

Six parts:

  • The monitoring feed. PaySigna tells SpeculaPro about merchants and finished live payments. It touches no money path, so nothing in it can slow or refuse a payment.
  • What SpeculaPro tells us. Signed webhooks. A confirmed sanctions match holds the merchant’s money out straight away.
  • Payout decisions. When switched on, each live payout is checked with SpeculaPro before it’s written. It can go ahead, be refused, or be held in Risk review. See Payout decisions.
  • Collection decisions. A separate switch. When on, each live collection is checked with SpeculaPro before the payer is asked to pay. It can go ahead, be refused, or be collected with the money held from the merchant until staff release it. See Collection decisions.
  • KYC screening. When switched on, each KYC submission’s business, owners and directors are screened against SpeculaPro’s sanctions and PEP lists, and the answer becomes the submission’s sanctions and PEP checks. See KYC screening.
  • Account events. Sign-ins, failed passwords, changed emails, passwords and authenticators, and new payout accounts, sent with the feed for SpeculaPro’s fraud rules. See Account events.

Erasures completed in PaySigna have to be registered in SpeculaPro by hand. See Erasures to register in SpeculaPro.

SpeculaPro runs in the same cluster. The gateway reaches it on internal addresses; webhooks still come in through api.paysigna.com, because SpeculaPro won’t send to a private address.

PaySigna is one SpeculaPro workspace (kind psp, currency GHS).

SpeculaPro PaySigna Keyed on
Customer The legal entity. An organisation’s sub-accounts share its KYC, so they are one customer. The KYC owner’s merchant code (the primary account).
Account Each merchant account. Its merchant code.
Transaction A live payment once it reaches a final status. Its reference.
Feedback A payment’s final status, when SpeculaPro already has the payment: one it was asked to decide, or one sent as completed and later reversed. Its reference, or for a decided payment the id it was decided under.

A customer is sent as type business, segment merchant, with:

  • the legal name and, when it differs, the trading name;
  • country, contact email and phone, city, region and postcode;
  • industry, MCC and registration number;
  • the KYC level and risk rating (unrated if there isn’t one);
  • the legal form: individual and sole proprietorship → sole_proprietorship, limited liability → private_limited, partnership, NGO and government as themselves, anything else other;
  • owners and directors as related parties: name, date of birth, nationality, phone, role (UBO → beneficial_owner) and ownership share. Owners whose data was erased are left out.

Its status is restricted while suspended, exited once terminated, otherwise active.

An account is type merchant, in its settlement currency. Opened is when it went live, closed is when it was terminated. Its status is frozen while suspended, closed once terminated, otherwise active.

A transaction:

PaySigna SpeculaPro
A collection in, payment
A refund (it has a parent) out, refund, with the original’s reference
A settlement payout out, withdrawal
Any other payout out, transfer
Mobile money, bank momo, bank_transfer (card, USSD and cash as themselves)
Succeeded, refunded, partially refunded completed
Failed, expired, cancelled failed
Reversed reversed

It carries the gross amount, the description and the IP address the request came from, and the payer or recipient as the counterparty: name and number, the network (MTN → mtn_momo, Telecel → telecel_cash, AirtelTigo → at_money) or the bank’s code in lower case. A card number is never sent, not even masked. No counterparty country is sent.

Off when installed. With it off nothing is queued at all, so turning it on starts from that moment. “Only changes from the moment it is on. Queue history below.”

Once on, the database queues:

  • a transaction when a live payment first reaches a final status. A SpeculaPro transaction can’t be changed afterwards, so a later succeeded → reversed goes as feedback. A payout or collection SpeculaPro answered a decision for is already in SpeculaPro, so its final status goes as feedback instead (completed, failed, reversed or cancelled). One it didn’t answer is sent in full, like any other payment;
  • an account when a live merchant account, its KYC profile or its owners change;
  • the customer at the same time, once any of its accounts is live.

The queue holds one waiting row per subject. A merchant edited ten times before the worker runs is sent once, as it stands then. Every way a payment can finish, and every way a merchant can change, is covered, because the database does the queueing rather than the code that made the change.

The gateway worker’s speculapro-sync job runs every 10 seconds, 200 rows at a time. It sends customers first, then accounts, then transactions, then feedback, so a payment never arrives before the account it names.

Every send can be repeated safely: SpeculaPro answers a resent payment duplicate and an unchanged merchant stale, and both count as sent.

SpeculaPro’s answer What happens
Accepted, duplicate, stale, recorded Sent.
Retry, too many requests, a server error, unreachable Tried again later, waiting 10 seconds at first and up to an hour.
Wrong key or path (401, 403, 404) Kept waiting, tried every 10 minutes, and the worker logs a configuration error. Nothing is lost to a wrong key.
Rejected, or named in a refused batch (422) Needs a person. The rest of that batch is sent again at once.
Feedback for a payment SpeculaPro doesn’t have yet Tried again.

After 25 attempts a row needs a person whatever the reason, so a stuck one shows up instead of retrying for ever. Sent rows are deleted after 14 days.

With the feed on but the gateway missing SPECULAPRO_API_URL or SPECULAPRO_INGEST_KEY, nothing is sent, the queue grows and the worker logs a warning once.

Four tiles:

Tile What it shows
Monitoring feed On or Off, and when the settings last changed.
Waiting to send Rows queued, and how long the oldest has waited.
Need a person Rows SpeculaPro refused or that ran out of attempts. Red when there are any.
Sent, last 14 days “Merchants, accounts, payments and status changes.”

When the feed is on and the oldest row has waited over 15 minutes: The queue is not draining. “Check that the gateway has SPECULAPRO_API_URL and SPECULAPRO_INGEST_KEY set, and that the gateway worker is running; the worker logs the cause.”

Turn on or Turn off, with a reason for the audit log. One person may do it: the feed moves no money.

“Asking SpeculaPro before a live payout is sent. Changes here need a second operator.”

Setting Default What it does
Ask SpeculaPro before each live payout Off Checks each live payout with SpeculaPro before it’s written.
Wait for an answer (ms) 400 100 to 3,000. “Above SpeculaPro’s time budget, 150 ms by default, plus the network.”
If no answer, let through below (GHS) 0 When SpeculaPro doesn’t answer, a payout below this amount goes ahead and is checked afterwards. At or above it, the payout is held for review. “0 holds every unanswered payout for review.” A payout in another currency is always held.

The currency can be changed only through the API (fallback_currency).

Any change here needs Authorised by, a different active operator, and is held until they approve it in Approvals. Raising the amount shows a red warning: “This lets more payouts go ahead without SpeculaPro’s answer while it is unavailable: up to {amount} each, checked only afterwards.” A change reaches every gateway within 30 seconds.

Only live payouts created through the API or the portal. Refunds, withdrawals and settlement payouts aren’t asked about; they go through the feed afterwards. Test payouts are never asked about. It also needs SPECULAPRO_DECIDE_KEY on the gateway; without it nothing is asked, whatever the setting says.

SpeculaPro is asked after PaySigna’s own risk screen, routing and pricing, and before anything is written or reserved.

SpeculaPro answers What happens
Allow Written and sent as usual.
Block Refused with risk_blocked. No payout is written and nothing is reserved. The merchant gets the same neutral refusal as for PaySigna’s own screen, never the rule. The decision itself is kept, with SpeculaPro’s reasons, so the refusal shows in the decision log.
Review or step up Written as under review, with the merchant’s money reserved, and not sent. It waits in Risk review. An answer this release doesn’t recognise is treated the same way.
Nothing (timeout, unreachable, an error, an unreadable answer) The fallback above.

A retried request with the same idempotency key is the same payment to SpeculaPro, so its velocity rules don’t count it twice. Its id is po_ plus a hash of the merchant and the key, or the payment’s reference when there’s no key.

A held payout waits 72 hours for a decision, with the money reserved. In Risk review, Why it is here reads, for example, SpeculaPro: Review 61 with the first rule’s name, and the rules’ explanations on hover. It reads SpeculaPro did not answer when the fallback held it.

  • Released (two people, as for any release): the gateway worker sends it within about 15 seconds, on a fresh route at the price already charged. If no partner can carry it now, it fails and the money goes back to the merchant’s balance.
  • Declined: it becomes cancelled (risk_blocked), and within about 30 seconds the worker returns the reserved money. The merchant gets the payout.failed webhook: “Declined after review. The amount has been returned to your balance.”
  • Not decided within 72 hours: it expires (failure_class timeout), and the worker returns the money in the same step. The merchant gets payout.failed: “Not reviewed in time. The amount has been returned to your balance.” SpeculaPro is told it failed.

“Asking SpeculaPro before a live collection, to protect payers from fraudulent merchants. Its own switch; the wait and the no-answer amount are shared with payouts. Changes need a second operator.”

Off when installed. Turn on or Turn off needs Authorised by, a different active operator, and is held until they approve it in Approvals. It reaches every gateway within 30 seconds. Payout decisions don’t have to be on, but the wait and the fallback amount are set under Payout decisions.

Every live collection: API charges, hosted checkout, billing renewals and collections started from the portal. Test collections are never asked about. As for payouts, it needs SPECULAPRO_DECIDE_KEY on the gateway, and it’s asked after PaySigna’s own risk screen, routing and pricing, before anything is written.

SpeculaPro answers What happens
Allow Collected as usual.
Block Refused with risk_blocked. Nothing is written and the payer is never asked to pay. The merchant gets the same neutral refusal as for PaySigna’s own screen. The decision is kept, with SpeculaPro’s reasons.
Review or step up, or an answer this release doesn’t recognise Collected as usual, but the money is held from the merchant. The payer isn’t kept waiting, because a collection parked for a person would expire first.
Nothing The payout fallback: below If no answer, let through below (in the fallback currency) it’s collected as usual, at or above it, or in another currency, it’s collected with the money held. At 0, every unanswered collection is held.

Each answer adds up to the Wait for an answer time to the collection before the payer is prompted. Its id in SpeculaPro is co_ plus a hash of the merchant and the idempotency key, or the reference when there’s no key.

A held collection succeeds for the payer as usual, and its money lands in the merchant’s pending balance. It stays pending whatever the merchant’s release rule: not on confirmation, not after their hold hours, and not when its partner statement closes. So the merchant can’t withdraw it, and it isn’t settled to them. The portal shows only pending money, not why.

The money is held until a person releases it. There’s no deadline and nothing expires.

“Live collections SpeculaPro answered review on, or that it did not answer at or above the fallback amount. The payer has paid; the merchant cannot withdraw or settle this money until it is released. Release a genuine one. A fraudulent one stays held: refund the payer through the merchant, or escalate.” Oldest first, up to 200.

A collection that failed, expired or was cancelled never took the payer’s money, so it drops off the list. So does a reversed one: the money went back to the payer. One still pending or in progress stays listed, without Release money, until it finishes.

Column What it shows
Collected When it completed (or was created, if it hasn’t yet).
Collection The reference, then the merchant code and name and the payer.
Held The merchant’s net amount.
Why The score and the rules’ names, their explanations on hover. Without a rule, the note, “No rule named” or “SpeculaPro did not answer”.
Release money once the collection has succeeded, or been refunded or partly refunded. While it’s still pending or in progress, its status instead.

Release money opens “Release the money to the merchant”: “…the payer paid and SpeculaPro flagged it. Release only once you are satisfied it is genuine.” It needs risk.write, a Reason of at least 12 characters (“Why this collection is genuine. Goes in the audit log.”), and Authorised by. The button reads Send for approval, and the release waits in Approvals until that operator approves it. While you are the only active operator, you may name yourself. It’s audited as speculapro.collection_funds_released.

Once released, the merchant’s normal release runs:

  • a collection already past its release time becomes available within about a minute;
  • one whose partner statement closed while it was held becomes available within about a minute;
  • one still waiting for its statement waits for it.

The Decisions panel lists the 100 most recent live payouts and collections SpeculaPro was asked about. “For staff only; merchants see a neutral refusal or a held status.” Show filters those 100: All, Went ahead, Held or Refused.

Column What it shows
When When it was asked.
Payment The reference; for a refused payment, which was never written, the merchant’s own reference or “Not written (refused)”. Under it, Payout or Collection, the merchant code and channel.
Amount —
PaySigna What was done: Went ahead, Held for review or Refused. A held collection reads Money held, then Money released.
SpeculaPro Its answer and score, or that it didn’t answer.
Why The first two rules’ names and explanations, all of them on hover. Without a rule, SpeculaPro’s note, the fallback’s reason, or “No rule fired”.

Decisions are kept in PaySigna’s database.

“Each KYC submission’s business, owners and directors screened against SpeculaPro’s sanctions and PEP lists. Runs whether or not the feed is on.” Off when installed; Turn on or Turn off, with a reason, one person.

Once on, every KYC submission is queued for screening as it’s submitted, for the legal entity (the primary account, whose KYC its sub-accounts share). The gateway worker sends the business and its related parties to SpeculaPro, 10 at a time, and records the answer on the KYC review as two checks, a sanctions screening and a PEP screening, from vendor speculapro, with SpeculaPro’s check id as the reference and its full answer kept verbatim.

SpeculaPro reports Sanctions check PEP check
A confirmed sanctions match Fail —
A potential sanctions or watchlist match, or a hit on its exit list Manual review —
A potential PEP — Manual review
It couldn’t screen (no list loaded) Error Error
A reason this release doesn’t recognise Manual review Manual review
List matches without a screening reason Manual review on the PEP check for a PEP match, otherwise on the sanctions check
Refer or reject with no reasons at all Manual review Manual review
Nothing, or only reasons unrelated to the lists (adverse media, identity, rating) Pass Pass

Every reason counts, and the strongest result wins: fail, then manual review, then error, then pass. So a confirmed match is never hidden by another reason in the same answer. Anything this release doesn’t understand needs a person rather than passing. The reason on the check ends with “SpeculaPro outcome: …”.

“A potential match needs a person; it never passes on its own.” Manual review doesn’t satisfy the gate, as for any vendor. A check can be overridden as usual, with a second person.

The checks are for the whole entity, one of each kind, rather than one per person: the gate reads the latest check of each kind, so a clean result for one owner would otherwise hide a match on another.

Turning it off: “New submissions are no longer screened by SpeculaPro. Checks already recorded stay on the KYC review.”

The ingest key needs SpeculaPro’s onboard scope. Without it, the worker logs an error and keeps retrying. An applicant SpeculaPro refuses lands in Sends that need a person.

Screen with SpeculaPro, on the KYC review’s Checks panel, screens again (for example after an owner was added), asking Why for the audit log. “The answer is recorded as new sanctions and PEP checks; earlier checks stay as they were.” It’s attached to the entity’s latest submission. A merchant who resubmits while a screening is still waiting has it moved to the newest submission.

Shown once there is one. “Erasure requests completed in PaySigna about someone whose data was sent to SpeculaPro. SpeculaPro takes these from a person, not the API: register each under Privacy → Data subject requests against the customer shown, then record its number here. SpeculaPro’s retention rules decide what is erased or kept under the AML exemption.”

A task is raised when an erasure request is completed or partly completed, but only if the feed has ever been on. For a request tied to a merchant (directly, through a merchant user, or through the payer’s merchant), a task is raised only if that legal entity has a live account. A payer or end user with no merchant always gets one. Open tasks are listed first.

Column What it shows
Completed When the task was raised.
Request The request’s reference and whose data: a merchant user, a payer, an end user or the merchant.
SpeculaPro customer The customer to register it against, with the account if that’s different. None: a counterparty on transactions when the person was only ever a payer or recipient.
In SpeculaPro Registered as {number} with the note, or Record as registered.

Record as registered needs gdpr.process. It asks for SpeculaPro’s request number (required) and What SpeculaPro decided (“For example: pseudonymised, or kept under the AML exemption until a date.”). It’s audited, and can be recorded once.

For a counterparty there’s no request to register: SpeculaPro holds them only on transactions, not as a customer. Ask SpeculaPro’s privacy owner how those records are handled (usually kept under the AML exemption), then record their reference and decision.

SpeculaPro is listed as a recipient on the Transaction monitoring activity in the Article 30 register. Its data subjects include merchant directors and beneficial owners, payout recipients and merchant staff.

Queue history is in the Sends that need a person panel. “Every live merchant, and the final live payments created in the window.” Give a From and a To (inclusive) date, at most 93 days apart, and a reason.

It always queues every live merchant, whatever the window. Repeating it or overlapping windows is safe: nothing is queued twice, and SpeculaPro answers a resent payment as a duplicate. Queue a longer history in pieces. It is sent only while the feed is on.

“SpeculaPro refused these, or they kept failing. Fix the cause (usually the merchant’s or payment’s data), then send them again.” The 100 most recent: Queued, What, Subject (the merchant code or the payment’s reference), Tries and Why, which is SpeculaPro’s own reason.

Send failed again puts every failed row back on the queue, asking “What was fixed”. “Fix the cause first: an item SpeculaPro refused is refused again if nothing about it changed.” A row whose subject is already queued again is left alone, because the queued one carries the current state.

The 50 most recent webhooks: Received, Event, Merchant and What was done. A freeze also shows Confirmed to SpeculaPro or Not yet confirmed to SpeculaPro (hover for the error).

While the feed is on, events on live accounts are sent too, for SpeculaPro’s fraud rules. Account takeovers usually start before money moves. These events are only recorded: nothing waits for SpeculaPro, and nothing here can stop a sign-in. SpeculaPro’s payout decisions see them straight away, so a rule such as “a payout minutes after a new payout account” can run.

Event When
login A portal sign-in, with the IP address. Refreshing a session isn’t a sign-in.
login_failed A wrong password, and whether the sign-in is now locked.
password_change A password changed. Not the first password an invited person chooses.
email_change A sign-in email changed.
device_added An authenticator enrolled or replaced.
payee_added A payout account added, with its type and currency.

A person who belongs to several accounts produces one event for each live account they belong to, but not for one they were removed from.

Only login carries the IP address, session and device. The other events are recorded by the database, which never sees the client’s address. So SpeculaPro can’t link a failed password or a changed email to a later sign-in by address.

An event’s row holds the IP address, so sent events are deleted after a day rather than 14. Queued or failed rows aren’t removed by an erasure. Each event is captured when it happens, so a resend describes then, not now. They’re sent after accounts and before transactions.

SpeculaPro signs every webhook, and the gateway checks the signature before reading anything. A delivery is acted on once, even when SpeculaPro sends it again. Three events change something, and none of them releases money.

Event What happens
Sanctions freeze (customer.freeze_requested) A sanctions match was confirmed in SpeculaPro. Every account of that legal entity, the primary and its sub-accounts, gets a live security review with reason sanctions_freeze. Payouts, refunds, withdrawals and settlements are refused until it’s cleared. Staff are alerted (“Sanctions match: merchant’s money-out held”). The worker then confirms to SpeculaPro that the hold is in place.
Freeze lifted (customer.freeze_lifted) Staff are alerted (“SpeculaPro lifted a freeze: clear the hold”). Nothing is released: a person clears the review on the Security page.
Exit approved (customer.exit_approved) Every account gets a review with reason exit_approved, and staff are alerted (“SpeculaPro approved an exit: terminate the merchant”). Staff terminate the merchant from Merchants. The feed then tells SpeculaPro the customer has exited.

Anything else (cases, alerts, decisions) is recorded and changes nothing. An event naming a customer PaySigna doesn’t have is recorded as “no merchant with code …; nothing done”.

A freeze holds what is created after it. A payout or refund already under way isn’t stopped. Collections continue and the account isn’t suspended.

While any account of the legal entity is held by a sanctions freeze or an exit, no other account of it can go live (409: “…is held by SpeculaPro (a sanctions freeze or an approved exit). Resolve that on the Security page first.”). That stops an account opened after the freeze from moving the money it is meant to hold.

A sanctions match must not be revealed to the merchant. For these reviews:

  • no email goes to the merchant when the review opens or when it’s cleared, even with Also tell the merchant on. Clearing it records SpeculaPro hold released rather than an ordinary review clear;
  • the portal shows no review;
  • a refused payout gets the ordinary 403 money_out_on_hold: “…on hold while PaySigna completes a security review. Collections are not affected.” It doesn’t say why.

This also applies when the account already had an open review for another reason, such as an API-key attack: the freeze takes that review over and gives it SpeculaPro’s reason. A sanctions freeze is never downgraded to an exit.

Clearing a review opened by SpeculaPro needs Authorised by: a different active operator who holds security.manage. The clear is held until they approve it in Approvals. The dialog button reads Send for approval.

  • Sanctions freeze: “Clear it only once compliance agrees the match is resolved.”
  • Exit approved: “Clear it only if the exit was cancelled; otherwise terminate the merchant.”
To stop Do Who
Payout decisions Turn off Ask SpeculaPro before each live payout. Two people. Removing SPECULAPRO_DECIDE_KEY from the gateway also stops it.
Collection decisions Turn off collection decisions. “Money already held stays held until released.” Two people. Removing SPECULAPRO_DECIDE_KEY also stops it.
The feed, and account events with it Turn off the monitoring feed. One person.
KYC screening Turn off KYC screening. One person.

Webhooks keep arriving and acting while the webhook secret is set.

  1. Deploy migrations 000116 to 000122 and the grants. See docs/operations.md.
  2. In SpeculaPro:
    • create an API key with ingest:write, instructions:confirm and onboard;
    • create a decide key (scope decide), for payout and collection decisions;
    • add a webhook endpoint at https://api.paysigna.com/webhooks/speculapro subscribed to customer.freeze_requested, customer.freeze_lifted and customer.exit_approved, and note its whsec_ secret.
  3. Seal the keys and the secret on the gateway, and restart gateway-api, gateway-worker and provider-api.
  4. Here: Turn on the feed, then Queue history to send what already exists.
  5. Turn on KYC screening when you want SpeculaPro to answer the sanctions and PEP checks.
  6. Before payout decisions, in SpeculaPro: install the gh-psp rule pack, switch on the rules you want (leave the real-time ones in shadow until they’re tuned on real data), and set the decision policy (time budget, fail open or closed).
  7. Once the feed has run and the rules are tuned, switch on Ask SpeculaPro before each live payout with a second operator.
  8. Later still, once SpeculaPro has rules for collections: Collection decisions → Turn on, with a second operator. Check Collections with money held each day and release the genuine ones.

The step-by-step checklist (keys and scopes, sealed secrets, migrations, the switch-on order) is docs/speculapro-integration.md in the repository. The network policies between the gateway and SpeculaPro are already in the deploy repo; see docs/operations.md if decisions time out.

Without the webhook secret, the gateway refuses every webhook (503) and SpeculaPro keeps resending. A bad signature is refused with 401.

Route Permission What it does
GET /v1/speculapro risk.read Settings, queue counts by kind and status, the 100 most recent failures, the 50 most recent webhooks, the 100 most recent payout and collection decisions (decisions, with direction, funds_held and funds_released_at, _by and _reason), the collections with money held, oldest first, up to 200 (held_collections), and the erasure tasks, open first (erasures).
PUT /v1/speculapro/settings risk.write Replaces the settings, with a reason. Changing decisions_enabled, collection_decisions_enabled, decision_timeout_ms, fallback_allow_below_minor or fallback_currency needs approved_by and answers 202 approval_pending. onboarding_enabled and collection_decisions_enabled are optional (left out: unchanged); onboarding_enabled needs one person. Audited as speculapro.settings.update.
POST /v1/speculapro/backfill risk.write from_date, to_date (inclusive, at most 93 days) and reason. Returns how many merchant rows and transactions were queued. Audited as speculapro.backfill.
POST /v1/speculapro/retry risk.write Re-queues every failed row, with a reason. Audited as speculapro.retry.
POST /v1/speculapro/screen risk.write Queues a KYC screening for a merchant’s legal entity: merchant_id and reason. 409 while KYC screening is off. queued: false when one is already waiting. Audited as speculapro.screen.
POST /v1/speculapro/erasures/{id}/registered gdpr.process Records an erasure as registered in SpeculaPro: speculapro_reference and an optional note. 409 when already registered. Audited as speculapro.erasure_registered.
POST /v1/speculapro/held-collections/{id}/release risk.write Releases a held collection’s money to the merchant’s normal release. {id} is the decision’s id from held_collections. reason (12 to 500 characters) and approved_by, a different active operator (your own id only while you’re the only one); answers 202 approval_pending until they approve. 409 when already released or not held. Audited as speculapro.collection_funds_released.