Start with the single recommended path: unified SDK, hosted payment, hosted login, backend verification, and result consumption
What this page solves: it defines the single recommended integration path for Youidian Unified Portal.
Who it is for: standard hosted integrations that want the fastest implementation path.
What you will get: one default route that an AI agent or developer can implement without making architecture choices.
Youidian Unified Portal hosts these capabilities:
The real SDK version in this repository is @youidian/sdk v3.1.0.
The default documentation teaches one route only:
@youidian/sdkPaymentUI from @youidian/sdk/client on the frontendLoginUI from @youidian/sdk/client on the frontendPaymentClient from @youidian/sdk/server on the backendloginToken and create the local user sessionIn the default path:
productCodeloginTokenapiUrl, checkoutUrl, loginUrl, baseUrl, or allowedOriginStarting in SDK v3.1.0, integrators can also call getActiveSubscription(userId) on the backend when they want to decide whether a pricing page should show “already purchased”, “upgrade”, or “manage plan”. That decision belongs to the integrator backend, not the public hosted checkout page.
For special control requirements, private deployment, or custom domains, see Advanced Integration.
Your backend
-> getProducts(...)
-> Your pricing page shows products, prices, and entitlements
-> Your frontend PaymentUI.openPayment({ appId, userId, productCode })
-> Youidian Unified Portal hosted payment page
-> User confirms product and pays
-> Youidian Unified Portal creates and advances the order
-> Frontend receives success callback with orderId
-> Your backend queries order / entitlements
-> Your system grants access or refreshes account state
Your frontend
-> LoginUI.openLogin({ appId })
-> Youidian Unified Portal hosted login page
-> User signs in
-> Frontend receives loginToken
-> Frontend posts loginToken to your backend
-> Backend verifyLoginToken(loginToken)
-> Your system matches or creates the local user and session
@youidian/sdk/login as the default entryloginToken