new Vexor()
Direct instantiation
There are 3 ways to instantiate a Vexor instance:
-
Using the
new Vexor()
constructor with publishable key, project id and secret key. - Using the
Vexor.init()
static method. - Using the
Vexor.fromEnv()
method to initialize the Vexor instance from environment variables.
In this section we will explain the first method.
Constructornew Vexor(params)
Vexor Constructor
Initialize a new Vexor instance to access vexor methods.
Parameters
Returns
Returns a new Vexor instance.
Reccomendations
- Create a
.env
file in your project root and add your Vexor environment variables:
WARNING: Do not store any secrets (such as VEXOR_SECRET_KEY) in your React app! These keys should be handled on the server side.
- Create a
vexor.ts
file in yourlib
orutils
folder and export the Vexor instance:
Choose the method that best fits your application's architecture and security requirements.
You can use the Vexor.fromEnv()
method to initialize the Vexor instance from environment variables without having to pass the keys in the constructor. In this case you will need to stick to the environment variables naming conventions for each framework/SDK.