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
Endpoints

Verify user

How your backend knows which user is using your Mini App: verify the token your Mini App gets from ft.getUserInfo, once. Every call also carries your API key headers — see Overview.

User authentication flow

01
Get the user's token in the mini app, forward it to your backend
Inside the mini app, call ft.getUserInfo and read res.userInfo.token — the token for the signed-in Shoppingate user (see User info).
02
Verify the token with the Identity API and register the profile
Your backend calls POST /s2s/v1/identity/verify with the same token (see the endpoint below).
03
Mint your own session token and use it inside the mini app
Once the profile is registered, mint your own session token (whatever your backend already uses — a JWT, an opaque cookie, an OAuth access token) and return it to the mini app. From here on, every mini-app → your-backend call uses your token. The Shoppingate token is verified once — steps 1 & 2 are a one-time handshake, not something to repeat on every request.

The endpoint

POST/s2s/v1/identity/verify
What it does
Confirms the identity token your mini app got from ft.getUserInfo (userInfo.token). Always hands back the SG user_id.
Body
tokenRequired
The JWT string handed to your backend from the mini app.
Request schema
{
  "token": <string, JWT>            // required — the token your mini app got from ft.getUserInfo (userInfo.token)
}
Response
statusboolean
true when the signature verified; false on the 4xx envelope. Note: status = true does not mean the user shared their profile — the PII fields are null when the user has not granted consent.
data.user_idnumber
Shoppingate user id — always returned, regardless of consent state. Persist this against your own account row so subsequent sessions with the same user land on the same profile. This is the load-bearing identifier for your side of the integration.
data.namestring | null (consent-gated)
User's full display name — first_name and last_name joined with a space. Populated only when the user has granted consent; null otherwise.
data.first_name, last_namestring | null (consent-gated)
Individual name parts, in case you need to store them separately or greet the user with just their first name. Both are null unless consent is granted.
data.emailstring | null (consent-gated)
User's email — populated only when consent is granted. May itself still be null even under consent if the user hasn't added an email to their Shoppingate account.
data.phone_number, phone_codestring
Mobile number and dial code (e.g. "+966") — always present, whatever the consent status. Combine them for a full E.164 number.
data.verified_atstring, ISO 8601 UTC
When this verify call resolved. Log for audit; do not use for token freshness (use expires_at).
data.issued_at, expires_atstring, ISO 8601 UTC
Token lifetime. Verify the token once — this endpoint is a one-time handshake, not a request-time header.
error_code (on 4xx)string
Machine string for the failure mode. 400: IDENTITY_TOKEN_REQUIRED (no token in the body), MINI_APP_REQUIRED (no X-Mini-App-Id). 401: IDENTITY_TOKEN_EXPIRED, INVALID_SIGNATURE, INVALID_SUBJECT. Branch on this — do not parse the human message.
messagestring
Human string for logs — do not parse.
Response schema
// 200 OK — signature valid.
{
  "status": true,
  "data": {
    "user_id":        <number>,
    "name":           <string> | null,
    "first_name":     <string> | null,
    "last_name":      <string> | null,
    "email":          <string> | null,
    "phone_number":   <string>,
    "phone_code":     <string>,
    "verified_at":    <string ISO>,
    "issued_at":      <string ISO>,
    "expires_at":     <string ISO>
  },
  "message": "Identity verified"
}

// 400 Bad Request — the call was malformed.
// error_code: IDENTITY_TOKEN_REQUIRED | MINI_APP_REQUIRED
//
// 401 Unauthorized — the token did not check out.
// error_code: IDENTITY_TOKEN_EXPIRED | INVALID_SIGNATURE | INVALID_SUBJECT
{
  "status":     false,
  "error_code": "IDENTITY_TOKEN_EXPIRED",
  "message":    "jwt expired"
}
Try it
Base URL
https://microservices.shoppinggate.app/mini-app-core/