Back-end

Backend Integration

The backend integration includes

  1. Provide data to front-end SDK

In order to make the Front-end SDK work properly, the back-end needs to provide important data to the Front-end (SDK).

  1. Implement web-hook APIs

Provide the request signature (Required)

The backend needs to calculate a request signature and pass to the front-end SDK.

LG provides a sample code that you can use, you'll see it later.

Provide the UID (Required)

We need a unique user identifier (UID) as we need to know who is accessing our services.

Please encrypt your user's ID, most likely the primary key of your user data table, and provide to LG, as UID at LG.

A typical way of encrypting the user ID is

sha1(real_user_id+salt)

Feel free to change sha1 to any strong encryption algorithms that you prefer to use, e.g. sha256.

By encrypting the user_id, the risk of exposing your real user_id in the database is minimized.

The front-end SDK will make this UID the value of the variable APP_UID.

Provide the Email address (Required)

The front-end SDK will make this Email the value of the variable APP_EMAIL.

Web-hook APIs to receive notifications from LG- (Required)

Two web-hook APIs need to be implemented

  1. /trade-notify, to receive a notification when a trade was initiated
    When a trade is initiated, LG notifies you with the trade details (asset, price, amount, time, etc.)

  2. /trade-execute, to receive a notification of the trade result, when a trade was executed
    When a trade has been executed, LG notifies you again, with the same trade details, and the result (succeeded or failed).

You may store all the trade notifications into databases for your records. It might be useful for your operation team and finance team in future.

Note:
If the trade was to sell crypto assets, you need to freeze the user's crypto assets, move to our wallet at your exchange. We'll explain later in the API endpoint docs.

Implement an API - check current user's crypto balance - (Optional)

If you'd like to enable the off-ramp service where users can sell crypto assets and withdraw money to bank accounts, you'll need to implement an API for LG to call and check the available crypto balances.

The user has to have sufficient crypto assets to sell.

Ignore this if you'd like to enable fiat on-ramp only. In the case users can only buy crypto assets, but not sell.

Web-hook API to receive notifications when the KYC status changed(Optional)

When a user's KYC status changes, LG sends a notification to the exchange.

Other Integrations (Optional)

If you'd like to check the historical data of your users' trades or settlements, you can do so by calling REST APIs.