1.1 Open Interfaces
1.1.1 Login
API: mos.login(appKey)
Supports Promise-style invocation
Parameters
Property | Type | Required | Description |
---|---|---|---|
appKey | string | true | Mini-App appKey |
Response
Property | Type | Description |
---|---|---|
code | string | TODO |
1.1.2 Share Text
API: mos.shareToApp(content)
Supports Promise-style invocation Share text through mos.
Parameters
Property | Type | Required | Description |
---|---|---|---|
content | string | true | Text content to be shared out |
Response
None
Example Code
mos.shareToApp(content)
1.1.3 Get User Information
API: mos.getUserInfo(authorizedDesc)
Supports Promise-style invocation Requires Pop-up Authorization,After user clicks "Authorize", returns corresponding information.
Parameters
Property | Type | Required | Description |
---|---|---|---|
authorizedDesc | string | true | Purpose of Obtaining Authorization Information |
Response
Property | Type | Description |
---|---|---|
authorized | number | 0-Not Authorized | 1-Authorized | 2- No Corresponding Information |
firstName | string | Surname |
lastName | string | Given Name |
headPortrait | string | Avatar URL |
descriptor | string | Profile Bio |
1.1.4 Get User Mobile/Email Information
API: mos.getUserContactInfo(authorizedDesc)
Supports Promise-style invocation
Parameters
Property | Type | Required | Description |
---|---|---|---|
authorizedDesc | string | true | Purpose of Obtaining Authorization Information |
Response
Property | Type | Description |
---|---|---|
authorized | number | 0- Not Authorized | 1- Authorized | 2-No Corresponding Information |
dialCode | string | Area code |
phone | string | Mobile Number |
string | Email address |
1.1.5 Get User Unique Signature
API: mos.getSign
Supports Promise-style invocation urpose of Obtaining User Signature to verify whether MOS has switched user accounts.
Parameters
None
Response
Property | Type | Description |
---|---|---|
sign | string | Signature |
1.1.6 Get Current Language
API: mos.getLanguage
Supports Promise-style invocation
Parameters
None
Response
Property | Type | Description |
---|---|---|
lang | string | Language, e.g. en_US |
1.1.7 Set Share Link
API: mos.setShareLink(link)
Supports Promise-style invocation
Parameters
Property | Type | Required | Description |
---|---|---|---|
link | string | true | Link to be shared |
Response
None
1.1.8 Invoke Payment
API: mos.pay(Object object)
Supports Promise-style invocation Error Handling (Client-Side)
Parameters
[Object object]
Property | Type | Required | Description |
---|---|---|---|
amount | string | true | Amount |
currency | string | true | Currency,USD-US Dollar |
appKey | string | true | Mini-App appKey |
prepayId | string | true | Order Prepayment ID |
Response
Property | Type | Description |
---|---|---|
result | string | Payment result SUCCESS-Payment succeeded | CANCEL-User canceled | NOWALLET-Wallet unavailable (unbound wallet/no payment password set) |
data | string | The data field (containing server response) is only provided when payment result is SUCCESS. |
1.1.9 Get Window Information
API: mos.getWindowInfo
Supports Promise-style invocation
Parameters
None
Response
Property | Type | Description |
---|---|---|
statusBarHeight | number | Status Bar Height |
1.1.10 Share Mini-App Page
API: mos.shareMiniApp(Object object)
Supports Promise-style invocation
Parameters
[Object object]
Property | Type | Required | Description |
---|---|---|---|
query | string | No | Launch Parameters parameters |
shareDisabled | string | No | Disable Sharing: 1 - Disabled |
desc | string | No | Page Description: Typically the current page title |
imageUrl | string | No | Image URL: Displayed in Mini-App messages |
screenShotDisabled | string | No | Disable Screenshot: 1-Screenshot prohibite | 0-Auto-screenshot |
TIP
Image display rules:
- If imageUrl is provided, it takes precedence.
- If imageUrl is empty:
- screenShotDisabled=1 Show default image (no screenshot)
- screenShotDisabled=0 Use system auto-screenshot
Response
None
1.1.11 Get Launch Parameters
API: mos.getLaunchOptions
Supports Promise-style invocation Retrieve the Mini-App's launch query parameters, e.g., https://mp.mos.me/mp/<miniapp_id>?query=<query>
.
Parameters
None
Response
Property | Type | Description |
---|---|---|
query | string | Launch parameters |
1.2 Device
1.2.1 Make Phone Call
API: mos.chooseContact(phoneNumber)
Supports Promise-style invocation
Parameters
Property | Type | Required | Description |
---|---|---|---|
phoneNumber | string | true | Phone number |
Response
None