# Self-Custodial Wallet Payouts BlockBee's Self-Custodial Wallet system allows you to automate sending cryptocurrency payments to multiple addresses. This system requires **API Key V2** and provides you with full control over your funds while maintaining security through advanced cryptography. ## Overview ### Key Concepts - **Self-Custodial Wallet**: Your own cryptocurrency wallet managed by BlockBee with advanced security features - **Payout Request**: Individual payment instruction (address + amount) for a specific cryptocurrency - **Payout**: Collection of Payout Requests that are processed together - **API Key V2**: Required authentication for Self-Custodial Wallet operations > **WARNING** >**CRITICAL** If you lose both your API Key V2 and Recovery Key, you will permanently lose access to your Self-Custodial Wallet. BlockBee cannot access your wallet without these keys. ### How It Works 1. **Create Payout Requests**: Define the addresses and amounts you want to send 2. **Process Payouts**: Send the requests to be executed by your Self-Custodial Wallet 3. **Monitor Status**: Track the progress and completion of your payouts 4. **Manage Balance**: Check your wallet balance and address ## Prerequisites - **API Key V2**: You must upgrade from API Key V1 to V2 to use Self-Custodial Wallet - **Sufficient Balance**: Ensure your Self-Custodial Wallet has enough funds for payouts + fees - **Supported Cryptocurrencies**: Check our [cryptocurrencies page](https://blockbee.io/cryptocurrencies) for supported tickers ## Recommended Workflow ### 1. Create and Process Payouts You have two approaches for creating payouts: #### Option A: Bulk Process (Recommended) Use the bulk process endpoint to create and send multiple payouts efficiently in one request: ```javascript const payoutData = { outputs: { '0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d': 0.2, '0x18B211A1Ba5880C7d62C250B6441C2400d588589': 0.1 } }; const response = await fetch('https://api.blockbee.io/btc/payout/request/bulk/process/?apikey=YOUR_API_KEY_V2', { method: 'POST', headers: { 'Content-Type': 'application/json', 'apikey': 'YOUR_API_KEY_V2' }, body: JSON.stringify(payoutData) }); const result = await response.json(); const payoutId = result.payout_info.id; console.log('Payout ID:', payoutId); ``` ```php [ '0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d' => 0.2, '0x18B211A1Ba5880C7d62C250B6441C2400d588589' => 0.1 ] ]; $url = 'https://api.blockbee.io/btc/payout/request/bulk/process/?apikey=YOUR_API_KEY_V2'; $options = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-Type: application/json', 'content' => json_encode($payoutData) ] ]; $context = stream_context_create($options); $response = file_get_contents($url, false, $context); $result = json_decode($response, true); $payoutId = $result['payout_info']['id']; echo 'Payout ID: ' . $payoutId; ?> ``` ```python import requests import json payout_data = { 'outputs': { '0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d': 0.2, '0x18B211A1Ba5880C7d62C250B6441C2400d588589': 0.1 } } url = 'https://api.blockbee.io/btc/payout/request/bulk/process/' params = {'apikey': 'YOUR_API_KEY_V2'} headers = {'Content-Type': 'application/json'} response = requests.post(url, params=params, headers=headers, json=payout_data) result = response.json() payout_id = result['payout_info']['id'] print('Payout ID:', payout_id) ``` ```ruby require 'net/http' require 'json' payout_data = { outputs: { '0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d' => 0.2, '0x18B211A1Ba5880C7d62C250B6441C2400d588589' => 0.1 } } uri = URI('https://api.blockbee.io/btc/payout/request/bulk/process/') params = { apikey: 'YOUR_API_KEY_V2' } uri.query = URI.encode_www_form(params) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['Content-Type'] = 'application/json' request.body = payout_data.to_json response = http.request(request) result = JSON.parse(response.body) payout_id = result['payout_info']['id'] puts "Payout ID: #{payout_id}" ``` ```csharp using System; using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json; public async Task CreatePayout() { var payoutData = new { outputs = new Dictionary { { "0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d", 0.2m }, { "0x18B211A1Ba5880C7d62C250B6441C2400d588589", 0.1m } } }; using (var client = new HttpClient()) { var url = "https://api.blockbee.io/btc/payout/request/bulk/process/?apikey=YOUR_API_KEY_V2"; var content = new StringContent(JsonConvert.SerializeObject(payoutData), System.Text.Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); var payoutId = result.payout_info.id; Console.WriteLine($"Payout ID: {payoutId}"); } } ``` ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; import com.google.gson.JsonObject; import com.google.gson.JsonParser; public void createPayout() throws Exception { String payoutData = "{\"outputs\":{\"0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d\":0.2,\"0x18B211A1Ba5880C7d62C250B6441C2400d588589\":0.1}}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.blockbee.io/btc/payout/request/bulk/process/?apikey=YOUR_API_KEY_V2")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payoutData)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); JsonObject result = JsonParser.parseString(response.body()).getAsJsonObject(); String payoutId = result.getAsJsonObject("payout_info").get("id").getAsString(); System.out.println("Payout ID: " + payoutId); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) type PayoutData struct { Outputs map[string]float64 `json:"outputs"` } type PayoutResponse struct { PayoutInfo struct { ID string `json:"id"` } `json:"payout_info"` } func createPayout() { payoutData := PayoutData{ Outputs: map[string]float64{ "0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d": 0.2, "0x18B211A1Ba5880C7d62C250B6441C2400d588589": 0.1, }, } jsonData, _ := json.Marshal(payoutData) url := "https://api.blockbee.io/btc/payout/request/bulk/process/?apikey=YOUR_API_KEY_V2" resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) var result PayoutResponse json.Unmarshal(body, &result) fmt.Printf("Payout ID: %s\n", result.PayoutInfo.ID) } ``` ```bash curl -X POST "https://api.blockbee.io/btc/payout/request/bulk/process/?apikey=YOUR_API_KEY_V2" \ -H "Content-Type: application/json" \ -d '{ "outputs": { "0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d": 0.2, "0x18B211A1Ba5880C7d62C250B6441C2400d588589": 0.1 } }' ``` > **INFO: Using Our Official Libraries** >For a simpler integration, you can also use our official libraries. Here's how you would create a bulk payout: > > ```javascript > // Using the official Node.js library > const BlockBee = require('@blockbee/api'); > > const requests = { > '0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d': 0.2, > '0x18B211A1Ba5880C7d62C250B6441C2400d588589': 0.1 > }; > > const payout = await BlockBee.createPayout('btc', requests, 'YOUR_API_KEY_V2', true); > // payout.payout_info.id > ``` > > ```php > // Using the official PHP library > require 'vendor/autoload.php'; > > $requests = [ > '0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d' => 0.2, > '0x18B211A1Ba5880C7d62C250B6441C2400d588589' => 0.1 > ]; > > $payout = BlockBee\BlockBee::create_payout('btc', $requests, 'YOUR_API_KEY_V2', true); > // $payout->payout_info->id > ``` > > ```python > # Using the official Python library > from BlockBee import BlockBeeHelper > > requests = { > '0xA6B78B56ee062185E405a1DDDD18cE8fcBC4395d': 0.2, > '0x18B211A1Ba5880C7d62C250B6441C2400d588589': 0.1 > } > > payout = BlockBeeHelper.create_payout('btc', requests, 'YOUR_API_KEY_V2', True) > # payout['payout_info']['id'] > ``` > > You can find the full documentation for our libraries here: > - [Node.js Library](/libraries/nodejs) > - [PHP Library](/libraries/php) > - [Python Library](/libraries/python) {% section id="batch-processing" %} #### Option B: Individual Requests + Batch Processing (Exchange-style) Create individual payout requests and then combine them into a single payout for batch processing, similar to how exchanges handle withdrawals. This approach is ideal for platforms that need to: 1. **Create withdrawals** when users request them 2. **Create payout requests** for each withdrawal 3. **Batch process** when enough requests accumulate or after a time period 4. **Create and process payouts** to execute all pending withdrawals ```javascript // Step 1: Create individual payout requests (when users request withdrawals) const payoutRequests = [ { address: '0x1234567890123456789012345678901234567890', amount: 0.2 }, { address: '0x0987654321098765432109876543210987654321', amount: 0.1 } ]; // Create multiple payout requests at once const bulkRequests = { requests: payoutRequests }; const bulkResponse = await fetch('https://api.blockbee.io/btc/payout/request/bulk/?apikey=YOUR_API_KEY_V2', { method: 'POST', headers: { 'Content-Type': 'application/json', 'apikey': 'YOUR_API_KEY_V2' }, body: JSON.stringify(bulkRequests) }); const bulkResult = await bulkResponse.json(); const requestIds = bulkResult.request_ids; // Array of request IDs // Step 2: Create payout from individual requests (batch processing) const payoutResponse = await fetch('https://api.blockbee.io/payout/create/?apikey=YOUR_API_KEY_V2', { method: 'POST', headers: { 'Content-Type': 'application/json', 'apikey': 'YOUR_API_KEY_V2' }, body: JSON.stringify({ payout_request_ids: requestIds.join(',') }) }); const payoutResult = await payoutResponse.json(); const payoutId = payoutResult.payout_info.id; console.log('Payout ID:', payoutId); // Step 3: Process the payout (execute all withdrawals) const processResponse = await fetch(`https://api.blockbee.io/payout/process/${payoutId}/?apikey=YOUR_API_KEY_V2`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'apikey': 'YOUR_API_KEY_V2' } }); const processResult = await processResponse.json(); console.log('Payout processed:', processResult.status); ``` ```php '0x1234567890123456789012345678901234567890', 'amount' => 0.2], ['address' => '0x0987654321098765432109876543210987654321', 'amount' => 0.1] ]; // Create multiple payout requests at once $bulkRequests = ['requests' => $payoutRequests]; $url = 'https://api.blockbee.io/btc/payout/request/bulk/?apikey=YOUR_API_KEY_V2'; $options = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-Type: application/json', 'content' => json_encode($bulkRequests) ] ]; $context = stream_context_create($options); $response = file_get_contents($url, false, $context); $result = json_decode($response, true); $requestIds = $result['request_ids']; // Array of request IDs // Step 2: Create payout from individual requests $payoutData = ['payout_request_ids' => implode(',', $requestIds)]; $url = 'https://api.blockbee.io/payout/create/?apikey=YOUR_API_KEY_V2'; $options = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-Type: application/json', 'content' => json_encode($payoutData) ] ]; $context = stream_context_create($options); $response = file_get_contents($url, false, $context); $result = json_decode($response, true); $payoutId = $result['payout_info']['id']; echo 'Payout ID: ' . $payoutId; ?> ``` ```python import requests import json # Step 1: Create individual payout requests payout_requests = [ {'address': '0x1234567890123456789012345678901234567890', 'amount': 0.2}, {'address': '0x0987654321098765432109876543210987654321', 'amount': 0.1} ] # Create multiple payout requests at once bulk_requests = {'requests': payout_requests} url = 'https://api.blockbee.io/btc/payout/request/bulk/' params = {'apikey': 'YOUR_API_KEY_V2'} headers = {'Content-Type': 'application/json'} response = requests.post(url, params=params, headers=headers, json=bulk_requests) result = response.json() request_ids = result['request_ids'] # Array of request IDs # Step 2: Create payout from individual requests payout_data = {'payout_request_ids': ','.join(request_ids)} url = 'https://api.blockbee.io/payout/create/' response = requests.post(url, params=params, headers=headers, json=payout_data) result = response.json() payout_id = result['payout_info']['id'] print('Payout ID:', payout_id) ``` ```ruby require 'net/http' require 'json' # Step 1: Create individual payout requests payout_requests = [ { address: '0x1234567890123456789012345678901234567890', amount: 0.2 }, { address: '0x0987654321098765432109876543210987654321', amount: 0.1 } ] # Create multiple payout requests at once bulk_requests = { requests: payout_requests } uri = URI('https://api.blockbee.io/btc/payout/request/bulk/') params = { apikey: 'YOUR_API_KEY_V2' } uri.query = URI.encode_www_form(params) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request_obj = Net::HTTP::Post.new(uri) request_obj['Content-Type'] = 'application/json' request_obj.body = bulk_requests.to_json response = http.request(request_obj) result = JSON.parse(response.body) request_ids = result['request_ids'] # Array of request IDs # Step 2: Create payout from individual requests payout_data = { payout_request_ids: request_ids.join(',') } uri = URI('https://api.blockbee.io/payout/create/') uri.query = URI.encode_www_form(params) request_obj = Net::HTTP::Post.new(uri) request_obj['Content-Type'] = 'application/json' request_obj.body = payout_data.to_json response = http.request(request_obj) result = JSON.parse(response.body) payout_id = result['payout_info']['id'] puts "Payout ID: #{payout_id}" ``` ```csharp using System; using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json; using System.Collections.Generic; public async Task CreatePayoutExchangeStyle() { // Step 1: Create individual payout requests var payoutRequests = new List { new { address = "0x1234567890123456789012345678901234567890", amount = 0.2m }, new { address = "0x0987654321098765432109876543210987654321", amount = 0.1m } }; using (var client = new HttpClient()) { // Create multiple payout requests at once var bulkRequests = new { requests = payoutRequests }; var url = "https://api.blockbee.io/btc/payout/request/bulk/?apikey=YOUR_API_KEY_V2"; var content = new StringContent(JsonConvert.SerializeObject(bulkRequests), System.Text.Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var result = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); var requestIds = ((Newtonsoft.Json.Linq.JArray)result.request_ids).Select(x => x.ToString()).ToList(); // Step 2: Create payout from individual requests var payoutData = new { payout_request_ids = string.Join(",", requestIds) }; var payoutUrl = "https://api.blockbee.io/payout/create/?apikey=YOUR_API_KEY_V2"; var payoutContent = new StringContent(JsonConvert.SerializeObject(payoutData), System.Text.Encoding.UTF8, "application/json"); var payoutResponse = await client.PostAsync(payoutUrl, payoutContent); var payoutResult = JsonConvert.DeserializeObject(await payoutResponse.Content.ReadAsStringAsync()); var payoutId = payoutResult.payout_info.id; Console.WriteLine($"Payout ID: {payoutId}"); } } ``` ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import java.util.List; import java.util.ArrayList; public void createPayoutExchangeStyle() throws Exception { // Step 1: Create individual payout requests List payoutRequests = List.of( Map.of("address", "0x1234567890123456789012345678901234567890", "amount", 0.2), Map.of("address", "0x0987654321098765432109876543210987654321", "amount", 0.1) ); HttpClient client = HttpClient.newHttpClient(); // Create multiple payout requests at once JsonObject bulkRequests = new JsonObject(); bulkRequests.add("requests", new Gson().toJsonTree(payoutRequests)); HttpRequest bulkRequest = HttpRequest.newBuilder() .uri(URI.create("https://api.blockbee.io/btc/payout/request/bulk/?apikey=YOUR_API_KEY_V2")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(bulkRequests.toString())) .build(); HttpResponse bulkResponse = client.send(bulkRequest, HttpResponse.BodyHandlers.ofString()); JsonObject bulkResult = JsonParser.parseString(bulkResponse.body()).getAsJsonObject(); JsonArray requestIdsArray = bulkResult.getAsJsonArray("request_ids"); List requestIds = new ArrayList<>(); for (int i = 0; i < requestIdsArray.size(); i++) { requestIds.add(requestIdsArray.get(i).getAsString()); } // Step 2: Create payout from individual requests String payoutRequestIds = String.join(",", requestIds); JsonObject payoutData = new JsonObject(); payoutData.addProperty("payout_request_ids", payoutRequestIds); HttpRequest payoutRequest = HttpRequest.newBuilder() .uri(URI.create("https://api.blockbee.io/payout/create/?apikey=YOUR_API_KEY_V2")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(payoutData.toString())) .build(); HttpResponse payoutResponse = client.send(payoutRequest, HttpResponse.BodyHandlers.ofString()); JsonObject payoutResult = JsonParser.parseString(payoutResponse.body()).getAsJsonObject(); String payoutId = payoutResult.getAsJsonObject("payout_info").get("id").getAsString(); System.out.println("Payout ID: " + payoutId); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) type PayoutRequest struct { Address string `json:"address"` Amount float64 `json:"amount"` } type RequestResponse struct { RequestID string `json:"request_id"` } type BulkData struct { Requests []string `json:"requests"` } type BulkResponse struct { PayoutInfo struct { ID string `json:"id"` } `json:"payout_info"` } func createPayoutExchangeStyle() { // Step 1: Create individual payout requests payoutRequests := []PayoutRequest{ {Address: "0x1234567890123456789012345678901234567890", Amount: 0.2}, {Address: "0x0987654321098765432109876543210987654321", Amount: 0.1}, } // Create multiple payout requests at once bulkRequests := map[string]interface{}{ "requests": payoutRequests, } jsonData, _ := json.Marshal(bulkRequests) url := "https://api.blockbee.io/btc/payout/request/bulk/?apikey=YOUR_API_KEY_V2" resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) var bulkResult map[string]interface{} json.Unmarshal(body, &bulkResult) requestIdsInterface := bulkResult["request_ids"].([]interface{}) var requestIds []string for _, id := range requestIdsInterface { requestIds = append(requestIds, id.(string)) } // Step 2: Create payout from individual requests payoutRequestIds := strings.Join(requestIds, ",") payoutData := map[string]string{"payout_request_ids": payoutRequestIds} jsonData, _ := json.Marshal(payoutData) url = "https://api.blockbee.io/payout/create/?apikey=YOUR_API_KEY_V2" resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) var result BulkResponse json.Unmarshal(body, &result) fmt.Printf("Payout ID: %s\n", result.PayoutInfo.ID) } ``` ```bash # Step 1: Create individual payout requests curl -X POST "https://api.blockbee.io/btc/payout/request/create/?apikey=YOUR_API_KEY_V2" \ -H "Content-Type: application/json" \ -d '{ "address": "0x1234567890123456789012345678901234567890", "amount": 0.2 }' curl -X POST "https://api.blockbee.io/btc/payout/request/create/?apikey=YOUR_API_KEY_V2" \ -H "Content-Type: application/json" \ -d '{ "address": "0x0987654321098765432109876543210987654321", "amount": 0.1 }' # Step 2: Create payout from individual requests curl -X POST "https://api.blockbee.io/payout/create/?apikey=YOUR_API_KEY_V2" \ -H "Content-Type: application/json" \ -d '{ "payout_request_ids": "request-id-1,request-id-2" }' ``` > **INFO: Using Our Official Libraries** >You can also use our official libraries for the exchange-style workflow: > > ```javascript > // Using the official Node.js library > const BlockBee = require('@blockbee/api'); > > // Step 1: Create individual payout requests > const requests = { > '0x1234567890123456789012345678901234567890': 0.2, > '0x0987654321098765432109876543210987654321': 0.1 > }; > > const payout = await BlockBee.createPayout('btc', requests, 'YOUR_API_KEY_V2', false); > const requestIds = payout.request_ids; // Array of request IDs > > // Step 2: Create payout from individual requests > const payoutResult = await BlockBee.createPayoutByIds('YOUR_API_KEY_V2', requestIds); > const payoutId = payoutResult.payout_info.id; > > // Step 3: Process the payout > const processResult = await BlockBee.processPayout('YOUR_API_KEY_V2', payoutId); > ``` > > ```php > // Using the official PHP library > require 'vendor/autoload.php'; > > // Step 1: Create individual payout requests > $requests = [ > '0x1234567890123456789012345678901234567890' => 0.2, > '0x0987654321098765432109876543210987654321' => 0.1 > ]; > > $payout = BlockBee\BlockBee::create_payout('btc', $requests, 'YOUR_API_KEY_V2', false); > $requestIds = $payout->request_ids; // Array of request IDs > > // Step 2: Create payout from individual requests > $payoutResult = BlockBee\BlockBee::create_payout_by_ids('YOUR_API_KEY_V2', $requestIds); > $payoutId = $payoutResult->payout_info->id; > > // Step 3: Process the payout > $processResult = BlockBee\BlockBee::process_payout('YOUR_API_KEY_V2', $payoutId); > ``` > > ```python > # Using the official Python library > from BlockBee import BlockBeeHelper > > # Step 1: Create individual payout requests > requests = { > '0x1234567890123456789012345678901234567890': 0.2, > '0x0987654321098765432109876543210987654321': 0.1 > } > > payout = BlockBeeHelper.create_payout('btc', requests, 'YOUR_API_KEY_V2', False) > request_ids = payout['request_ids'] # Array of request IDs > > # Step 2: Create payout from individual requests > payout_result = BlockBeeHelper.create_payout_by_ids('YOUR_API_KEY_V2', request_ids) > payout_id = payout_result['payout_info']['id'] > > # Step 3: Process the payout > process_result = BlockBeeHelper.process_payout('YOUR_API_KEY_V2', payout_id) > ``` ### Exchange Workflow Example Here's how a typical exchange would implement this workflow: 1. **User requests withdrawal** → Create payout request immediately 2. **Accumulate requests** → Store payout request IDs 3. **Batch processing** → When threshold reached or time passed, create payout 4. **Execute withdrawals** → Process the payout to send all transactions **Alternative: Create Multiple Requests at Once** You can also create multiple payout requests in one call using the bulk endpoint: ```javascript // Create multiple payout requests at once const bulkRequests = { requests: [ { address: '0x1234567890123456789012345678901234567890', amount: 0.2 }, { address: '0x0987654321098765432109876543210987654321', amount: 0.1 } ] }; const bulkResponse = await fetch('https://api.blockbee.io/btc/payout/request/bulk/?apikey=YOUR_API_KEY_V2', { method: 'POST', headers: { 'Content-Type': 'application/json', 'apikey': 'YOUR_API_KEY_V2' }, body: JSON.stringify(bulkRequests) }); const bulkResult = await bulkResponse.json(); const requestIds = bulkResult.request_ids; // Array of request IDs ``` {% section id="monitor-payout-status" %} ### 2. Monitor Payout Status Track the progress of your payouts using the payout ID: ```javascript const statusData = { payout_id: payoutId }; const statusResponse = await fetch('https://api.blockbee.io/payout/status/?apikey=YOUR_API_KEY_V2', { method: 'POST', headers: { 'Content-Type': 'application/json', 'apikey': 'YOUR_API_KEY_V2' }, body: JSON.stringify(statusData) }); const status = await statusResponse.json(); console.log('Payout status:', status.payout_info.status); ``` ```php $payoutId ]; $url = 'https://api.blockbee.io/payout/status/?apikey=YOUR_API_KEY_V2'; $options = [ 'http' => [ 'method' => 'POST', 'header' => 'Content-Type: application/json', 'content' => json_encode($statusData) ] ]; $context = stream_context_create($options); $response = file_get_contents($url, false, $context); $status = json_decode($response, true); echo 'Payout status: ' . $status['payout_info']['status']; ?> ``` ```python import requests import json status_data = { 'payout_id': payout_id } url = 'https://api.blockbee.io/payout/status/' params = {'apikey': 'YOUR_API_KEY_V2'} headers = {'Content-Type': 'application/json'} response = requests.post(url, params=params, headers=headers, json=status_data) status = response.json() print('Payout status:', status['payout_info']['status']) ``` ```ruby require 'net/http' require 'json' status_data = { payout_id: payout_id } uri = URI('https://api.blockbee.io/payout/status/') params = { apikey: 'YOUR_API_KEY_V2' } uri.query = URI.encode_www_form(params) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true request = Net::HTTP::Post.new(uri) request['Content-Type'] = 'application/json' request.body = status_data.to_json response = http.request(request) status = JSON.parse(response.body) puts "Payout status: #{status['payout_info']['status']}" ``` ```csharp using System; using System.Net.Http; using System.Threading.Tasks; using Newtonsoft.Json; public async Task CheckPayoutStatus(string payoutId) { var statusData = new { payout_id = payoutId }; using (var client = new HttpClient()) { var url = "https://api.blockbee.io/payout/status/?apikey=YOUR_API_KEY_V2"; var content = new StringContent(JsonConvert.SerializeObject(statusData), System.Text.Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, content); var status = JsonConvert.DeserializeObject(await response.Content.ReadAsStringAsync()); var payoutStatus = status.payout_info.status; Console.WriteLine($"Payout status: {payoutStatus}"); } } ``` ```java import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.URI; import com.google.gson.JsonObject; import com.google.gson.JsonParser; public void checkPayoutStatus(String payoutId) throws Exception { String statusData = "{\"payout_id\":\"" + payoutId + "\"}"; HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://api.blockbee.io/payout/status/?apikey=YOUR_API_KEY_V2")) .header("Content-Type", "application/json") .POST(HttpRequest.BodyPublishers.ofString(statusData)) .build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString()); JsonObject status = JsonParser.parseString(response.body()).getAsJsonObject(); String payoutStatus = status.getAsJsonObject("payout_info").get("status").getAsString(); System.out.println("Payout status: " + payoutStatus); } ``` ```go package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) type StatusData struct { PayoutID string `json:"payout_id"` } type StatusResponse struct { PayoutInfo struct { Status string `json:"status"` } `json:"payout_info"` } func checkPayoutStatus(payoutId string) { statusData := StatusData{ PayoutID: payoutId, } jsonData, _ := json.Marshal(statusData) url := "https://api.blockbee.io/payout/status/?apikey=YOUR_API_KEY_V2" resp, err := http.Post(url, "application/json", bytes.NewBuffer(jsonData)) if err != nil { panic(err) } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) var status StatusResponse json.Unmarshal(body, &status) fmt.Printf("Payout status: %s\n", status.PayoutInfo.Status) } ``` ```bash curl -X POST "https://api.blockbee.io/payout/status/?apikey=YOUR_API_KEY_V2" \ -H "Content-Type: application/json" \ -d '{ "payout_id": "your-payout-id-here" }' ``` > **INFO: Using Our Official Libraries** >You can also check payout status using our official libraries: > > ```javascript > // Using the official Node.js library > const BlockBee = require('@blockbee/api'); > > const status = await BlockBee.checkPayoutStatus('YOUR_API_KEY_V2', payoutId); > // status.payout_info.status > ``` > > ```php > // Using the official PHP library > require 'vendor/autoload.php'; > > $status = BlockBee\BlockBee::check_payout_status('YOUR_API_KEY_V2', $payoutId); > // $status->payout_info->status > ``` > > ```python > # Using the official Python library > from BlockBee import BlockBeeHelper > > status = BlockBeeHelper.check_payout_status('YOUR_API_KEY_V2', payout_id) > # status['payout_info']['status'] > ``` ## Payout Statuses - **Created**: Payout has been created and is queued for processing - **Processing**: Payout is being processed by the blockchain - **Done**: Payout has been successfully completed - **Error**: Payout failed (check the error message for details) ## Error Handling For detailed information about common errors and their solutions, see our [Error Handling Guide](/get-started/error-handling). ## Security Considerations - **API Key V2 Security**: Use advanced security practices for API Key V2 - **Recovery Key**: Safely store your recovery key for emergency access - **Address Validation**: Always verify destination addresses before creating payouts - **HTTPS Only**: Always use HTTPS for API requests in production ## Relevant API Endpoints For detailed information about all payout-related endpoints, see our [API Reference](/api/tickerpayoutrequestlist). Key endpoints include: - **Payout Management**: Create, process, and monitor payouts - **Wallet Operations**: Check balance, get addresses - **Request Management**: Create and manage payout requests - **Status Tracking**: Monitor payout and request status ## Testing > **WARNING** >**Test with Small Amounts:** Before using Self-Custodial Wallet in production, test with small amounts of Litecoin (LTC) to ensure everything works correctly. ### Testing Workflow 1. **Get Test LTC**: Add a small amount of Litecoin to your Self-Custodial Wallet 2. **Create Test Payouts**: Use the examples above with small amounts (0.001 LTC) 3. **Monitor Results**: Check payout status and verify transactions 4. **Scale Up**: Once testing is successful, increase amounts gradually ### Test with Litecoin Litecoin is ideal for testing because: - **Low fees**: Minimal transaction costs - **Fast confirmations**: Quick transaction processing - **Widely supported**: Available on most exchanges - **Stable network**: Reliable for testing purposes Use the ticker `ltc` in your API calls for Litecoin testing. > **INFO** >**Dashboard Management:** You can also manage your Self-Custodial Wallet through the [BlockBee Dashboard](https://dash.blockbee.io/wallet).