downloadImage
Supported Version
zpa
Started support in Zalopay App from version 8.21.0Description
Load and save images from url or base64 data
Parameters
Param | Data type | Required | Description |
---|---|---|---|
type | string | Yes | Image data type, which is 1 of 2 values 'url' or 'base64' |
url | string | No | Path to image if type is 'url' |
base64 | string | No | Base64 data if type is 'base64' |
Return Value
N/A
Error Code
Error Code | Description |
---|---|
010401 | Invalid URL |
010402 | Invalid base64 data |
010403 | Data error |
010404 | Saving 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" }