SDK Functions | Parallel Developer Documentation

Parallel Developer Documentation Legacy – v1.x

This is documentation for Parallel Developer Documentation Legacy – v1.x, which is no longer actively maintained.

For up-to-date documentation, see the latest version (Current – v2.x).

Version: Legacy – v1.x

The Parallel Javascript SDK includes the following functions on the Parallel object if you're including our JavaScript directly or via the NPM Module.

import { useParallel } from '@parallelmarkets/react'

const ButtonBox = () => {

const { parallel } = useParallel()

// library may still be loading

if (!parallel) return null

// you can now call any of the functions below on the `parallel` variable

return <button onClick={() => parallel.login()}>Custom Parallel Button</button>

}
import { loadParallel } from '@parallelmarkets/vanilla'

const parallel = await loadParallel({

client_id: '123',

environment: 'demo',

flow_type: 'overlay',

})

// initiate a flow

parallel.login()
<script src="https://app.parallelmarkets.com/sdk/v1/parallel.js"></script>

<script>

Parallel.init({

client_id: '123',

environment: 'demo',

flow_type: 'overlay',

})

// initiate a flow

Parallel.login()

</script>
Function Description
api(path, callback) Call any of the Parallel APIs, and define callback functions for handling the response. See this page for more information on calling Server APIs from JavaScript.
getLoginStatus(callback) Get the login status of a user. It takes a single argument that is a callback function, which will be called once the user's login status can be determined. The callback function will be called with one argument described here.
hideButton() Hide the Parallel Login button that was rendered inside any elements on the page with the class parallel-login-button.
init(config) Initialize the Parallel Javascript SDK. Takes a single argument that is an object containing a client_id and any other desired configuration options.
login(opts) Initiate a Parallel Markets user login flow explicitly. This is useful if you want to start a flow based on some user action (apart from clicking a Parallel Passport button). Takes a single optional argument that is an object. The following optional keys are supported: