Criar Ordem Binance
curl --request POST \
--url https://api.example.com/api/v1/order/create \
--header 'Content-Type: application/json' \
--data '
{
"value": 123,
"payerId": "<string>",
"merchant": {
"subMerchantId": "<string>"
}
}
'import requests
url = "https://api.example.com/api/v1/order/create"
payload = {
"value": 123,
"payerId": "<string>",
"merchant": { "subMerchantId": "<string>" }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({value: 123, payerId: '<string>', merchant: {subMerchantId: '<string>'}})
};
fetch('https://api.example.com/api/v1/order/create', 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/order/create",
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,
'payerId' => '<string>',
'merchant' => [
'subMerchantId' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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/order/create"
payload := strings.NewReader("{\n \"value\": 123,\n \"payerId\": \"<string>\",\n \"merchant\": {\n \"subMerchantId\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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/order/create")
.header("Content-Type", "application/json")
.body("{\n \"value\": 123,\n \"payerId\": \"<string>\",\n \"merchant\": {\n \"subMerchantId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/order/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"value\": 123,\n \"payerId\": \"<string>\",\n \"merchant\": {\n \"subMerchantId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"order": {
"id": "<string>",
"paymentLinkId": "<string>",
"value": 123,
"status": "<string>",
"qrCodeLink": "<string>",
"link": "<string>",
"createdAt": "<string>"
}
}Binance
Criar Ordem Binance
Crie uma nova ordem de pagamento Binance
POST
/
api
/
v1
/
order
/
create
Criar Ordem Binance
curl --request POST \
--url https://api.example.com/api/v1/order/create \
--header 'Content-Type: application/json' \
--data '
{
"value": 123,
"payerId": "<string>",
"merchant": {
"subMerchantId": "<string>"
}
}
'import requests
url = "https://api.example.com/api/v1/order/create"
payload = {
"value": 123,
"payerId": "<string>",
"merchant": { "subMerchantId": "<string>" }
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({value: 123, payerId: '<string>', merchant: {subMerchantId: '<string>'}})
};
fetch('https://api.example.com/api/v1/order/create', 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/order/create",
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,
'payerId' => '<string>',
'merchant' => [
'subMerchantId' => '<string>'
]
]),
CURLOPT_HTTPHEADER => [
"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/order/create"
payload := strings.NewReader("{\n \"value\": 123,\n \"payerId\": \"<string>\",\n \"merchant\": {\n \"subMerchantId\": \"<string>\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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/order/create")
.header("Content-Type", "application/json")
.body("{\n \"value\": 123,\n \"payerId\": \"<string>\",\n \"merchant\": {\n \"subMerchantId\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/order/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"value\": 123,\n \"payerId\": \"<string>\",\n \"merchant\": {\n \"subMerchantId\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"order": {
"id": "<string>",
"paymentLinkId": "<string>",
"value": 123,
"status": "<string>",
"qrCodeLink": "<string>",
"link": "<string>",
"createdAt": "<string>"
}
}Criar ordem de pagamento Binance
Este endpoint gera um novo QR code de pagamento Binance para o valor especificado.Requisição
number
required
O valor do pagamento em BRL
string
ID de referência do pagador (opcional)
Exemplo de requisição
curl -X POST "https://server.cryptouse.com.br/api/v1/order/create" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer seu_token_aqui" \
-d '{
"value": 150.00,
"payerId": "user_123",
"merchant": {
"subMerchantId": "merch_456"
}
}'
Resposta
string
Mensagem de sucesso
object
Show Propriedades
Show Propriedades
Exemplo de resposta
{
"message": "Ordem criada com sucesso",
"order": {
"id": "ord_67890fghij",
"paymentLinkId": "pmt_12345abcde",
"value": 150.00,
"status": "PENDING",
"qrCodeLink": "https://server.cryptouse.com.br/qrcode/pmt_12345abcde.png",
"link": "https://pay.cryptouse.com/binance/pmt_12345abcde",
"createdAt": "2023-04-20T15:00:00Z"
}
}
{
"success": false,
"error": "Valor de pagamento inválido"
}
{
"success": false,
"error": "Chave de API inválida ou não autorizada"
}
Integração com Binance Pay
Este endpoint utiliza o serviço Binance Pay para processar pagamentos em criptomoedas. Os usuários poderão pagar usando:- O aplicativo Binance escaneando o QR code
- Qualquer carteira compatível com o link de pagamento
- Acessando diretamente o link de pagamento
Notificações
Você receberá uma notificação quando o status da ordem for alterado. Os possíveis status incluem:| Status | Descrição |
|---|---|
PENDING | A ordem foi criada e aguarda pagamento |
COMPLETED | O pagamento foi recebido e confirmado |
CANCELLED | A ordem foi cancelada |
FAILED | O pagamento falhou |
REFUND | O pagamento foi reembolsado |
Tempo de expiração
As ordens Binance expiram após 30 minutos se nenhum pagamento for recebido.⌘I
