The Transak JavaScript SDK integration allows you to integrate Transak into your application, making it easy to launch and manage the Transak interface within your web project.
Initialize the SDK with widgetUrl and add event listeners in your app.
Example:
React: Cleanup - If you are using React 18+, do not forget to run the cleanup code.
Call the Create Widget URL API from your backend to generate a secure widget url using
The response returns a widgetUrl that should be passed as widgetUrl in Step 2.
A widgetUrl is valid for 5 minutes and can only be used once. A new widgetUrl must be generated for every user flow.
Example Request:
The Transak SDK emits the following events, which you can use to track state and user actions.