MiniApp SDK Overview
Introduction
Zalopay MiniApp SDK provides functions for Merchant's Web application to directly interact or provide information in terms of navigation, user interface, user information,... on Zalopay application, and MiniApp Zalopay on Zalo application.
This document uses the following terms:
- zpa(Zalopay App): The function can only be used in the Zalopay application on both Android and iOS platforms
- zpi(Zalopay Integration in Zalo App): The function can only be used in the Zalopay miniapp in the Zalo application
- android: The function can only be used in the Zalopay application on the Android platform
- ios: The function can only be used in Zalopay application on iOS platform
Integration and usage instructions
- The Merchant's application integrates the SDK via CDN as follows:
<!-- SandboxQC Environment -->
<script src="https://qcmp.zalopay.vn/v1/mp/sdk/js-sdk.js?platform=iframe"></script>
<!-- Staging Environment -->
<script src="https://stgmp.zalopay.vn/v1/mp/sdk/js-sdk.js?platform=iframe"></script>
<!-- Production Environment -->
<script src="https://mp.zalopay.vn/v1/mp/sdk/js-sdk.js?platform=iframe"></script>
- MiniApp SDK Usage:
// The Merchant's application uses the SDK functions in the format: window.zlpSdk.[Category].[Function](params)
// Example: setTitle function
window.zlpSdk.UI.setTitle({ title: "Zalo Pay" })
.then((response) => console.log(response))
.catch((error) => console.error(error));
// Output: { data: {}, status: "success" }
// Error: { status: "error", errorCode: "000001", errorMessage: "An unknown error occurred" }
- Common error codes:
Description about common error codes when calling SDK functions in general:
Error Code | Description |
---|---|
000000 | Invalid parameter |
000001 | Unknown error |
000002 | Function not yet supported |
000003 | Merchant's App is not granted permission to use the function |
000004 | Invalid App Id |
Request permission to use the function
To be able to use some functions of the Zalopay MiniApp SDK, Merchant needs to send a permission request to the Zalopay team.
Instructions for running sample application using MiniApp SDK
- Use the sample application at ZPA (Zalopay App): Run deeplink zalopay://launch/app/999 in your mobile device
- Use the sample application at ZPI (Zalopay Integration in Zalo App): Launch url https://socialdev.zalopay.vn/spa/v2/sample-app in Zalo application
Test Application
Merchant can download various versions of Zalopay test applications at Zalopay's Test Wallets Page