Criar Depósito
curl --request POST \
--url https://api.example.com/api/v1/onchain/deposit \
--header 'Bearer: <bearer>' \
--header 'Content-Type: application/json' \
--data '
{
"value": 123,
"asset": "<string>",
"network": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/onchain/deposit"
payload = {
"value": 123,
"asset": "<string>",
"network": "<string>"
}
headers = {
"Bearer": "<bearer>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Bearer: '<bearer>', 'Content-Type': 'application/json'},
body: JSON.stringify({value: 123, asset: '<string>', network: '<string>'})
};
fetch('https://api.example.com/api/v1/onchain/deposit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/onchain/deposit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'value' => 123,
'asset' => '<string>',
'network' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Bearer: <bearer>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/onchain/deposit"
payload := strings.NewReader("{\n \"value\": 123,\n \"asset\": \"<string>\",\n \"network\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Bearer", "<bearer>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/onchain/deposit")
.header("Bearer", "<bearer>")
.header("Content-Type", "application/json")
.body("{\n \"value\": 123,\n \"asset\": \"<string>\",\n \"network\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/onchain/deposit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Bearer"] = '<bearer>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"value\": 123,\n \"asset\": \"<string>\",\n \"network\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"order": {
"address": "<string>",
"paymentLinkId": "<string>",
"network": "<string>",
"asset": "<string>",
"amount": 123
}
}Onchain
Criar Depósito
Crie uma nova ordem de depósito e gere um endereço para receber fundos
POST
/
api
/
v1
/
onchain
/
deposit
Criar Depósito
curl --request POST \
--url https://api.example.com/api/v1/onchain/deposit \
--header 'Bearer: <bearer>' \
--header 'Content-Type: application/json' \
--data '
{
"value": 123,
"asset": "<string>",
"network": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/onchain/deposit"
payload = {
"value": 123,
"asset": "<string>",
"network": "<string>"
}
headers = {
"Bearer": "<bearer>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Bearer: '<bearer>', 'Content-Type': 'application/json'},
body: JSON.stringify({value: 123, asset: '<string>', network: '<string>'})
};
fetch('https://api.example.com/api/v1/onchain/deposit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/onchain/deposit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'value' => 123,
'asset' => '<string>',
'network' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Bearer: <bearer>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/onchain/deposit"
payload := strings.NewReader("{\n \"value\": 123,\n \"asset\": \"<string>\",\n \"network\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Bearer", "<bearer>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/onchain/deposit")
.header("Bearer", "<bearer>")
.header("Content-Type", "application/json")
.body("{\n \"value\": 123,\n \"asset\": \"<string>\",\n \"network\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/onchain/deposit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Bearer"] = '<bearer>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"value\": 123,\n \"asset\": \"<string>\",\n \"network\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"order": {
"address": "<string>",
"paymentLinkId": "<string>",
"network": "<string>",
"asset": "<string>",
"amount": 123
}
}Retorna os detalhes de uma nova ordem de depósito onchain, incluindo um endereço de carteira para receber fundos na blockchain.
Autenticação via API key no formato
Autorizações
string
required
Chave de API para autenticação
Bearer: <sua_chave_de_api>, onde <sua_chave_de_api> é sua chave de API.
Parâmetros da requisição
Body
number
required
O valor em BRL a ser depositado
string
required
O tipo de criptomoeda a ser utilizadoValores possíveis:
USDT, USDC, DAI, BUSDstring
required
A rede blockchain a ser utilizadaValores possíveis:
eth, bsc, polygonResposta
object
{
"order": {
"address": "0x1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t",
"paymentLinkId": "pmt_12345abcde",
"network": "bsc",
"asset": "USDT",
"amount": 23.74
}
}
{
"message": "Rede blockchain não suportada",
"supportedNetworks": ["eth", "bsc", "polygon"]
}
{
"message": "Valor de criptomoeda calculado inválido"
}
{
"message": "Token de criptomoeda não suportado"
}
{
"message": "Chave de API inválida ou não autorizada"
}
{
"message": "Ocorreu um erro ao processar sua solicitação"
}
Exemplos de código
curl -X POST "https://server.cryptouse.com.br/api/v1/onchain/deposit" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer seu_token_aqui" \
-d '{
"value": 100.00,
"asset": "USDT",
"network": "bsc"
}'
const axios = require('axios');
const apiKey = 'sua_chave_de_api';
const data = {
value: 100.00,
asset: 'USDT',
network: 'bsc'
};
axios.post('https://server.cryptouse.com.br/api/v1/onchain/deposit', data, {
headers: {
'Content-Type': 'application/json',
'Bearer': apiKey
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.error('Erro:', error.response.data);
});
import requests
import json
api_key = 'sua_chave_de_api'
url = 'https://server.cryptouse.com.br/api/v1/onchain/deposit'
headers = {
'Content-Type': 'application/json',
'Bearer': api_key
}
data = {
'value': 100.00,
'asset': 'USDT',
'network': 'bsc'
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
Notas
- O endereço gerado é exclusivo para esta ordem e não deve ser reutilizado
- A taxa de conversão BRL para criptomoeda é fixada no momento da criação da ordem
- Após o depósito ser recebido e confirmado na blockchain, você receberá uma notificação
- A ordem expira após 24 horas se nenhum pagamento for recebido
⌘I
