Gett Developer Portal
  • Welcome
  • Distribution Partners
  • Brand Partners
  • Commerce Partners
  • Ecosystem Partners
  • Errors
  • API Reference
Documentation
  • Get Started
  • Marketfront SDK
  • API Reference
Resources
  • Payments
Company
  • Gett
  • Terms of Service
  • Privacy Policy

Copyright 2026 Gett. All rights reserved.

Marketfront SDK
    Getting Started
    SDK Guides
      SessionsEvents
    SDK Reference
Marketfront API
Marketfront AI
Shared Guides
powered by Zuplo
SDK Guides

Sessions

Sessions allow distribution partners to establish consumer context for the ordering experience. Your platform provides user information to Gett, enabling a seamless experience with pre-filled details.

How It Works

  1. User authenticates on your platform (your own auth system)
  2. Your backend creates a Gett session with user information via the Gett API
  3. You initialize the Marketfront SDK with the session token
  4. User enjoys a seamless ordering experience with their information pre-filled

How the SDK Manages Sign-in

The SDK manages authentication progressively. Pass whatever user context you have at session creation — even an empty body produces a valid session suitable for anonymous browse. When the user reaches a checkout action, the embed prompts for sign-in inside its own UI; no host-page sign-in trigger is required, and you do not call any sign-in or upgrade endpoint yourself.

If you already have the user's identity at session-creation time, supply it via the request body below and the SDK skips the in-embed sign-in step.


Session Creation

Endpoint

EnvironmentURL
Sandboxhttps://api-sandbox.gett-tech.com/v1/marketplace/session/create
Productionhttps://api.gett-tech.com/v1/marketplace/session/create
Code
POST /v1/marketplace/session/create Authorization: Bearer YOUR_API_KEY Content-Type: application/json

Authenticated with your partner API key (server-to-server only — never call this from a browser).

Request Body

Code
{ "partnerUserId": "user_12345", "email": "[email protected]", "firstName": "Jane", "lastName": "Doe", "phone": "+15551234567", "address": { "address1": "123 Main St", "address2": "Apt 4B", "city": "Seattle", "state": "WA", "postalCode": "98101" } }

Every field is optional. An empty body is valid — it produces an anonymous session, and the embed prompts the user to sign in when they reach checkout.

FieldTypeRequiredDescription
partnerUserIdstringNoStable user identifier in your system. Server mints a gen_<guid> if omitted.
emailstringRequired when firstName or lastName is presentUser's email address.
firstNamestringRequired when email or lastName is presentUser's first name.
lastNamestringRequired when email or firstName is presentUser's last name.
phonestringNoE.164 format (e.g., +15551234567). Must be SMS-capable for order notifications.
addressobjectNoDefault delivery address — powers initial store discovery. See address below.

The email / firstName / lastName triple is all-or-nothing: supplying any one without the others returns 400 LEVEL_1_INCOMPLETE. Supply all three to resolve a Gett user up front, or omit all three to keep the session anonymous (the embed will prompt for sign-in at checkout).

address object

Code
{ "address1": "123 Main St", "address2": "Apt 4B", "city": "Seattle", "state": "WA", "postalCode": "98101" }
FieldTypeRequiredDescription
address1stringYesStreet address.
address2stringNoApartment, suite, unit, etc.
citystringYesCity.
statestringYesRegion or state.
postalCodestringYesPostal code.

Response

Code
{ "token": "gett_sess_abc123xyz", "expiresAt": "2025-01-15T12:00:00Z", "partnerUserId": "user_12345" }
FieldTypeDescription
tokenstringSession token. Pass to the Marketfront SDK to establish consumer context.
expiresAtstringISO 8601 expiration timestamp.
partnerUserIdstringEchoes the caller-supplied partnerUserId, or the server-minted gen_<guid> when none was supplied. Store this to correlate sessions across token refreshes.

Using the Session Token

Initialize the Marketfront SDK with the session token returned from session creation. The session token encodes your partner identity, so no separate Partner ID is needed.

Vanilla TypeScript

Code
import '@gett-co/marketfront'; // Your backend creates the session with user data const { token } = await yourBackend.createGettSession(user); const el = document.createElement('gett-marketfront'); el.sessionToken = token; document.getElementById('container')!.appendChild(el);

React

Code
import '@gett-co/marketfront'; function OrderPage({ sessionToken }: { sessionToken: string }) { return ( <gett-marketfront session-token={sessionToken} onOrderComplete={(order) => console.log('Order:', order.id)} /> ); }

Session Lifecycle

Expiration

Sessions expire 7 days after creation. The exact expiry is in the response's expiresAt field. Token lifetime is set by Gett and is not negotiable per request. Before expiration, create a new session:

TerminalCode
POST https://api.gett-tech.com/v1/marketplace/session/create

The new session will inherit any in-progress cart from the previous session for the same partnerUserId.

To end a session early (e.g., on user logout), discard the token client-side. Calls made with a discarded token will continue to authorize until its natural expiry, so don't rely on discard alone to terminate a session.


Security

API Key Protection

Your API key authenticates session creation requests. Never expose it in client-side code.

Code
// Never do this in frontend code const response = await fetch('https://api.gett-tech.com/v1/marketplace/session/create', { headers: { 'Authorization': `Bearer ${API_KEY}` } // Exposed! }); // Always call from your backend const response = await yourBackend.createGettSession(userId);

Session Token Handling

Session tokens are safe for client-side use but should still be handled carefully:

  • Tokens are scoped to a single session and user
  • Tokens cannot be used to create new sessions
  • Tokens expire automatically

Data Privacy

  • User data is processed according to Gett's privacy policy
  • You are responsible for obtaining appropriate consent from your users
  • Gett does not share user data with third parties

Error Handling

Session Creation Errors

Error CodeHTTP StatusDescriptionResolution
invalid_api_key401API key is invalid or revokedVerify your API key
invalid_email400Email format is invalidProvide valid email
invalid_phone400Phone format is invalidUse E.164 format
invalid_address400Address could not be validatedVerify address fields
rate_limited429Too many requestsImplement backoff

Session Token Errors

Error CodeHTTP StatusDescriptionResolution
session_expired401Session token has expiredCreate a new session
session_invalid401Session token is malformed or revokedCreate a new session
session_not_found404Session does not existCreate a new session

Next Steps

  • Payments — Card-on-File setup and payment interchange
  • Events — Handle order lifecycle events
  • SDK Reference — Complete SDK API documentation
AndroidEvents
On this page
  • How It Works
  • How the SDK Manages Sign-in
  • Session Creation
    • Endpoint
    • Request Body
    • Response
  • Using the Session Token
    • Vanilla TypeScript
    • React
  • Session Lifecycle
    • Expiration
  • Security
    • API Key Protection
    • Session Token Handling
    • Data Privacy
  • Error Handling
    • Session Creation Errors
    • Session Token Errors
  • Next Steps
JSON
JSON
JSON
TypeScript
React
TypeScript