1.1 Open Interfaces
The following interface supports Promise-style calls. When the result is 'SUCCESS', it returns resolve; otherwise, it returns reject.
1.1.1 Login
SDK version: 1.1.0
API: mos.login(appKey)
Supports Promise-style invocation.
Parameters
| Property | Type | Required | Description |
|---|---|---|---|
| appKey | string | true | Mini-App appKey |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| code | string | login credential |
1.1.2 Share Text
SDK version: 1.1.0
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
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
1.1.3 Get User Information
SDK version: 1.1.0
API: mos.getUserInfo(Object object)
Supports Promise-style invocation. Silently granting authorization will not cause an authorization window to pop up.
Parameters
[Object object]
| Property | Type | Required | Description | Least version |
|---|---|---|---|---|
| authorizedDesc | string | true | Purpose of Obtaining Authorization Information | |
| closeOnClickOverlay | string | false | Whether to close the pop-up window after clicking the mask layer, 0: do not close, 1: close | 1.1.2 |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure | CANCEL': user cancel |
| 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
SDK version: 1.1.0
API: mos.getUserContactInfo(Object object)
Supports Promise-style invocation.
Parameters
[Object object]
| Property | Type | Required | Description | Least version |
|---|---|---|---|---|
| authorizedDesc | string | true | Purpose of Obtaining Authorization Information | |
| closeOnClickOverlay | string | false | Whether to close the pop-up window after clicking the mask layer, 0: do not close, 1: close | 1.1.2 |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure | CANCEL': user cancel |
| 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
SDK version: 1.1.0
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 |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| sign | string | Signature |
1.1.6 Get Current Language
SDK version: 1.1.0
API: mos.getLanguage()
Supports Promise-style invocation.
Parameters
None
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| lang | string | Language, e.g. en_US |
TIP
lang Field Description:
- MosApp supports the following language types:
zh-CN- 简体中文en-US- Englishkm-KH- ភាសាខ្មែរja-JP- 日本語vi-VN- Tiếng Việtzh-HK- 繁體中文(香港)zh-TW- 繁體中文(臺灣)th-TH- ภาษาไทยms-MY- Bahasa Melayuko-KR- 한국어id-ID- Bahasa Indonesialo-LA- ລາວhi-IN- हिन्दी
1.1.7 Invoke Payment
SDK version: 1.1.0
API: mos.pay(Object object)
Supports Promise-style invocation.
Parameters
[Object object]
| Property | Type | Required | Description |
|---|---|---|---|
| amount | string | true | Amount |
| currency | string | true | Currency USD: US Dollar | KHR: Cambodian Riel |
| appKey | string | true | Mini-App appKey |
| prepayId | string | true | Order Prepayment ID |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 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.8 Get Window Information
SDK version: 1.1.0
API: mos.getWindowInfo()
Supports Promise-style invocation.
Parameters
None
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| statusBarHeight | number | Status Bar Height |
1.1.9 Get Device Information
SDK version: 1.1.0
API: mos.getAppBaseInfo()
Supports Promise-style invocation.
Parameters
None
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| platform | string | APP Platform, 'IOS' | 'ANDROID' |
| SDKVersion | string | supported mos-js version, e.g: 1.1.0 |
| language | string | APP language, e.g: 'en-US' |
| version | string | APP version, e.g: '1.0.0' |
| deviceId | string | device id |
| brand | string | device brand |
| system | string | system version |
1.1.10 Share Mini-App Page
SDK version: 1.1.0
API: mos.shareMiniApp(Object object)
Supports Promise-style invocation.
Parameters
[Object object]
| Property | Type | Required | Description |
|---|---|---|---|
| query | string | object | No | Launch Parameters |
| shareDisabled | string | No | Disable Sharing 1: Disabled | 0: Enabled |
| desc | string | No | Page Description: Typically the current page title |
| imageUrl | string | No | Image URL: Displayed in Mini-App messages. Network image path, https address is recommended |
| screenShotDisabled | string | No | 1: Disable Screenshot | 0: Auto-screenshot |
TIP
Query Field Description:
- If query is an object type and has an ogLang property, the page will prioritize using this property value as the language when parsing og tags. The values for ogLang are:
zh-CN- 简体中文en-US- Englishkm-KH- ភាសាខ្មែរja-JP- 日本語vi-VN- Tiếng Việtzh-HK- 繁體中文(香港)zh-TW- 繁體中文(臺灣)th-TH- ภาษาไทยms-MY- Bahasa Melayuko-KR- 한국어id-ID- Bahasa Indonesialo-LA- ລາວhi-IN- हिन्दी
- If you want to make your sharing link more attractive, you can tell applications that support OG tags (such as Telegram, Facebook, Twitter, etc.) to customize OG tags to determine the title, description, image, and redirect address of the link, so that users can more easily understand the content of the micro application when sharing.
Query supports setting four main attributes to customize shared content: ogTitle: Custom title displayed at the top of the sharing card, corresponding to the og: title tagogDesc: Share description, displayed in the middle of the share card, corresponding to the og: description tagogImg: Share images, preview images displayed on the card, corresponding to the og: image tagogURL: Share the redirect address, the link that the user clicks on after sharing the card, corresponding to the og: URL tag
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
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| shareLink | string | current page link, e.g. https://mp.mos.me/mp/<miniapp_id>?query=xxxxx |
1.1.11 Share Mini-App Page Data, Notify Mobile to Open Forwarding Page
SDK version: 1.1.0
API: mos.shareMiniAppData(Object object)
Supports Promise-style invocation.
Parameters
[Object object]
| Property | Type | Required | Description |
|---|---|---|---|
| query | string | object | No | Launch Parameters |
| shareDisabled | string | No | Disable Sharing 1: Disabled | 0: Enabled |
| desc | string | No | Page Description: Typically the current page title |
| imageUrl | string | No | Image URL: Displayed in Mini-App messages. Network image path, https address is recommended |
| screenShotDisabled | string | No | 1: Disable Screenshot | 0: Auto-screenshot |
TIP
Query Field Description:
- If query is an object type and has an ogLang property, the page will prioritize using this property value as the language when parsing og tags. The values for ogLang are:
zh-CN- 简体中文en-US- Englishkm-KH- ភាសាខ្មែរja-JP- 日本語vi-VN- Tiếng Việtzh-HK- 繁體中文(香港)zh-TW- 繁體中文(臺灣)th-TH- ภาษาไทยms-MY- Bahasa Melayuko-KR- 한국어id-ID- Bahasa Indonesialo-LA- ລາວhi-IN- हिन्दी
- If you want to make your sharing link more attractive, you can tell applications that support OG tags (such as Telegram, Facebook, Twitter, etc.) to customize OG tags to determine the title, description, image, and redirect address of the link, so that users can more easily understand the content of the micro application when sharing.
Query supports setting four main attributes to customize shared content: ogTitle: Custom title displayed at the top of the sharing card, corresponding to the og: title tagogDesc: Share description, displayed in the middle of the share card, corresponding to the og: description tagogImg: Share images, preview images displayed on the card, corresponding to the og: image tagogURL: Share the redirect address, the link that the user clicks on after sharing the card, corresponding to the og: URL tag
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
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| shareLink | string | current page link, e.g. https://mp.mos.me/mp/<miniapp_id>?query=xxxxx |
1.1.12 Get Launch Parameters
SDK version: 1.1.0
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 |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| query | string | object | Launch parameters |
1.1.13 Add Tracking Event
SDK version: 1.1.1
API: mos.addTrackingEvent(Object object)
Supports Promise-style invocation.
Parameters
[Object object]
| Property | Type | Required | Description |
|---|---|---|---|
| name | string | true | Event name |
| data | string | false | JSON string data |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
1.1.14 Open Native Customer Service Chat Interface
SDK version: 1.1.3
API: mos.folderLinkClick(Object object)
Supports Promise-style invocation.
Parameters
[Object object]
| Property | Type | Required | Description |
|---|---|---|---|
| link | string | true | Customer service link, e.g.: https://mos.me/xxxxyyyyzzz |
| query | object | false | Supports parameters like customer source, context function, etc. |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
1.2 Device
1.2.1 scanCode
SDK version: 1.1.0
API: mos.scanCode()
Supports Promise-style invocation.
Parameters
None
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure | CANCEL': user cancel |
| code | string | qrCode value |
1.2.2 Make Phone Call
SDK version: 1.1.0
API: mos.makePhoneCall(phoneNumber)
Supports Promise-style invocation.
Parameters
| Property | Type | Required | Description |
|---|---|---|---|
| phoneNumber | string | true | Phone number |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
1.2.3 Set Status bar
SDK version: 1.1.0
API: mos.setStatusbar(Object object)
Supports Promise-style invocation.
Parameters
[Object object]
| Property | Type | Required | Description |
|---|---|---|---|
| show | string | 1 | 1: show | 0: hide |
| style | string | dark | Status bar font style dark: dark | light: light |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
1.3 Location
1.3.1 Get Location
SDK version: 1.1.3
API: mos.getLocation(Object object)
Supports Promise-style invocation.
Parameters
[Object object]
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| isHighAccuracy | string | 0 | false | Enable high-accuracy positioning, 1: enable | 0: disable |
| highAccuracyExpireTime | string | 30000 | false | High-accuracy positioning timeout (ms). Returns highest accuracy within specified time. Values above 3000ms are required for high-accuracy positioning to take effect |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| latitude | string | Latitude, range -90~90, negative for south |
| longitude | string | Longitude, range -180~180, negative for west |
| address | string | Address information |
| speed | string | Speed in m/s |
| accuracy | string | Position accuracy indicating proximity to real location (e.g., 10 means 10m difference from real location, smaller is more accurate) |
| altitude | string | Altitude in meters |
| verticalAccuracy | string | Vertical accuracy in meters |
| horizontalAccuracy | string | Horizontal accuracy in meters (Android cannot get this, returns 0) |
TIP
When high-accuracy positioning is enabled, setting highAccuracyExpireTime too low may cause location acquisition to fail.
1.4 Files
1.4.1 Download Network File
SDK version: 1.1.3
API: mos.downNetFile(Object object)
Supports Promise-style invocation. If the file is an image or video, it will be saved to the photo album.
Parameters
[Object object]
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| fileUrl | string | true | File online URL, starting with https or http | |
| fileName | string | false | File name without extension. If empty, automatically gets the name from the file URL | |
| fileExt | string | false | File type (e.g., txt, png). If empty, automatically determines from file URL | |
| showLoading | string | 1 | false | Whether to show loading, 1: show | 0: hide |
| showMsg | string | 1 | false | Whether to show success/failure message, 1: show | 0: hide |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| message | string | Error message |
| data | string | Saved file path |
1.4.2 Download Local File
SDK version: 1.1.3
API: mos.downLocalFile(Object object)
Supports Promise-style invocation. If the file is an image or video, it will be saved to the photo album.
Parameters
[Object object]
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| file | file | true | File object | |
| fileName | string | false | File name without extension. If empty, automatically gets the name from the file object | |
| fileExt | string | false | File type (e.g., txt, png). If empty, automatically determines from file object | |
| showLoading | string | 1 | false | Whether to show loading, 1: show | 0: hide |
| showMsg | string | 1 | false | Whether to show success/failure message, 1: show | 0: hide |
Response
| Property | Type | Description |
|---|---|---|
| result | string | 'SUCCESS': Success | 'FAILURE': Failure |
| message | string | Error message |
| data | string | Saved file path |