Skip to content

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

PropertyTypeRequiredDescription
appKeystringtrueMini-App appKey

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
codestringlogin credential

1.1.2 Share Text

SDK version: 1.1.0

API: mos.shareToApp(content)

Supports Promise-style invocation. Share text through mos.

Parameters

PropertyTypeRequiredDescription
contentstringtrueText content to be shared out

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure

1.1.3 Get User Information

SDK version: 1.1.0

API: mos.getUserInfo(Object object)

Supports Promise-style invocation. Each time the request will pop up the authorization window.

Parameters

[Object object]

PropertyTypeRequiredDescriptionLeast version
authorizedDescstringtruePurpose of Obtaining Authorization Information
closeOnClickOverlaystringfalseWhether to close the pop-up window after clicking the mask layer, 0: do not close, 1: close1.1.2

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure | CANCEL': user cancel
authorizednumber0: Not Authorized | 1: Authorized | 2: No Corresponding Information
firstNamestringSurname
lastNamestringGiven Name
headPortraitstringAvatar URL
descriptorstringProfile 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]

PropertyTypeRequiredDescriptionLeast version
authorizedDescstringtruePurpose of Obtaining Authorization Information
closeOnClickOverlaystringfalseWhether to close the pop-up window after clicking the mask layer, 0: do not close, 1: close1.1.2

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure | CANCEL': user cancel
authorizednumber0: Not Authorized | 1: Authorized | 2: No Corresponding Information
dialCodestringArea code
phonestringMobile Number
emailstringEmail 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

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
signstringSignature

1.1.6 Get Current Language

SDK version: 1.1.0

API: mos.getLanguage()

Supports Promise-style invocation.

Parameters

None

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
langstringLanguage, e.g. en_US

SDK version: 1.1.0

API: mos.setShareLink(link)

Supports Promise-style invocation.

Parameters

PropertyTypeRequiredDescription
linkstringtrueLink to be shared

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure

1.1.8 Invoke Payment

SDK version: 1.1.0

API: mos.pay(Object object)

Supports Promise-style invocation.

Parameters

[Object object]

PropertyTypeRequiredDescription
amountstringtrueAmount
currencystringtrueCurrency USD: US Dollar | KHR: Cambodian Riel
appKeystringtrueMini-App appKey
prepayIdstringtrueOrder Prepayment ID

Response

PropertyTypeDescription
resultstringSUCCESS: Payment succeeded | CANCEL: User canceled | NOWALLET: Wallet unavailable (unbound wallet/no payment password set)
datastringThe data field (containing server response) is only provided when payment result is SUCCESS.

1.1.9 Get Window Information

SDK version: 1.1.0

API: mos.getWindowInfo()

Supports Promise-style invocation.

Parameters

None

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
statusBarHeightnumberStatus Bar Height

1.1.10 Get Device Information

SDK version: 1.1.0

API: mos.getAppBaseInfo()

Supports Promise-style invocation.

Parameters

None

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
platformstringAPP Platform, 'IOS' | 'ANDROID'
SDKVersionstringsupported mos-js version, e.g: 1.1.0
languagestringAPP language, e.g: 'en-US'
versionstringAPP version, e.g: '1.0.0'
deviceIdstringdevice id
brandstringdevice brand
systemstringsystem version

1.1.11 Share Mini-App Page

SDK version: 1.1.0

API: mos.shareMiniApp(Object object)

Supports Promise-style invocation.

Parameters

[Object object]

PropertyTypeRequiredDescription
querystring | objectNoLaunch Parameters
shareDisabledstringNoDisable Sharing 1: Disabled | 0: Enabled
descstringNoPage Description: Typically the current page title
imageUrlstringNoImage URL: Displayed in Mini-App messages. Network image path, https address is recommended
screenShotDisabledstringNo1: 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 - English
    • km-KH - ភាសាខ្មែរ
    • ja-JP - 日本語
    • vi-VN - Tiếng Việt
    • zh-HK - 繁體中文(香港)
    • zh-TW - 繁體中文(臺灣)
    • th-TH - ภาษาไทย
    • ms-MY - Bahasa Melayu
    • ko-KR - 한국어
    • id-ID - Bahasa Indonesia
    • lo-LA - ລາວ
    • hi-IN - हिन्दी

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

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
shareLinkstringcurrent page link, e.g. https://mp.mos.me/mp/<miniapp_id>?query=xxxxx

