Skip to main content

Executing Mesh Transfers

To start a Link transfer within your application, the first step is to call the Link Token endpoint. This endpoint provides a short-lived (30 minute), one-time-use token for initializing a Link session using our client-side SDKs.

Step 1: Basic Transfer with Mesh Catalogue

The most basic way to initialize Link is to simply pass the userId and transferType key value pairs in the POST body. Link Modal will open up allowing your end user to choose from allowed Exchange and Wallets list set in Link Configurations

Use Case: onboarding with Mesh Deposits

In this demo, the destination address, transferType, userId and transactionId will be set automatically
tip
  • Use Full catalogue option as a catch all button, not as the primary way to load Mesh Modal
  • The userId is a unique ID representing the end user. This identifier is a map to reference your end user transferring through Mesh Link
  • Passing in multiple object items in the toAddresses array means the user will have a wide variety of assets to choose from.
  • by excluding amountInFiat field in JSON POST body, you're letting your user transfer how much they want to

Checkout the example request used for the demo:

curl --request POST \
--url https://integration-api.meshconnect.com/api/v1/linktoken \
--header 'accept: application/json' \
--header 'content-type: application/*+json' \
--data '
{
"transferOptions": {
"transferType": "deposit",
"toAddresses": [
{
"networkId": "0291810a-5947-424d-9a59-e88bb33e999d",
"symbol": "SOL",
"address": "DVifyLEUVxCAUTdi8rPHX9fmi1tCwv7hciut4BErskZ8"
},
{
"NetworkId": "e3c7fdd8-b1fc-4e51-85ae-bb276e075611",
"Symbol": "USDT",
"Address": "0x9Bf6207f8A3f4278E0C989527015deFe10e5D7c6"
},
{
"NetworkId": "7436e9d0-ba42-4d2b-b4c0-8e4e606b2c12",
"Symbol": "MATIC",
"Address": "0x9Bf6207f8A3f4278E0C989527015deFe10e5D7c6"

]

},
"restrictMultipleAccounts": true,
"userId": "123456"
}
'

Details

You can include as many toAddresses object items as needed to enable your users to perform transfers. Each item, represents the symbol they can transfer and the network it could be sent over. Please remember that for each item in the 'toAddresses' array, you must provide the Mesh UID for the network to which you are sending the supported token. The comprehensive list of tokens, networks and integrations that can Mesh supports can be found here: Tokens | Networks | Integrations

Step 2: Open directly to specific Wallet

Many of our customers and UI/UX designers want to load up Link with their buttons and skip our Full Catalogue and go right into the Wallet Transfer flow. This can be achieved by passing in the wallets integration ID.

In this demo, we have a custom drop down menu to let the user choose the Wallet they want to connect to
tip
  • Skips Mesh Catalogue and allows you to use unique buttons on the front end for popular wallets.
  • You will need to call Get API Status to get the individual identifiers for the wallets integrationId. Storing a copy or fetching in realtime are viable options
  • Do not pass fundingOptions object in body for defi Wallets

Example Request:

curl --request POST \
--url https://integration-api.meshconnect.com/api/v1/linktoken \
--header 'accept: application/json' \
--header 'content-type: application/*+json' \
--data '
{
"userId":"12345",
"restrictMultipleAccounts":true,
"integrationId":"34aeb688-decb-485f-9d80-b66466783394",
"TransferOptions": {
"toAddresses":[
{
"networkId":"networkId",
"symbol":"USDC",
"address":"networkAddress"
},
{
"networkId":"e3c7fdd8-b1fc-4e51-85ae-bb276e075611",
"symbol":"USDC",
"address":"0x6c3b4fE9764e9d80803c493044DF8Ba92916596d"
}
],
"amountInFiat":"amountInFiat",
"transactionId":"transactionId"
"transferType": "deposit",
};'

Step 3: Sending Assets to a Previously Connected User Account (bypass)

If you have a valid access token, you can skip Authentication in the Link Modal and jump right into a transfer. No need for user to re-authenticate

note

In this demo the Link Modal initial screen will be 'loading assets'.

tip
  • Follow our Handling auth tokens guide
  • Bypass is only for Exchanges. Wallets will always require the user signing the Authentication transaction
  • If you pass in more than one object item, Link Modal will only use the first item in the list (known limitation)
[
{
accountId: authData.accessToken.accountTokens[0].account.accountId,
accountName: authData.accessToken.accountTokens[0].account.accountName,
accessToken: authData.accessToken.accountTokens[0].accessToken,
brokerType: authData.accessToken.brokerType,
brokerName: authData.accessToken.brokerName,
},
];

Step 4: Skipping 'Input Amount' and 'Asset Select' screens

Use Case: Mesh Pay

note

Enforcing a specified amount and asset to be transferred, lets you skip 2 screens in the Link Modal (less user input) and is great for payment flows. Additionally, as the owner of the destination address, allows you to collect your asset of choice. But don't worry, in the Link Modal your end user can top up or convert an existing asset to the asset requested.

In this demo, you're saying I only want to receive USDC. If the user doesnt have enough of the request asset, Mesh will present additional payment options

tip
  • passing amountInFiat skips the 'input amount' screen in transfer flow.
  • passing in one object item in toAddresses array skips asset selection screen
  • good for payment uses cases- goods or services
  • include fundingOptions object to ensure user can top up or convert on their connected Exchange

Example:

{
"UserId": "EndUserId",
"TransferOptions": {
"ToAddresses": [
{
"NetworkId": "e3c7fdd8-b1fc-4e51-85ae-bb276e075611",
"Symbol": "USDC",
"Address": "0x9Bf6207f8A3f4278E0C989527015deFe10e5D7c6"
}
],
"AmountInFiat": 10,
"TransactionId": "TransactionId",
"fundingOptions": {
"enabled": true
}
}
}

Adding a Fee for a Payment

Details

If you’d like to charge a client fee for processing a transfer, you can append the ClientFee field to the above JSON object examples. This fee should only be used for Payments (when the transfer destination is an address owned by your company), and not for Deposits (when the transfer destination is an address owned by the end-user).

A percentage fee (input as a ratio, eg. 0.02500 = 2.500%) added onto your users' gross transfer to your company.

This will override any default fee entered in your Mesh dashboard for an individual transaction.

note
  • If your end users want to transfer more crypto than amount they have on their connected Exchange, you can pass fundingOptions object to instruct Mesh to pull FIAT from users connected payment methods, purchase or top up the additional crypto and then transfer- all in on Link Modal workflow.

  • If your end users want to convert another asset they're holding to the asset you're collecting, Link will present a convert option in the Transfer flow

Example request to add Convert and Topup functionality to the Transfer flow

curl --request POST \
--url https://integration-api.meshconnect.com/api/v1/linktoken \
--header 'accept: application/json' \
--header 'content-type: application/*+json' \
--data '
{
"restrictMultipleAccounts": true,
"userId": "12345789",
"transferOptions": {
"toAddresses": [
{
"networkId": "7436e9d0-ba42-4d2b-b4c0-8e4e606b2c12",
"symbol": "USDC",
"address": "0x2d2F82F3A4B82E4306632141382d5e3E80869128"
}
],
"amountInFiat": ,
"transactionId": "2c5ee0a6-0dd3-4689-a9c7-d7842db36a9e",
"transferType": "onramp",
"isInclusiveFeeEnabled": true,
"fundingOptions": {
"enabled": true
}
}
}
'
Details

Funding Options: Specifies the permitted options to use the end user's available buying power and/or payment methods to supplement the cryptocurrency balance if it is insufficient for the transfer.

Deposit Type:
Onramp: The user is using balances and linked payment methods in an exchange account to fund the purchase of crypto in their wallet on your platform.

isInclusiveFeeEnabled: Set to true if you're looking to include the fees in the amount being transfer

Click Next to learn about Mesh SDK events