ShoppingateShoppingateDevelopers
shoppinggate.app ↗
Documentation
  • What is a Mini App
  • Why Mini Apps
  • API integration
  • SDK
  • Webview
  • Mini App architecture
  • Getting started
  • Choosing your path
  • Introduction
    • Introduction
    • Sign up & login
    • Dashboard & analytics
    • Mini-Programs
    • Submit & publish a version
    • App Binding
    • Privacy Settings
    • Allowed URL
    • Users & roles
    • Introduction
    • Become a Mini-App vendor
    • API keys
    • My Mini-Apps
    • Orders
    • Webhook
    • Deep-link config
    • Introduction
    • Install & log in
    • Create a project
    • The workspace
    • Preview & upload
  • Introduction
  • Configuration
  • Lifecycle
  • Routing & query
  • Host functions
  • orderPayment
  • Permissions
  • User info
  • Introduction
  • Configuration
  • SDK
  • Lifecycle
  • Routing & query
  • Host functions
  • orderPayment
  • Permissions
  • User info
  • Web app and shell calls
  • Look and feel
  • Overview
    • Verify user
    • Create order
    • Get order
    • Update order status
    • Charge an order
    • Send a notification
  • Subscriptions
    • Create a subscription
    • List subscriptions
    • Get a subscription
    • Update a subscription
    • Reschedule next charge
    • Change plan (upgrade)
    • Cancel a subscription
  • Webhooks
Server side

Webhooks — events you build a receiver for

Every state change on a mini-app order or subscription is delivered as an outbound POST to a URL you register in the merchant portal. Payload is JSON, signed with an HMAC-SHA256 over the raw body using your webhook secret.

Retries: 8 attempts with exponential backoff over ~24 hours before the delivery drops to a dead-letter queue you can inspect in the portal.

order.created
Order accepted by Shoppingate.
order.paid
Payment captured.
order.processing
Vendor accepted, work begun.
order.completed
Fulfilled end-to-end.
order.cancelled
User or vendor cancelled. When a vendor cancels a paid/processing order, this fires immediately and the platform then issues a full auto-refund — expect a separate order.refunded event when the gateway settles.
order.refunded
Full refund settled by the gateway. For vendor cancels of paid orders, fires after order.cancelled (async — seconds for wallet/Tamara, up to a few days for card).
order.partially_refunded
Partial refund processed (the gateway settled less than the requested amount).
subscription.created
Subscription registered (incomplete) — not yet charged.
subscription.activated
First charge succeeded; the subscription is now active.
subscription.charged
A charge settled — activation, renewal, or upgrade (see payload.kind).
subscription.payment_failed
A charge failed. Carries the attempt number and, unless it was the final attempt, the next retry time.
subscription.past_due
A renewal failed and dunning began — the subscription is retrying.
subscription.updated
Plan details changed (your update, a reschedule, or a settled upgrade).
subscription.cancelled
Subscription ended — by you, the user, or dunning exhaustion (see payload.cause).
subscription.expired
Reached period end with auto_renew off.
mini_app.sg_suspended
Platform suspended the mini app.
mini_app.sg_restored
Suspension lifted.

Payload envelope

Every webhook shares the same wrapper; the event-specific detail is in payload. Key your logic on event_type and dedupe on delivery_uuid (retries reuse it).

{
  "event_type":    "order.paid",
  "delivery_uuid": "9b1e2f3a-…",            // unique per delivery — dedupe on this
  "mini_app_id":   64,
  "vendor_id":     12,
  "user_id":       6093,                     // null for mini-app lifecycle events
  "payload":       { /* event-specific — see below */ },
  "delivered_at":  "2026-11-09T12:00:00.000Z",
  "attempt":       1                         // 1..8; increments on retry
}

Payload by event

Money fields are decimal strings. order.cancelled can arrive from two paths — the payment one (with amount/paid_at) on an auto-refund cancel, or the transition one (with reason).

