Server

Transactions and webhooks

Your server stays the source of truth for orders, bookings and similar records. You publish signed events; SALOPHA keeps a permission-filtered projection and shows it as live cards in the user's chats and in «My orders».

Last updated: November 7, 2026 · Browser SDK 1.6.0 · Bridge protocol 1.2

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#

CredentialUseKept by
Event signing key (Ed25519)You sign events to SALOPHAYou 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 youPublic keys at https://api.salopha.com/v1/.well-known/salopha-webhook-keys.json
Client credentialsThe sign-in code exchangeYour 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.

HeaderExample
X-Salopha-Key-Idk_my_shop_2026_11
X-Salopha-Timestamp2026-11-04T09:30:02Z (RFC 3339, UTC)
X-Event-IDevt_01K8WG7X67T1QD9KWPEXT001 (equals the body's eventId; a unique request id otherwise)
X-Salopha-Signaturev1=<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). An X-Event-ID seen before with a different body hash is rejected (409).

Answers and retries#

ResultHTTPBodyWhat you do
Applied202{ status: "accepted", transactionId, appliedVersion }Done
Already ingested (same id and body)202{ status: "duplicate" }Done; never a second card or notification
Older version202{ status: "stale" }Done; state never moves backwards
Version gap202{ status: "pending_order" }Done; applied when the missing version arrives
Bad schema400fieldErrorsFix and resend with a new eventId
Bad signature, timestamp or key401reasonFix the clock or key
Scope, type or business not allowed403reasonFix the binding or manifest
Rate limited429retryAfterMsRetry after the delay
Server error5xxRetry

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#

KeyRule
(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.
aggregateVersionStrictly 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 eventMust be miniapp.transaction.created.v1 with the full payload.

Event types#

eventTypeRequired in transactionEffect
miniapp.transaction.created.v1Full: type, ownerBusinessId, customer, participants, title, sourceStatus, createdAt, updatedAtCreates the transaction and links conversations
miniapp.transaction.status_changed.v1sourceStatus (+ status, changed fields, actions if changed)Updates status and actions
miniapp.transaction.action_completed.v1actionAttemptId + changed fieldsCompletes an accepted action
miniapp.transaction.document_available.v1New artifactsAdds documents
miniapp.transaction.payment_updated.v1amount and/or detailsUpdates the displayed amount
miniapp.transaction.assigned.v1participantsUpdates 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.

StatusShown asFinalTypical source statuses
createdCreatednocreated, new
submittedAwaiting confirmationnopending, submitted, awaiting_payment, reserved
acceptedAcceptednoaccepted, confirmed, ticket_issued
inProgressIn progressnopreparing, shipped, out_for_delivery, checked_in
completedCompletedyesdelivered, completed, checked_out
cancelledCancelledyescancelled, canceled_by_customer, voided
rejectedRejectedyesrejected, declined
expiredExpiredyesexpired, timed_out, no_show
disputedDisputednodisputed, return_requested
refundedRefundedyesrefunded, 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 answerMeans
200 completedDone now; SALOPHA updates the card (also send a status_changed)
202 acceptedProcessing; send action_completed later
409 conflictThe 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#

ViewerSees
Participant with full visibilityEverything (minus other people's line items in group orders)
Participant with limited visibilityRestricted detail keys removed, no full documents, mutation actions disabled
Business staffOnly with the transactions permission for that branch; changes need the manage permission
A chat member who isn't a participantThe 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.

KindTimeoutRetries
Synchronous (action, resolve, search)8 s (resolve 3 s, search 4 s)None: the user is waiting
Asynchronous (consent, binding, rating, version)10 s10 s, 1 min, 5 min, 30 min, 2 h, 6 h, 12 h, 24 h, with the same eventId