The pipeline#
Your DB commit -> outbox -> signed POST /v1/partner/apps/{appId}/transaction-events
-> gateway (key, signature, timestamp, app, schema)
-> inbox (dedupe by (appId, eventId), order by aggregateVersion)
-> participants (pairwise ids -> users, binding -> business and branch)
-> projection + timeline + conversation links
-> live updates, chat card and notification (by policy)
A chat card is only a presentation. Deleting the message never deletes the transaction.
You need the server scope transaction.publish.server, the transaction types declared in your manifest (transactionTypes), and an Ed25519 key pair whose public key is registered in the console (Integration).
const platform = new PlatformClient({ /* … */ appId: "my_shop", eventKey: { keyId: "k_my_shop_2026_11", privateKeyPem } });
await platform.publishTransactionEvent({ eventId, externalReference: "ORD-10245", aggregateVersion: 1, eventType: "miniapp.transaction.created.v1", occurredAt, transaction: { … } });
Keys#
| Credential | Use | Kept by |
|---|---|---|
| Event signing key (Ed25519) | You sign events to SALOPHA | You hold the private key; SALOPHA stores the public key. Its id goes in X-Salopha-Key-Id. |
| Platform webhook key (Ed25519) | SALOPHA signs calls to you | Public keys at https://api.salopha.com/v1/.well-known/salopha-webhook-keys.json |
| Client credentials | The sign-in code exchange | Your server only, never in the page |
At most two active keys per app: add the new key, switch, then revoke the old one within 7 days. The key id selects the key, so both overlap safely.
Request signing#
Both directions use the same scheme.
| Header | Example |
|---|---|
X-Salopha-Key-Id | k_my_shop_2026_11 |
X-Salopha-Timestamp | 2026-11-04T09:30:02Z (RFC 3339, UTC) |
X-Event-ID | evt_01K8WG7X67T1QD9KWPEXT001 (equals the body's eventId; a unique request id otherwise) |
X-Salopha-Signature | v1=<base64 signature> (several comma-separated values during a rotation) |
The canonical string, UTF-8 with \n separators and no trailing newline:
v1
<X-Salopha-Timestamp>
<X-Event-ID>
<HTTP METHOD in upper case>
<request path including /v1, without host or query>
<lowercase hex SHA-256 of the exact raw body bytes>
- Sign and verify the raw body bytes. Never re-serialize JSON before verifying.
- Ed25519:
signature = sign(privateKey, canonical). Compare signatures in constant time. - Requests more than 300 seconds off are rejected (
401,timestamp_skew). AnX-Event-IDseen before with a different body hash is rejected (409).
Answers and retries#
| Result | HTTP | Body | What you do |
|---|---|---|---|
| Applied | 202 | { status: "accepted", transactionId, appliedVersion } | Done |
| Already ingested (same id and body) | 202 | { status: "duplicate" } | Done; never a second card or notification |
| Older version | 202 | { status: "stale" } | Done; state never moves backwards |
| Version gap | 202 | { status: "pending_order" } | Done; applied when the missing version arrives |
| Bad schema | 400 | fieldErrors | Fix and resend with a new eventId |
| Bad signature, timestamp or key | 401 | reason | Fix the clock or key |
| Scope, type or business not allowed | 403 | reason | Fix the binding or manifest |
| Rate limited | 429 | retryAfterMs | Retry after the delay |
| Server error | 5xx | Retry |
Retry from your outbox with exponential backoff (10 s, 30 s, 2 min, 10 min, 30 min, 1 h, then hourly up to 24 h), always with the same eventId. Ingestion is idempotent, so retries are safe.
Ordering and duplicates#
| Key | Rule |
|---|---|
(appId, eventId) | Unique. A duplicate answers duplicate and changes nothing. |
(appId, externalReference) | The transaction's identity in your app. SALOPHA assigns its own transaction id. |
aggregateVersion | Strictly increasing per transaction, starting at 1 for created. Only current + 1 applies at once; lower is stale, higher waits. If you can't guarantee contiguous versions, send X-Salopha-Version-Policy: monotonic. |
| First event | Must be miniapp.transaction.created.v1 with the full payload. |
Event types#
eventType | Required in transaction | Effect |
|---|---|---|
miniapp.transaction.created.v1 | Full: type, ownerBusinessId, customer, participants, title, sourceStatus, createdAt, updatedAt | Creates the transaction and links conversations |
miniapp.transaction.status_changed.v1 | sourceStatus (+ status, changed fields, actions if changed) | Updates status and actions |
miniapp.transaction.action_completed.v1 | actionAttemptId + changed fields | Completes an accepted action |
miniapp.transaction.document_available.v1 | New artifacts | Adds documents |
miniapp.transaction.payment_updated.v1 | amount and/or details | Updates the displayed amount |
miniapp.transaction.assigned.v1 | participants | Updates participants |
miniapp.transaction.reminder.v1 | — | A reminder on the timeline |
miniapp.transaction.note.v1 | — | A note on the timeline |
Every string is plain text (HTML is stripped). Limits: title 120, summary 300, detail values 200, 30 detail keys. Images must be HTTPS on one of your allowedOrigins.
Never send full card numbers, CVV, passport numbers, or raw phone numbers and delivery addresses of other parties. Restricted details keys (deliveryAddress as a label, phone, paymentMethod, cardLast4, masked passport, masked customerPhone) are removed automatically for limited participants.
Example events#
{
"eventId": "evt_01K8WG7X67T1QD9KWPEXT001",
"appId": "my_shop",
"externalReference": "ORD-10245",
"aggregateVersion": 1,
"eventType": "miniapp.transaction.created.v1",
"occurredAt": "2026-11-04T09:30:00Z",
"actor": { "type": "user", "id": "pw_7f3a9c" },
"timelineTitle": { "ar": "تم استلام طلبك", "en": "Order received" },
"transaction": {
"type": "order",
"sourceType": "shop_order",
"ownerBusinessId": "biz_123",
"customer": { "type": "user", "id": "pw_7f3a9c" },
"participants": [
{ "actor": { "type": "user", "id": "pw_7f3a9c" }, "role": "customer", "visibility": "full" },
{ "actor": { "type": "business", "id": "biz_123" }, "role": "seller", "visibility": "full" }
],
"title": { "ar": "طلب من متجري", "en": "Order from My Shop" },
"summary": { "ar": "قطعتان", "en": "2 items" },
"sourceStatus": "pending",
"amount": { "minor": 18500, "currency": "IQD" },
"createdAt": "2026-11-04T09:30:00Z",
"updatedAt": "2026-11-04T09:30:00Z",
"deepLink": "salopha://app/my_shop/order/ORD-10245",
"actions": [
{ "key": "track_order", "label": { "ar": "تتبع الطلب", "en": "Track order" }, "kind": "deepLink", "state": "available", "allowedRoles": ["customer"], "requiresConfirmation": false, "isDestructive": false, "deepLink": "salopha://app/my_shop/track/ORD-10245", "isPrimary": true },
{ "key": "cancel_order", "label": { "ar": "إلغاء الطلب", "en": "Cancel order" }, "kind": "mutation", "state": "available", "allowedRoles": ["customer"], "requiresConfirmation": true, "confirmationText": { "ar": "هل تريد إلغاء الطلب؟", "en": "Cancel this order?" }, "isDestructive": true, "expiresAt": "2026-11-04T09:35:00Z" }
],
"lineItems": [{ "title": "T-shirt", "quantity": 2, "unitPrice": { "minor": 9250, "currency": "IQD" } }]
}
}
A later event sends only what changed:
{
"eventId": "evt_01K8WG9B2M7Q0Z1Y2X3W4V5U6T",
"appId": "my_shop",
"externalReference": "ORD-10245",
"aggregateVersion": 2,
"eventType": "miniapp.transaction.status_changed.v1",
"occurredAt": "2026-11-04T09:41:00Z",
"actor": { "type": "business", "id": "biz_123" },
"timelineTitle": { "ar": "قيد التجهيز", "en": "Being prepared" },
"transaction": { "sourceStatus": "preparing", "status": "inProgress", "updatedAt": "2026-11-04T09:41:00Z" }
}
Statuses#
Send transaction.status yourself, or register a status map per sourceType in the manifest. sourceStatus is always stored as you sent it.
| Status | Shown as | Final | Typical source statuses |
|---|---|---|---|
created | Created | no | created, new |
submitted | Awaiting confirmation | no | pending, submitted, awaiting_payment, reserved |
accepted | Accepted | no | accepted, confirmed, ticket_issued |
inProgress | In progress | no | preparing, shipped, out_for_delivery, checked_in |
completed | Completed | yes | delivered, completed, checked_out |
cancelled | Cancelled | yes | cancelled, canceled_by_customer, voided |
rejected | Rejected | yes | rejected, declined |
expired | Expired | yes | expired, timed_out, no_show |
disputed | Disputed | no | disputed, return_requested |
refunded | Refunded | yes | refunded, partially_refunded |
A final status may move only to disputed or refunded. On final transactions, mutation actions are disabled except rate, reorder and support.
Actions#
When a user taps an action that changes something (kind: "mutation"), SALOPHA checks the role, visibility, expiry and version, asks for confirmation when required, then calls your POST <webhookUrl>/actions (platform.action.requested.v1, signed, 8 seconds) with an idempotency key. Check the live state and apply atomically.
| You answer | Means |
|---|---|
200 completed | Done now; SALOPHA updates the card (also send a status_changed) |
202 accepted | Processing; send action_completed later |
409 conflict | The state or price changed; the user sees the fresh state and confirms again |
200 rejected (+ message) | You refused it |
The same idempotency key may arrive more than once: one cancel tapped many times must run once.
Who sees what#
| Viewer | Sees |
|---|---|
Participant with full visibility | Everything (minus other people's line items in group orders) |
Participant with limited visibility | Restricted detail keys removed, no full documents, mutation actions disabled |
| Business staff | Only with the transactions permission for that branch; changes need the manage permission |
| A chat member who isn't a participant | The card's title and status only |
Visibility is checked on every read and every action, not only when the card is created.
Notifications from transactions#
At most one push per transaction every 2 minutes. The text comes from the normalised status, never from your free text, and amounts are hidden on the lock screen. Chat cards are posted for created, final statuses, new documents and milestones you flag with notify: true, so each small update doesn't become a message.
Platform webhooks#
SALOPHA sends these to <webhookUrl>, signed like above: platform.action.requested.v1, platform.object.resolve.v1, platform.object.search.v1, platform.consent.revoked.v1, platform.binding.changed.v1, platform.transaction.rated.v1, platform.app.version_published.v1.
| Kind | Timeout | Retries |
|---|---|---|
| Synchronous (action, resolve, search) | 8 s (resolve 3 s, search 4 s) | None: the user is waiting |
| Asynchronous (consent, binding, rating, version) | 10 s | 10 s, 1 min, 5 min, 30 min, 2 h, 6 h, 12 h, 24 h, with the same eventId |