order.created
{
  "order_uuid":       "0193b09d-…",
  "order_number":     "MA-2026-00042",
  "mini_app_id":      64,
  "vendor_id":        12,
  "user_id":          6093,
  "vendor_order_ref": "VND-CART-9b3f12",
  "items":            [ { "sku": "…", "name": "…", "qty": 2, "unit_price": 49.00 } ],
  "total_amount":     "124.20",
  "currency":         "SAR",
  "status":           "created",
  "created_at":       "2026-11-09T12:00:00.000Z"
}
order.paid · order.cancelled (payment-driven)
{
  "order_uuid":       "0193b09d-…",
  "mini_app_id":      64,
  "vendor_id":        12,
  "user_id":          6093,
  "vendor_order_ref": "VND-CART-9b3f12",
  "status":           "paid",               // or "cancelled"
  "from_state":       "created",
  "amount":           "124.20",
  "currency":         "SAR",
  "payment_method":   "card",               // card | wallet | apple_pay | tamara
  "paid_at":          "2026-11-09T12:00:00.000Z",   // null unless paid
  "cancelled_at":     null                  // set when cancelled
}
order.processing · order.completed · order.cancelled (transition-driven)
{
  "order_uuid":       "0193b09d-…",
  "mini_app_id":      64,
  "vendor_id":        12,
  "user_id":          6093,
  "vendor_order_ref": "VND-CART-9b3f12",
  "status":           "processing",         // or "completed" / "cancelled"
  "from_state":       "paid",
  "reason":           null,                 // optional, e.g. a cancel reason
  "updated_at":       "2026-11-09T12:05:00.000Z"
}
order.refunded · order.partially_refunded
{
  "order_uuid":       "0193b09d-…",
  "mini_app_id":      64,
  "vendor_id":        12,
  "user_id":          6093,
  "vendor_order_ref": "VND-CART-9b3f12",
  "refund_uuid":      "7c2a…",
  "amount":           "124.20",             // requested
  "settled_amount":   "124.20",             // actually returned by the gateway
  "fault":            "vendor",             // vendor | customer | platform | unknown
  "reason":           "Customer returned the item",
  "refunded_at":      "2026-11-09T12:30:00.000Z"
}
subscription.* — common shape (created · activated · past_due · updated · expired)
{
  "subscription_uuid":        "0193c7f0-…",
  "provider_subscription_ref": "SUB-GOLD-9b3f12",
  "mini_app_id":              64,
  "vendor_id":                12,
  "user_id":                  6093,
  "status":                   "active",     // the state after this event
  "plan_code":                "gold_monthly",
  "amount":                   "29.00",
  "currency":                 "SAR",
  "interval":                 "month",
  "interval_count":           1,
  "from_status":              "incomplete"  // present on state-change events
}
subscription.charged
{
  /* …common subscription fields… */
  "status":       "active",
  "kind":         "renewal",        // activation | renewal | upgrade
  "amount":       "29.00",
  "currency":     "SAR",
  "invoice_uuid": "0193c7f0-aa11-…"  // match against change-plan's upgrade_invoice_uuid
}
subscription.payment_failed · subscription.cancelled (dunning)
{
  /* …common subscription fields… */
  "status":        "past_due",
  "reason":        "card_declined",
  "attempt":       2,                          // 1-based dunning attempt
  "next_retry_at": "2026-12-12T12:00:00.000Z", // omitted on the final attempt
  "final":         false,                      // true on the last attempt
  "invoice_uuid":  "0193c7f0-aa11-…"
}

// When every dunning attempt is exhausted, a subscription.cancelled follows:
{
  /* …common subscription fields… */
  "status":   "cancelled",
  "cause":    "dunning_exhausted",
  "attempts": 4
}
mini_app.sg_suspended · mini_app.sg_restored
{
  "mini_app_id":  64,
  "vendor_id":    12,
  "user_id":      null,
  "reason":       "Policy review",          // null on restore
  "suspended_at": "2026-11-09T12:00:00.000Z"   // restored_at on mini_app.sg_restored
}

Verifying the signature

// Every request carries X-MiniApp-Signature = sha256=<hex-hmac>
// Compare it against HMAC-SHA256(rawBody, webhookSecret).

const crypto = require('crypto');

function verify(rawBody, headerSig, secret) {
  const expected = 'sha256=' + crypto
    .createHmac('sha256', secret)
    .update(rawBody)
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(expected),
    Buffer.from(headerSig)
  );
}
Return 2xx fast. The dispatcher waits 15 seconds for a response — do the heavy work in your own background queue after acknowledging. Non-2xx or timeout counts as a failure and enters the retry sequence.