Crypto Deposits

Use this developer guide for an efficient integration to the Crypto Deposits SDK

📘

You must use zh-web-sdk >= 3.8.0 to be able to use this product


Acquire Access Token

To invoke the Crypto Deposits SDK, you'll need to acquire an access token using crypto-deposits permission. Please see endpoint API Reference here. After obtaining the access token, you can start using the SDK.

Web Application

We recommend to first read our Overview, Installation and Getting Started guides.

Example using React:

import { useMemo } from 'react'
import ZeroHashSDK, { AppIdentifier } from 'zh-web-sdk'

// Mint this JWT on your server by exchanging your ZeroHash API key. Never do the
// exchange in the browser.
const jwt = '<JWT_TOKEN_HERE>'

const App = () => {
  // Create the SDK once, not on every render. Use 'cert' for sandbox, 'prod' to go live.
  const sdk = useMemo(() => new ZeroHashSDK({ env: 'cert' }), [])

  const openCryptoDeposits = () =>
    sdk.openModal({ appIdentifier: AppIdentifier.CRYPTO_DEPOSITS, jwt })

  return <button onClick={openCryptoDeposits}>Deposit crypto</button>
}

export default App

For a line by line explanation on how to integrate, please take a look at the following guide (note that the guide may target a different App, but the process should be the same for all Apps):

Native mobile

To use our SDK on mobile apps, we have native SDK solutions available in three different flavors: Kotlin , Swift and Capacitor . You can find more about each on their respective guides below:

For more info, head to our Integration with Mobile Apps page and select the platform you're using to build your app.

Events

We forward events from the UI to the native app using the postMessage API. You can handle these events from the WebView component. Currently, these are the events we have:

MessageMeaning
CRYPTO_DEPOSITS_APP_LOADEDThe SDK is loaded and visible to the customer.
CRYPTO_DEPOSITS_CLOSE_BUTTON_CLICKEDThe close (X) button was clicked in the top right corner of the UI.
CRYPTO_DEPOSITS_COMPLETED

The Deposit submitted by the customer resulted in a successful transaction and a "Transaction confirmed" page was displayed to the user.

The payload of this event is: type: "CRYPTO_DEPOSIT_COMPLETED", transactionId: <TRANSACTION_ID>, cryptoDepositId: <CRYPTO_DEPOSIT_ID>

CRYPTO_DEPOSITS_FAILED

The Deposit submitted by the customer resulted in a failed transaction and a "Transaction failed" page was displayed to the user.

The payload of this event is: type: "CRYPTO_DEPOSITS_FAILED", transactionId: <TRANSACTION_ID>, cryptoDepositId: <CRYPTO_DEPOSIT_ID>

TOKEN_EXPIREDThe token is expired and needs to be refreshed. See Acquire Access Token to refresh it.

Webhooks and status updates

You can see our full list of status updates and webhooks on the link below: