--- url: >- https://acquirer-api-docs-v4-en.pingpongx.com/en/notes/riskManger/safePayGuardJs/index.md --- **SafePayGuardJs** is a risk control plugin for the payment process, including fraud prevention, fund security protection, and enhanced user experience. ## Installation ```javascript ``` ## Initialization ### Define Initialization Parameters ::: danger For sandbox testing, set `env`=`SANDBOX`. For production environment, set `env`=`PRODUCTION`. ::: ```javascript const options = { env: 'DEV', // 'SANDBOX'|'PRODUCTION' accId: accId, clientId: clientId, requestId: requestId, merchantUserId: merchantUserId, } ``` ### Initialize ```javascript SafePayGuardJs.init(options) ``` ## Get generatedData After initialization is complete, the plugin will automatically collect device fingerprints and risk control parameters. Before actually initiating the payment request, you only need to call the plugin's `getGeneratedData` method to obtain them (hereinafter referred to as generatedData), and pass them in the subsequent payment. Example: ```javascript const generatedData = SafePayGuardJs.getGeneratedData() // generatedData: { fingerPrint: string; forterSiteId: string; forterTokenCookie: string | null; riskExtendInfos: [{ channelCode: "1xxxxx0x", metadata: "xxx5xxxd5dxxxxxeaxxxxxxxdxfxx" }] } ```