Acquire Access Token
To invoke the Crypto Withdrawals SDK, you'll need to acquire an access token using crypto-withdrawals permission. Please see endpoint API Reference here. After obtaining the access token, you can start using the SDK.
Web Application
Example using React:
import React from 'react';
import ZeroHashSDK, { AppIdentifier } from 'zh-web-sdk';
const App = () => {
const sdk = new ZeroHashSDK({
. env: "cert",
cryptoWithdrawalsJWT: "<JWT_TOKEN_HERE>"
});
sdk.openModal({appIdentifier: AppIdentifier.CRYPTO_WITHDRAWALS})
return <></>;
}
export default App;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:
| Message | Meaning |
|---|---|
| CRYPTO_WITHDRAWALS_APP_LOADED | The SDK is loadedSDK loaded and is visible to the customer. |
| CRYPTO_WITHDRAWALS_CLOSE_BUTTON_CLICKED | The close (X) button was clicked in the top right corner of the UI. This action hides the modal while preserving the UI state. When reopened in the same instance, the UI will display with the state it had when it was closed. |
| CRYPTO_WITHDRAWALS_COMPLETED | The flow was completed and internal calls were made successfully. Note: “completed” does not equate to “approved” or “success”. The flow can be successfully completed, but the participant status could be “rejected”, for example. |
| CRYPTO_WITHDRAWALS_FAILED | The customer encountered an error that cannot be rectified in their current session. |
| TOKEN_EXPIRED | The token is expired and needs to be refreshed. See Acquire Access Token to refresh it. |