Hybrid Integration Guide
Crawling + Webframe Checkout
This guide extends the Authorization Flow and Loyalty & Integration Guide. It describes a hybrid setup where integrators index merchants and products via API, and use the webframe for checkout and purchase flows.
π Overview
Some partners prefer to combine API-driven discovery with an embedded checkout experience. In this hybrid approach:
- The partner crawls or caches merchant and product data via the API.
- The checkout and payment flow still happens inside the Funtrips Webframe, preserving the secure session and consistent UI.
This gives you:
- Full control over how products are displayed in your own app or catalog.
- A seamless and secure checkout flow handled by Funtrips.
sequenceDiagram
autonumber
participant UserApp as User App (Mobile/Web)
participant PartnerBE as Partner Backend
participant FTAuth as Funtrips Auth
participant FTAPI as Funtrips API
participant FTWeb as Funtrips Webframe
%% 1) Server-to-server auth
PartnerBE->>FTAuth: POST /oauth/token (client_credentials)
FTAuth-->>PartnerBE: 200 { backend_bearer }
%% 2) Backend indexing (optional but common)
PartnerBE->>FTAPI: GET /v1/merchants (Auth: backend_bearer)
FTAPI-->>PartnerBE: 200 merchants
PartnerBE->>FTAPI: GET /v1/merchants/{merchant}/products (Auth: backend_bearer)
FTAPI-->>PartnerBE: 200 products
%% 3) Start a session for webframe
PartnerBE->>FTAPI: POST /v1/session (Auth: backend_bearer)
FTAPI-->>PartnerBE: 200 { session_code, frame_url?session_code=... }
%% 4) Open webframe (deep link to product/merchant)
UserApp->>FTWeb: Open frame_url (includes session_code)
%% 5) Webframe redeems code (no PKCE)
FTWeb->>FTAPI: POST /v1/oauth/token
FTAPI-->>FTWeb: 200 { public_bearer }
%% 6) Webframe loads content & checkout using public bearer
FTWeb->>FTAPI: GET /v1/... (Auth: public_bearer)
FTAPI-->>FTWeb: 200 content/availability
FTWeb->>FTAPI: POST /v1/merchants/{merchant}/checkouts (Auth: public_bearer)
FTAPI-->>FTWeb: 201 { checkout }
%% 7) (Optional) Partner polls checkout status
PartnerBE->>FTAPI: GET /v1/checkouts/{checkout_id} (Auth: backend or public, as applicable)
FTAPI-->>PartnerBE: 200 { status }
ποΈ 1. Crawl or Cache Merchant & Product Data
Using your backend bearer (Client Credentials), you can query:
- List merchants: GET /v1/merchants
- List products for a merchant: GET /v1/merchants/
merchant/products - Get product details: GET /v1/merchants/
merchant/products/product
You can use these endpoints to:
- Build your own local index or search results.
- Keep your catalog in sync with Funtrips updates.
- Display localized content (the API supports the locale parameter).
Tip: Use your backend bearer for this β no user session required. This avoids rate limits tied to public bearers and is ideal for nightly indexing or caching.
πͺ 2. Open the Webframe to a Product Page
Once you have a merchant alias, you can deep-link users directly into the Funtrips Webframe:
https://app.funtrips.io/frame/merchants/{merchant.alias}
π§βπ» 3. Session & Authentication Flow (Recap)
The hybrid model still uses the session code flow from the Authorization Guide:
- Authenticate server-to-server with client credentials.
- Create a session via POST /v1/session, including the external user ID.
- Use the returned code to open the webframe URL:
https://app.funtrips.io/frame/merchants/{merchant.alias}?session_code={code}
- Funtrips exchanges this code internally for the userβs public bearer.
π
4. Data Freshness & Sync Strategy
To ensure your merchant and product data remains up to date:
- Use
last_updatedfrom the meta block in list responses. - Periodically re-sync based on that timestamp.
- Cache aggressively for static data (merchant info, descriptions, images).
- Fetch dynamic data (calendar prices, availability) on demand when the user interacts.
π― 5. Why Hybrid?
| Capability | API | Webframe |
|---|---|---|
| Merchant + Product data | β Full control | βοΈ Auto-managed |
| Checkout & Payments | π« (Not via API) | β Fully handled |
| Security compliance | β Server-based | β Enforced |
| UX customization | β Custom | βοΈ Consistent White label design |
| Loyalty integration | π§© API or Webframe | β Built-in |
Hybrid integration is ideal when you want:
- Custom in-app presentation of merchants/products.
- Secure, plug-and-play checkout with zero PCI scope.
- Loyalty and session management handled automatically.
π§ 6. Summary
| Flow | Token | Endpoint | Use Case |
|---|---|---|---|
| Server-to-server | Backend bearer | /v1/merchants, /v1/products | Index and display catalog |
| Client (Webframe) | Public bearer | Internal to Funtrips | Checkout, payment, loyalty |
You stay in control of content and navigation, while Funtrips ensures security and transaction reliability.
Updated about 2 months ago
