Back-End Integrations
Your back-end is the trusted boundary for Hosted Experience. It authenticates with Aarthik Labs, decides which borrower can start a journey, passes pre-fill data, and returns only embedURL to the browser or mobile app.
Do not call Aarthik Labs directly from your front-end.
Backend Responsibilities
Your back-end should:
- store
PLATFORM_API_KEYin server-side configuration only - validate the authenticated borrower in your own app
- send a stable
borrowerProviderID - send an explicit
journeyType - pass only pre-fill data that your app is allowed to share
- return only
{ "embedURL": "..." }to the front-end - avoid caching session-creation responses
Recommended Endpoint
Most integrations create a small back-end endpoint such as:
Your front-end calls this endpoint. This endpoint calls Aarthik Labs.
Next.js App Router Example
Create a route such as app/api/credit/hosted-session/route.ts.
Product Availability Endpoint
If your app shows product-specific CTAs, call GET /api/lab/features from your back-end and use the returned catalogue to decide what to show.
Typical UI checks:
Error Handling
Handle platform responses as follows:
Important Rules
- Send
profile.contactNumberfor all journeys. It is a required field. - Send
journeyTypeexplicitly so product selection is predictable. - Create a fresh
embedURLwhen the borrower returns later. - Do not persist or expose platform API keys in front-end code, mobile apps, logs, or analytics events.