Overview

The webhook APIs your platform to build for LG(Legend Gateway) to call.

Exchanges or wallets need to implement a few webhook API endpoints for LP to call when some specific events happen.

For security reasons, you platforms MUST set an IP Address Whitelist, to make sure only LP's servers can access your APIs. LP team will provide our IP address list to you before your service goes live.

You also need to set a token-based API authentication, every API request should be sent with the token (in the header typically).

1. Balance API - /balances

This API allows LP to check a specific user's crypto asset balances, before the user sell the crypto asset.

If the user doesn't have sufficient balance, the sell will fail.

For example, if user David has 0.5 BTC at the exchange, and he's trying to sell 1 BTC, the trade will fail.

2. Trade Initiation Notify API - /trade-notify (required)

When an order was submitted by a user, the trade is initiated, LP notifies the exchange with the UID and the trade details.

Once received a notification, the exchange needs to check if this was a sell trade or a buy trade. If it was sell, the exchange needs to freeze the amount of sell crypto asset, and return a response to LP.

If the asset got frozen successfully, LP will execute the trade. 。

Note: make sure you test this process, if the exchange failed to freeze user assets, the user may be able to sell twice or even more times!

3. Trade Execution Notify API - /trade-execute (required)

Once a trade is executed,

  • if the trade succeeded, LP notifies the exchange.

If it was a sell trade, the exchange moves the user assets (frozen already) to Legend's wallet at the exchange.
This must be done in real-time, or near real-time.

  • If the trade failed, LP also notifies the exchanges.

If it was a sell trade, the exchange unfreeze user asset.

4. KYC Status Change API - /kys-status (optional)

LP sends a notification to the exchange when a user's KYC status changed.

For example, a new user got approved, the KYC status changed from submitted to approved.