# Have customers countersign risky actions

> Before a transfer to a new recipient or a change of phone number, your customer confirms that exact action with their passkey on their own device.

Source: https://docs.trustaige.com/customer-credentials/countersign

Replace these placeholders with your organization's own values:

- `<your-app-url>`: Your app’s address, for example `https://app.example.com`. Scheme and host, no path: where your app runs.

A signed-in session proves someone got in. It doesn't prove the customer agreed
to what happens next. Malware holding a live session, or a caller who talked a
customer into reading out a code, can move money from inside a perfectly valid
session. Countersign closes that gap: before your app carries out a risky
action, the customer sees exactly that action on their own device and confirms
it with their passkey. Your server receives a signed proof bound to that one
action, usable once and only within a limited time.

Countersign works the same way in staff apps; the
[Countersign guide](/countersign) has the full reference. This page covers what
is particular to a customers app.

## Choose what to protect

Ask for a countersignature where a wrong action is costly or hard to undo. For
most customer apps that means:

| Action | Why |
|---|---|
| A transfer to someone the customer hasn't paid before | The usual way money leaves a taken-over account |
| A transfer above an amount you set | Limits the damage of any single mistake |
| A change of phone number, email or address | Changes how the account is reached, which is how takeovers become permanent |
| A higher daily limit, a new card, or a new device | Each one widens what the next action can do |
| Closing the account, or exporting its data | Hard to undo |

Leave routine actions alone. A customer asked to confirm everything stops
reading what they confirm.

## Turn it on

In the hub, open **CIAM** → **Apps**, choose your app and open its
**Countersign** tab. Pick **Passkey**. Press **Try Countersign** to see the
window your customers will see, with an example transfer; nothing changes in
your app.

## Ask, show, collect, check

1. **Ask from your server.** Describe the action and post it to
   `/countersign/bc-authorize`, authenticated as your app, as you are at the
   token endpoint. `login_hint` is the `sub` from the customer's ID token.

   ```bash title="From your server"
   curl -u "$TRUSTAIGE_CLIENT_ID:$TRUSTAIGE_CLIENT_SECRET" \
     https://id.trustaige.com/countersign/bc-authorize \
     --data-urlencode "login_hint=$CUSTOMER_SUB" \
     --data-urlencode "frame_origin=<your-app-url>" \
     --data-urlencode 'authorization_details=[{
       "type": "payments.transfer.new_recipient",
       "summary": "Send ₦250,000 to Chidi Okeke",
       "fields": [
         {"name": "amount",    "title": "Amount",  "value": "₦250,000", "format": "emphasis"},
         {"name": "recipient", "title": "To",      "value": "Chidi Okeke", "format": "bold"},
         {"name": "account",   "title": "Account", "value": "Access Bank · 0123456789"},
         {"name": "from",      "title": "From",    "value": "Savings •••• 7781"}
       ],
       "notice": {"text": "You have not sent money to this account before.", "tone": "caution"}
     }]'
   ```

   Store the `auth_req_id` and `txn_hash` it returns with the pending
   transfer. How to describe an action is in
   [Describe the action](/countersign/describe).

2. **Show the window.** Load `countersign.js` on your page and open the
   `frame_url` it returned. Trustaige takes the screen over your page.

   ```html title="Your page"
   <script src="https://id.trustaige.com/countersign.js"></script>
   <script>
     TrustaigeCountersign.open(frameUrl).then(() => collect(transferId));
   </script>
   ```

3. **Collect the proof** from your server, at `/countersign/token`, with the
   `auth_req_id`. Until the customer answers you get `authorization_pending`;
   `access_denied` means they declined, and `expired_token` that nobody answered
   in time.

4. **Check it before any money moves.** The checks are in
   [Check the proof](/countersign/proof). For a customer, the one that matters
   most: the proof's `sub` must equal the `sub` of the customer whose session
   started the transfer.

## What your customer sees

The window shows your app's name and logo, the action in your own words, and
every detail you sent, exactly as you sent it. It reads **"Only you can confirm
this"** and shows no name or email: the passkey proves who it is, and the window
carries nothing personal for the page beneath it to read. A short reference,
derived from the action, appears beside it. **Decline** is as easy as
**Confirm with passkey**.

## Refusals particular to customers

| `error` from `bc-authorize` | Means |
|---|---|
| `unknown_user_id` | `login_hint` isn't one of this app's customers who has claimed an account. A customers app can't ask a member of your organization, and a staff app can't ask a customer. |
| `access_denied` | The customer's account isn't active: you suspended or revoked it, or it expired. They can't approve anything, even if their session in your app is still open. Or the customer recently reported a request as not theirs, and requests to them are paused for a few minutes. The `error_description` says which. |
| `unauthorized_client` | Countersign is off for this app, or the app was made from a catalog template. |

## What is kept

Your server keeps the proof: it is your evidence of exactly what the customer
approved, and when. Trustaige records each answer (approved, declined or
reported as not theirs) on the customer's own timeline, which your admins see in
the hub's Customers page. It is not in your organization's audit log, so when
you erase a customer, their answers go with them. Nothing in the proof, the
window or the timeline lets another organization recognise the same person.

> **What Countersign doesn't cover:** It protects actions taken through your app. A customer who is persuaded to
> approve a transfer to a scammer has still approved it, so show the recipient
> plainly and say when they are new. Countersign can't run where there is no
> passkey, such as USSD on a feature phone: keep risky actions out of those
> channels instead.

Next: [before you go live](/customer-credentials/go-live).
