Skip to main content

API Specifications

OVERVIEW

Mini APIs provide APIs for you to interact with the MoMo App Platform. Some APIs require you to submit for review before being used.

Versioning

Beta 1.0

INSTALLATION

To be able to install Mini API, please follow the document to set the NPM configuration

Mini API is installed automatically when you create Mini App. In case you want to update this package, run command below.

momo-miniapp update-packages

or run the command below to install new Mini API.

npm install @momo-miniapp/api

USAGE

To import and init MiniApi, call

/** import */
import MiniApi from "@momo-miniapp/api";

/** Call it once, only for Mini App WebView */
MiniApi.init({ appId: "", partnerCode: "" });

To call APIs

/** call API */
/** open QR code scanner */
MiniApi.scanQRCode((data) => {});

FUNCTIONS

User

NameDescription
requestUserConsentsRequest to access user’s information. It will show a bottom drawer to request for user information
getUserConsentsGet user info after permissions granted in requestUserConsents
getUserAuthGet user authentication
NameDescription
goHomeNavigate to home screen
goBackBack to previous screen
openUrlOpen url with callback deep link
openWebOpen web url
dismissAllDismiss all screen
dismissDismiss current screen and return result for previous route

Utilities

NameDescription
copyToClipboardCopy text to clipboard and show toast
shareShare text content to other apps                                    

Phone

NameDescription
openDialerOpen dialer to call                                

Image

NameDescription
getBase64FromUrlConvert image from url to base64 string
getImageGet image from gallery or capture new image
saveImageSave image to gallery
getImageSizeGet size image                                                                          

Storage

NameDescription
getItemGet data from storage
setItemSet data to storage
removeItemRemove data from storage

Permissions

NameDescription
requestPermissionRequest permissions on the device such as camera, location,...
checkPermissionCheck permission has granted                                            

Location

NameDescription
getLocationGet location of device                            

Camera

NameDescription
scanQRCodeGet data from qr code                                

Message, Dialog

NameDescription
showToastShow toast
hideToastHide toast
showToastSuggestionShow suggestion toast
hideToastSuggestionHide suggestion toast
showAlertShow dialog alert
showActionShow bottomsheet to choose action

Screen

NameDescription
showLoadingShow loading
hideLoadingHide loading