Partner Onboarding Flow
⚠️ Path versioning update (post-2026-05-07): this document refers to
/partner/v1/...throughout as a historical placeholder. The live partner API in code is now mounted at/api/partner/v1/...(renamed per api-versioning-v1-migration-plan Phase 2b). When following the steps below, prefix every/partner/v1/...path with/api/. The rest of the document (auth model, scope, integration models) is still accurate.
Status (2026-06-23): shipped. The dedicated partner API described as future work in this plan now exists as
partner_service(port 8086, served at/api/partner/v1/...); the design narrative below is preserved for historical reference.
This document describes the partner onboarding flow for integrating with Kesles Merchant using the APIs that are currently available.
Goal
Partner onboarding must ensure three things:
- the partner understands the authentication model in use
- the partner only accesses endpoints that are actually allowed
- the partner has realistic expectations about the current API limitations
Currently Available Integration Models
There are two realistic integration models today:
1. Partner acting on behalf of a merchant/user
This pattern uses:
- OTP login
- bearer token
- access to merchant endpoints
Suitable for:
- partner apps
- embedded merchant portals
- partner analytics that requires data on a specific merchant
2. Partner as a server-to-server operational integration
This pattern does not currently have a dedicated partner contract. If absolutely needed, it usually goes via:
X-Internal-API-Key- a whitelist of specific endpoints
- additional safeguards
Only suitable for:
- strategic partners
- internal group integrations
- services that have been operationally approved
Recommended Partner Onboarding Flow
Stage 1. Kickoff and Scope
The partner and the Kesles team must agree on:
- the integration's goal
- what data will be accessed
- access frequency
- whether access is per-user or server-to-server
- who the operational owner and the technical owner are on each side
Checklist:
- partner name
- business use case
- product PIC
- technical PIC
- environment to use
- initial endpoint scope
Stage 2. Partner Type Classification
Classify the partner into one of these types:
Type A. Merchant delegated access
The partner reads merchant data with the merchant's consent.
Primary endpoints:
/auth/resolve-phone/auth/request-otp/auth/verify-otp/auth/profile/merchant/home-dashboard/merchant/transactions
Type A1. Referral / Sales Partner
This is a special derivative of delegated access.
Recommended rules:
- the partner may only see merchants that came from this referral partner
- merchant access is determined by the
referral_codeor an official partner-merchant mapping - there must be no global access to all merchants
Data typically required:
- referral merchant list
- referral merchant onboarding status
- referral merchant transaction summary
- aggregate referral partner performance
Type B. Reference data access
The partner only needs onboarding master data.
Primary endpoints:
/references/provinces/references/cities/references/districts/references/subdistricts/references/postal-codes/references/business-scales/references/business-types
Type C. Internal strategic integration
The partner needs deeper operational processes.
Current status:
- requires special approval
- no official partner API yet
- internal endpoints are not used directly without additional controls
Type D. Banking / Finance / Scoring Partner
This partner type usually needs transaction data access for:
- underwriting
- credit scoring
- business scoring
- merchant performance monitoring
Recommended rules:
- data access must be limited to approved merchants
- payloads must be more minimal than the internal dashboard
- sensitive fields must be masked or removed
- it is safer to use a scoring dataset than raw internal endpoints
Stage 3. Technical Preparation
What the Kesles team must prepare:
- environment base URL
- list of allowed endpoints
- request/response samples
- retry and timeout policy
- list of important error codes
What the partner must prepare:
- environment config
- request/response logging
- secure token storage
- refresh/relogin mechanism
- operational contact email
Stage 4. Basic Integration Test
Flow A. OTP Auth
- Partner calls
POST /auth/resolve-phone - If OTP is needed, partner calls
POST /auth/request-otp - User inputs OTP
- Partner calls
POST /auth/verify-otp - Partner stores the
access_token
Pass criteria:
- token successfully obtained
- token usable on bearer endpoints
- invalid-OTP error handled
Flow B. Read Profile
- Partner calls
GET /auth/profile - Validate user and merchant context
Pass criteria:
- merchant user data is read
- merchant status is consistent
Flow C. Read Dashboard
- Partner calls
GET /merchant/home-dashboard - Partner displays the summary
Pass criteria:
today_summaryis readrecent_transactionsis readweekly_gross_pointsis read
Flow D. Read Transactions
- Partner calls
GET /merchant/transactions - Test with several
periodvalues
Pass criteria:
- transaction summary matches
- transaction items appear
- empty state is handled
- merchant scope does not leak to other merchants
Stage 5. UAT
UAT must minimally verify:
- OTP login succeeds
- invalid token returns
401 - transactions are read for the correct merchant
- partner cannot access other merchants
- partner cannot access terminals, pairings, or device control
- partner retries do not cause excessive request spam
- referral partners cannot read merchants outside their referral
- finance partners only receive datasets that match the scoring scope
Stage 6. Go Live Checklist
- final list of endpoints used
- partner logging is active
- support SLA agreed
- timeouts agreed
- retry policy agreed
- rate limit agreed
- escalation contacts available
Current API Limitations
Partners need to know the current limitations:
- there is no
/partner/v1/...yet - no partner OAuth yet
- no scoped partner API keys yet
- no partner transaction webhook yet
- pagination is uneven
- filter/sorting is not formalized on all endpoints
- there is no
referral_code-based scope enforcement yet - there is no dedicated finance scoring dataset endpoint yet
Operational Recommendations
For partners starting now, I recommend:
- start with a
read-only integration - use stable bearer endpoints
- limit scope to profile, dashboard, transactions, and references
- defer partner write operations until the official
/partner/v1contract is built - do not open "all merchants" access to sales partners
- prepare a separate scoring payload for finance partners
Supporting Artifacts
Documents that should be provided to the partner:
Partner API ReferencePartner API OpenAPI- sample Postman collection
- error code mapping
- environment access note
Recommended Next Steps
Once basic onboarding is stable, continue with:
- designing
/partner/v1/... - partner credential model
- webhook event model
- per-partner audit log
- per-partner rate limit