If it has been over 14 days or you end the last trial attempt since you first
ran the sample app, your session is logged out. You must run the sample app
and acquire a new user token to proceed further. For instructions, see the
perform login part of Create Your First Wallet with Social
Logins
or Create Your First Wallet with Email
Authentication.
Step 1. Check wallet balance and obtain token ID
Before making an outbound transfer, you must have a token ID and token balance greater than0.
- Include
userTokencopied from the previous step in the header of aGETrequest to the/walletsendpoint. - From the response, copy
idwhich is your wallet ID.
- Using
idwhich you just copied, send aGETrequest to the/wallet/{id}/balancesendpoint to check your wallet’s token balance.
From the response, copy and store thetokenIdthat you intend to transfer.
Step 2. Estimate the cost of transaction (optional)
To estimate the fees for the transaction to transfer tokens, send aPOST
request to the transactions/transfer/estimateFee endpoint.
Response Body
Step 3. Initiate a blockchain transaction
Execute an asset transfer
To initiate a blockchain transfer from a specified wallet to a blockchain address:- Include
walletIdanddestinationAddressin aPOSTrequest to the/user/transactions/transferendpoint. - From the response, copy
challengeIdfor the next step.
Execute a contract
To create a transaction that executes a smart contract:- Include
walletIdandcontractAddressin aPOSTrequest to the/user/transactions/contractExecutionendpoint. - From the response, copy
challengeIdand enter it in the sample app.
If you do not have a wallet to use as a destination for the transfer, you can
create another user-controlled wallet or send funds to any other blockchain
wallet such as Metamask.
Step 4. Confirm execution
To authorize a transfer on the sample app’s confirmation UI, ensure you have obtained an active user token and encryption key.-
From the Execute Challenge screen in the sample app, paste the Challenge ID
that you copied from the previous step and select Execute.
The sample app displays a confirmation UI that contains transaction details for the user to confirm. You can customize confirmation UIs. For more, see Confirmation UIs .
Step 5. Check transaction status
As the transfer transaction’sstate changes and ultimately completes, Circle
sends webhook notifications to a
subscriber endpoint. For a list of all
possible states, see
Asynchronous States and Statuses.
The following code sample shows an example of a webhook notification for a
transfer.
JSON
userId or userToken in a GET request to
the /transactions endpoint.
JSON