Risk control SDK
This SDK collects user device information which will be submitted when orders are created via OpenAPI.
Merchant website access example
- production
- sandbox
Risk control SDK (legacy interface)
<script src="https://ramp.osl-pay.com/js/op-risk.min.js"></script>
<script>
// initialization deviceSessionId & forter token
await OSLPayRisk.init()
// get pay deviceSessionId
OSLPayRisk.getDeviceSessionId()
// get forter token
OSLPayRisk.getForterToken()
// If you have already used the old init API, you can use the following to get error information
OSLPayRisk.getLastErrors()
</script>
Risk control SDK (new version interface, recommended)
<script src="https://ramp.osl-pay.com/js/op-risk.min.js"></script>
<script>
// initialization pay deviceSessionId
async function getDeviceId() {
try {
await OSLPayRisk.initDeviceSession();
const seeId = OSLPayRisk.getDeviceSessionId();
console.log(seeId);
} catch (error) {
console.log(error);
}
}
getDeviceId();
// initialization forter token
async function getToken() {
try {
await OSLPayRisk.initForterToken();
const footId = OSLPayRisk.getForterToken();
console.log(footId);
} catch (error) {
console.log(error);
}
}
getToken();
</script>
If your website has Content Security Policy (CSP) headers set up, allow the following directives:
script-src [...] https://risk.checkout.com;
connect-src [...] https://fpjs.checkout.com https://fpjscache.checkout.com;
frame-src [...] https://risk.checkout.com;
Risk control SDK (legacy interface)
<script src="https://ramptest.osl-pay.com/js/op-risk.min.js"></script>
<script>
// initialization deviceSessionId & forter token
await OSLPayRisk.init()
// get pay deviceSessionId
OSLPayRisk.getDeviceSessionId()
// get forter token
OSLPayRisk.getForterToken()
// If you have already used the old init API, you can use the following to get error information
OSLPayRisk.getLastErrors()
</script>
Risk control SDK (new version interface, recommended)
<script src="https://ramptest.osl-pay.com/js/op-risk.min.js"></script>
<script>
// initialization pay deviceSessionId
async function getDeviceId() {
try {
await OSLPayRisk.initDeviceSession();
const seeId = OSLPayRisk.getDeviceSessionId();
console.log(seeId);
} catch (error) {
console.log(error);
}
}
getDeviceId();
// initialization forter token
async function getToken() {
try {
await OSLPayRisk.initForterToken();
const footId = OSLPayRisk.getForterToken();
console.log(footId);
} catch (error) {
console.log(error);
}
}
getToken();
</script>
If your website has Content Security Policy (CSP) headers set up, allow the following directives:
script-src [...] https://risk.sandbox.checkout.com;
connect-src [...] https://fpjs.sandbox.checkout.com https://fpjscache.sandbox.checkout.com;
frame-src [...] https://risk.sandbox.checkout.com;
SDK parameters-Functions
Original parameters-Functions
Method name | Description | Response |
---|---|---|
init() | SDK initialization completed | undefined |
getDeviceSessionId() | Obtain "getDeviceSessionId" returned by "checkout" | string |
getForterToken() | Obtain "token" returned by "forter" | string |
New parameters-Functions
Method name | Description | Response |
---|---|---|
initDeviceSession() | initialization deviceSessionId | string |
initForterToken() | initialization forterToken | string |
getLastErrors() | Get the error list (structure is described below) | Array<ErrorObject>interface ErrorObject { |
clearErrors() | Clear error log | void |