Transak Docs
Search…
Angular, React or Vue

Installation

npm: @transak/transak-sdk
npm
Transak SDK letting you easily integrate our fiat on ramp
To use the Transak widget with your Angular, React or Vue application, you will need to use @transak/transak-sdk (Transak’s JavaScript SDK).
Add the Transak SDK as a dependency using yarn or npm:
1
# Using yarn
2
$ yarn add @transak/transak-sdk
3
​
4
# Using npm
5
$ npm install @transak/transak-sdk
Copied!

Connecting the SDK to Transak

You can find more information on customization parameters here​
1
import transakSDK from '@transak/transak-sdk'
2
​
3
let transak = new transakSDK({
4
apiKey: '[YOUR_API_KEY]', // Your API Key
5
environment: '[ENVIRONMENT]', // STAGING/PRODUCTION
6
hostURL: window.location.origin,
7
widgetHeight: '625px',
8
widgetWidth: '500px',
9
// Examples of some of the customization parameters you can pass
10
defaultCryptoCurrency: '[DEFAULT_CRYPTO]', // Example 'ETH'
11
walletAddress: '', // Your customer's wallet address
12
themeColor: '[COLOR_HEX]', // App theme color
13
fiatCurrency: '', // If you want to limit fiat selection eg 'USD'
14
email: '', // Your customer's email address
15
redirectURL: ''
16
});
17
​
18
transak.init();
19
​
20
// To get all the events
21
transak.on(transak.ALL_EVENTS, (data) => {
22
console.log(data)
23
});
24
​
25
// This will trigger when the user marks payment is made.
26
transak.on(transak.EVENTS.TRANSAK_ORDER_SUCCESSFUL, (orderData) => {
27
console.log(orderData);
28
transak.close();
29
});
Copied!
Last modified 3mo ago