1.1.12 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]

PropertyTypeRequiredDescription
querystring | objectNoLaunch Parameters
shareDisabledstringNoDisable Sharing 1: Disabled | 0: Enabled
descstringNoPage Description: Typically the current page title
imageUrlstringNoImage URL: Displayed in Mini-App messages. Network image path, https address is recommended
screenShotDisabledstringNo1: 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 - English
    • km-KH - ភាសាខ្មែរ
    • ja-JP - 日本語
    • vi-VN - Tiếng Việt
    • zh-HK - 繁體中文(香港)
    • zh-TW - 繁體中文(臺灣)
    • th-TH - ภาษาไทย
    • ms-MY - Bahasa Melayu
    • ko-KR - 한국어
    • id-ID - Bahasa Indonesia
    • lo-LA - ລາວ
    • hi-IN - हिन्दी

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

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
shareLinkstringcurrent page link, e.g. https://mp.mos.me/mp/<miniapp_id>?query=xxxxx

1.1.13 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

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
querystring | objectLaunch parameters

1.1.14 Add Tracking Event

SDK version: 1.1.1

API: mos.addTrackingEvent(Object object)

Supports Promise-style invocation.

Parameters

[Object object]

PropertyTypeRequiredDescription
namestringtrueEvent name
datastringfalseJSON string data

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure

1.1.15 Open Native Customer Service Chat Interface

SDK version: 1.1.3

API: mos.folderLinkClick(Object object)

Supports Promise-style invocation.

Parameters

[Object object]

PropertyTypeRequiredDescription
linkstringtrueCustomer service link, e.g.: https://mos.me/xxxxyyyyzzz
queryobjectfalseSupports parameters like customer source, context function, etc.

Response

PropertyTypeDescription
resultstring'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

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure | CANCEL': user cancel
codestringqrCode value

1.2.2 Make Phone Call

SDK version: 1.1.0

API: mos.makePhoneCall(phoneNumber)

Supports Promise-style invocation.

Parameters

PropertyTypeRequiredDescription
phoneNumberstringtruePhone number

Response

PropertyTypeDescription
resultstring'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]

PropertyTypeRequiredDescription
showstring11: show | 0: hide
stylestringdarkStatus bar font style dark: dark | light: light

Response

PropertyTypeDescription
resultstring'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]

PropertyTypeDefaultRequiredDescription
isHighAccuracystring0falseEnable high-accuracy positioning, 1: enable | 0: disable
highAccuracyExpireTimestring30000falseHigh-accuracy positioning timeout (ms). Returns highest accuracy within specified time. Values above 3000ms are required for high-accuracy positioning to take effect

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
latitudestringLatitude, range -90~90, negative for south
longitudestringLongitude, range -180~180, negative for west
addressstringAddress information
speedstringSpeed in m/s
accuracystringPosition accuracy indicating proximity to real location (e.g., 10 means 10m difference from real location, smaller is more accurate)
altitudestringAltitude in meters
verticalAccuracystringVertical accuracy in meters
horizontalAccuracystringHorizontal 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]

PropertyTypeDefaultRequiredDescription
fileUrlstringtrueFile online URL, starting with https or http
fileNamestringfalseFile name without extension. If empty, automatically gets the name from the file URL
fileExtstringfalseFile type (e.g., txt, png). If empty, automatically determines from file URL
showLoadingstring1falseWhether to show loading, 1: show | 0: hide
showMsgstring1falseWhether to show success/failure message, 1: show | 0: hide

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
messagestringError message
datastringSaved file path

1.4.1 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]

PropertyTypeDefaultRequiredDescription
filefiletrueFile object
fileNamestringfalseFile name without extension. If empty, automatically gets the name from the file object
fileExtstringfalseFile type (e.g., txt, png). If empty, automatically determines from file object
showLoadingstring1falseWhether to show loading, 1: show | 0: hide
showMsgstring1falseWhether to show success/failure message, 1: show | 0: hide

Response

PropertyTypeDescription
resultstring'SUCCESS': Success | 'FAILURE': Failure
messagestringError message
datastringSaved file path