Skip to main content

downloadImage

Note
Please contact Zalopay Team to be granted permission to use this functionality.

Supported Version

zpa
Started support in Zalopay App from version 8.21.0

Description

Load and save images from url or base64 data

Parameters

ParamData typeRequiredDescription
typestringYesImage data type, which is 1 of 2 values 'url' or 'base64'
urlstringNoPath to image if type is 'url'
base64stringNoBase64 data if type is 'base64'

Return Value

N/A

Error Code

Error CodeDescription
010401Invalid URL
010402Invalid base64 data
010403Data error
010404Saving image failed

Sample Code and Sample Return Data

Sample Request:

window.zlpSdk.Device
.downloadImage({ type: "url", url: "https://link.image.jpg" })
.then((response) => console.log(response))
.catch((error) => console.error(error.errorCode));

Sample Response:

{ data: {}, status: "success" }