Trade Widget

Supported query parameters

The widget supports a number of configuration options defined using query parameters.

🚧

Important:

Every parameter has to be encoded to be used in the URL. E.g. using encodeURIComponent(yourParameter) in JS.

Skip Trade Widget UI screens:

By passing some of the parameter values in the Trade Widget URL, specific Trade Widget UI screens will be skipped, effectively simplifying the customer's flow. Please find detailed explanation of which UI screens are skipped based on the provided parameters:

  • Passing the transferInMedia will set the payment method accordingly and the customer will not have to select the payment method again on Coinify's Trade Widget.
  • If buyAmount,defaultFiatCurrency, and defaultCryptoCurrency are provided, the Quote UI will be skipped.
  • Providing the address value will skip the screen where the customer is asked to provide the receiving crypto address.

If you're already collecting any of this datapoints on your end, it is recommended to pass these values to Coinify's Trade Widget for a more seamless customer experience. We encourage you to test the flow yourself to get a better understanding of the flow with and without providing these parameters.

ParameterDescription
partnerIdid you got from Coinify
partnerNamename to be displayed in the widget as partner name, currently used when displaying partner fee if enabled, defaults to 'Partner'. Can be string or object (just has be be provided as url encoded string, see example)
partnerContextFree context for partners to receive in webhooks, can be stringified JSON as well. Partner context may also be provided using settings.partner-context-changed
primaryColorcolor of the primary button; Accepted: named value e.g. blue, hash value e.g. #00ff00, or rgba(0,255,0,1)
cryptoCurrenciescomma separated list of crypto currencies to support in the widget. Will include only the listed crypto currencies from those supported by default
fiatCurrenciescomma separated list of fiat currencies to support in the widget. Will include ony the listed fiat currencies from those supported by default
defaultCryptoCurrencydefines the crypto currency initially selected on Buy/Sell quotes if multiple crypto currencies are available
defaultFiatCurrencydefines the fiat currency initially selected on Buy/Sell quotes if multiple fiat currencies are available
buyAmountdefines initial amount on Buy quotes. Note, often used with targetPage, defaultCryptoCurrency, and defaultFiatCurrency defined
sellAmountdefines initial amount on Sell quotes. Note, often used with targetPage, defaultCryptoCurrency, and defaultFiatCurrency defined
isBuyAmountFixedIf set to true, the specified buyAmount is locked and cannot be changed from the Trade Widget UI. Accepts true or false values.
isSellAmountFixedIf set to true, the specified sellAmount is locked and cannot be changed from the Trade Widget UI. Accepts true or false values.
addressdefines default wallet address to receive funds at when buying crypto currencies, and default wallet address to refund funds to when selling crypto currencies in case the sell cannot be completed. See details on how to use address below.
addressSignatureprovides HMAC-SHA-256 signature for address. Only used if a shared secret has been established with Coinify. See details on how to use address below.
confirmMessagesdefines if external confirmation of trade messages is required. When provided the widget will await confirmation messages from hosting window before continuing flow. See details on how to use messages below.
memodefines an optional memo/destination tag accepted by some crypto currencies. See details on how to use address below.
noSignupdefines whether to support signup through the widget. Note the negation! Available values are 'false' (allow signup for corporate & individuals), 'true' (allow no signup), 'corporate' (allow signup only for individual traders) and 'individual' (allow signup only for corporate traders).
targetPagedefines a target landing page other than the default. Available values are 'login', 'signup', 'signup-corporate', 'buy', 'sell' and 'trade-history'
refreshTokenused for custom onboarding flows. The refeshTokencan be obtained by calling one of the auth endpoints. The refreshToken should be URL encoded so that the browsers interprets it correctly.
transferInMedialist of transfer media for inbound payment method. Available: card, bank, blockchain. See details on how to use below.
transferOutMedialist of transfer media for outbound payment method. Available: bank, blockchain. See details on how to use below.
returnURLthe URL that you want to redirect the customer to upon successfuly completed trade. The provided URL must be url-encoded. Note that this query parameter is only available for the Customised Landing Page URL.

Address signature

// Javascript example of how to generate signature from secret and address
const crypto = require('crypto');

const address = 'crypto-address';
const secret = 'shared-secret';

const accountSignature = crypto.createHmac('SHA256', secret).update(address).digest('hex');

In order to ensure that the address passed into the widget has not been tampered with, we have the possibility for you to sign the address(es) using a shared secret, and passing the signature to the widget as well.


Widget Sizes


Trade Widget Sandbox Testing

In order to test trades in the Trade Widget, use the widget's sandbox environment base URL. Transactions completed in the sandbox environment have no value. Complete flow for Buy trades is available only for USDC on Ethereum's Sepolia testnet and BTCt on BTC testnet3 network. However, the complete Sell trades flow in sandbox is available only using the BTC testnet3 network.

CurrencyNetworkWallet Setup Tutorial
USDCSepolia testnet[Metamask Sepolia and USDC Setup] (https://help.coinify.com/hc/en-us/articles/10101842554012). Recommended for Buy Trade testing.
BTCtTestnet3[Bitcoin Testnet Wallet Setup] (https://help.coinify.com/hc/en-us/articles/4406615449500). Recommended for Sell Trade testing.

Buy Button

Buy Button is a simple web component that opens up trade widget in a 768x576 popup.

How to use

Add the following code into your web page:
for sandbox

  <script src="https://trade-ui.sandbox.coinify.com/components/buy-button.js"></script>
  ...
  <buy-button
        url="https://trade-ui.sandbox.coinify.com?partnerId={replace-with-assigned-id}&primaryColor=blue&cryptoCurrencies=BTC,ETH,XLM"
      />

for production

  <script src="https://trade-ui.coinify.com/components/buy-button.js"></script>
  ...
  <buy-button
        url="https://trade-ui.coinify.com?partnerId={replace-with-assigned-id}&primaryColor=blue&cryptoCurrencies=BTC,ETH,XLM"
      />

url property points to the trade widget just as in the example.

🚧

The partnerId queryString parameter must be set to the proper value so that users can be registered with your company.

Styling the Buy Button

Custom CSS properties exposed

PropertyDescription
background-colorcolor of the button
colorcolor of the text

Style using custom CSS properties

  <style type="text/css">
    buy-button {
      --background-color: #8fc065;
    }
  </style>

Style using CSS

  buy-button button {
    background-color: #8fc065;
  }