Skip to content

1.1 Open Interfaces

1.1.1 Login

API: mos.login(appKey)

Supports Promise-style invocation

Parameters

PropertyTypeRequiredDescription
appKeystringtrueMini-App appKey

Response

PropertyTypeDescription
codestringTODO

1.1.2 Share Text

API: mos.shareToApp(content)

Supports Promise-style invocation Share text through mos.

Parameters

PropertyTypeRequiredDescription
contentstringtrueText content to be shared out

Response

None

Example Code

js
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

PropertyTypeRequiredDescription
authorizedDescstringtruePurpose of Obtaining Authorization Information

Response

PropertyTypeDescription
authorizednumber0-Not Authorized | 1-Authorized | 2- No Corresponding Information
firstNamestringSurname
lastNamestringGiven Name
headPortraitstringAvatar URL
descriptorstringProfile Bio

1.1.4 Get User Mobile/Email Information

API: mos.getUserContactInfo(authorizedDesc)

Supports Promise-style invocation

Parameters

PropertyTypeRequiredDescription
authorizedDescstringtruePurpose of Obtaining Authorization Information

Response

PropertyTypeDescription
authorizednumber0- Not Authorized | 1- Authorized | 2-No Corresponding Information
dialCodestringArea code
phonestringMobile Number
emailstringEmail 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

PropertyTypeDescription
signstringSignature

1.1.6 Get Current Language

API: mos.getLanguage

Supports Promise-style invocation

Parameters

None

Response

PropertyTypeDescription
langstringLanguage, e.g. en_US

API: mos.setShareLink(link)

Supports Promise-style invocation

Parameters

PropertyTypeRequiredDescription
linkstringtrueLink 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]
PropertyTypeRequiredDescription
amountstringtrueAmount
currencystringtrueCurrency,USD-US Dollar
appKeystringtrueMini-App appKey
prepayIdstringtrueOrder Prepayment ID

Response

PropertyTypeDescription
resultstringPayment result SUCCESS-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

API: mos.getWindowInfo

Supports Promise-style invocation

Parameters

None

Response

PropertyTypeDescription
statusBarHeightnumberStatus Bar Height

1.1.10 Share Mini-App Page

API: mos.shareMiniApp(Object object)

Supports Promise-style invocation

Parameters

[Object object]

PropertyTypeRequiredDescription
querystringNoLaunch Parameters parameters
shareDisabledstringNoDisable Sharing: 1 - Disabled
descstringNoPage Description: Typically the current page title
imageUrlstringNoImage URL: Displayed in Mini-App messages
screenShotDisabledstringNoDisable 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

PropertyTypeDescription
querystringLaunch parameters

1.2 Device

1.2.1 Make Phone Call

API: mos.chooseContact(phoneNumber)

Supports Promise-style invocation

Parameters

PropertyTypeRequiredDescription
phoneNumberstringtruePhone number

Response

None