Install a server-side SDK
Use the package manager in the preferred programming language to install the server-side SDK. Token generation can only be done server side and doing this client side is not recommended as it exposes the API key to customers.Please always check and install the latest release of the preferred SDK.
Initialize the SDK client
Next, initialize the SDK with the ID of the instance and the private key.The instance ID is the unique identifier for the deployment of the system and is included in every API call.
Together with the environment (sandbox or production) it is used to connect to the right APIs, as well as dashboard.
Generate a token
The next step is to create a new token for frontend authentication. The SDK comes with a helper function for exactly that purpose. It requires an amount and currency for the transaction to be created and additionally accepts either the ID of a buyer or an external identifier for a buyer to link the transaction to.Checkout sessions
Passing a checkout session ID to the Embed token function is recommended. This ID can be used to help identify multiple transaction attempts. This is useful to identify if one or more failed/declined transactions eventually result in a successful transaction. Checkout sessions can store also storecart_items, metadata, airline data, and more,
removing the need to pass these values on the transaction request.
Summary
In this step:- Created a signed JWT token using a server-side SDK.
- Served the JWT token to the front-end app, where it is used by Embed.