Get Started
Install the package and initialize TransakProtocol on your backend with your API key and authenticated callbacks.
This guide covers installation and initializing the protocol. You need Node.js, npm, and Transak partner credentials from your Transak Partner Dashboard.
Installation
Run the following to install @transak/wdk-protocol-fiat-transak:
npm install @transak/wdk-protocol-fiat-transakInitialize TransakProtocol
Create the protocol inside an authenticated backend handler with new TransakProtocol(account, config). The partnerApiKey, environment, createWidgetUrl, and getOrder values below are the server-side helpers described in Configuration:
import TransakProtocol from '@transak/wdk-protocol-fiat-transak'
function createTransakProtocol(userIp) {
return new TransakProtocol(undefined, {
apiKey: partnerApiKey,
widgetUrl: (widgetParams) => createWidgetUrl(widgetParams, userIp),
getOrder,
environment // use the same value as the callback origins
})
}Run the protocol itself on your backend. In addition to the authenticated widgetUrl and getOrder callbacks, the module calls Transak's country, currency, and quote APIs directly with your partner API key. Transak requires those requests to originate from an allow-listed backend. Derive userIp from trusted request or CDN context, not a browser-provided value.
Expose narrowly scoped, authenticated routes to your client and return only the widget URL or data it needs. See Configuration for the full backend implementation, response validation, cacheTime, and environment-specific hosts.
The module does not need a signing-capable account. Pass a validated recipient to buy() when you want to prefill the user's destination address, or omit it to let the widget ask.