Transak Docs
Search…
β˜•
JavaScript
The quickest way to get started is to use the JavaScript browser SDK:
<!DOCTYPE html>
<html>
​
<head>
<meta charset="utf-8" />
<script async src="https://cdn.transak.com/js/sdk/transak-v1.js"></script>
</head>
​
<body>
<script>
function launchTransak() {
let transak = new TransakSDK.default({
apiKey: '[YOUR_API_KEY]', // Your API Key
environment: '[ENVIRONMENT]', // STAGING/PRODUCTION
widgetHeight: '625px',
widgetWidth: '500px',
// Examples of some of the customization parameters you can pass
defaultCryptoCurrency: '[DEFAULT_CRYPTO]', // Example 'ETH'
walletAddress: '', // Your customer's wallet address
themeColor: '[COLOR_HEX]', // App theme color
fiatCurrency: '', // If you want to limit fiat selection eg 'USD'
email: '', // Your customer's email address
redirectURL: ''
});
transak.init();
// To get all the events
transak
.on(transak.ALL_EVENTS, (data) => {
console.log(data)
});
// This will trigger when the user marks payment is made.
transak.on(transak.EVENTS.TRANSAK_ORDER_SUCCESSFUL, (orderData) => {
console.log(orderData);
//transak.close();
});
}
window.onload = function() {
launchTransak()
}
</script>
</body>
​
</html>
Copy link