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