Skip to main content

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

  1. 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>
  1. 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" }
  1. Common error codes:

Description about common error codes when calling SDK functions in general:

Error CodeDescription
000000Invalid parameter
000001Unknown error
000002Function not yet supported
000003Merchant's App is not granted permission to use the function
000004Invalid 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

Test Application

Merchant can download various versions of ZaloPay test applications at ZaloPay's Test Wallets Page