Make sure to initialize the SDK to be able to use the tools offered by Matic.
The MaticSDK function allows to initialize an instance of the SDK to be able to execute any of the SDK elements.
Parameters:
The instance of the SDK receives two parameters
SDK Key Parameter
A parameter with the SDK Key of your authentication in Matic
Options Parameter
In addition to the SDK key, MaticSDK is given some options on its functionality. The options parameter is optional because all of its properties have default values and accepts the following keys:
Parameter | Description | Type | Default |
---|---|---|---|
is_sandbox | Indicates whether the SDK element should be opened in sandbox mode. | Boolean | False |
auto_close_time | Number of seconds to close the SDK element after completing a transaction. If the number is less than zero, the window will not close automatically. | Number | -1 |
default_method | Default payment method that will be displayed when opening the SDK item. The options are "account" and "card". | String | 'account' |
Example data:
{
is_sandbox: false,
auto_close_time: 5,
default_method: 'card',
}
Example usage
import MaticSDK from '@matic.co/sdk'
const options = {
is_sandbox: true,
}
const Sdk = MaticSDK('your sdk_key (old "pubkey")', options);
if (window.MaticSDK) {
const options = {
is_sandbox: true,
}
// Initilalize instance
const SDK = window.MaticSDK('your sdk_key (old "pubkey")', options);
}