setTargets

Sets the allowed myzPAX origin(s) that messages can be sent to and received from.

This function should be called once during initialization to configure the parent origins that the child iframe is allowed to communicate with using postMessage.

Note: All messages sent via sendZpaxMessage will be dispatched only to the origins configured using this function.

Parameters

NameTypeDescription
tstring[]An array of target origin URLs (e.g., https://myzpax.com).

Example Usage

// In production environment
setTargets(['https://myzpax.com']);
// In sandbox environment
setTargets(['https://sandbox.myzpax.com']);

Related