Create Sale
Cria uma nova venda/pedido.
curl --request POST \
--url https://developers.nemu.com.br/api/v1/sales \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"transactionId": "<string>",
"isFromApp": true,
"netValue": 123,
"grossValue": 123,
"status": "<string>",
"quantity": 123,
"paymentType": "<string>",
"customerEmail": "<string>",
"date": "2023-12-25",
"orderCreatedAt": "2023-11-07T05:31:56Z",
"products": [
{
"productId": "<string>",
"name": "<string>",
"quantity": 123,
"netValue": 123,
"grossValue": 123,
"priceCost": 123
}
],
"utm_source": "<string>",
"utm_campaign": "<string>",
"utm_medium": "<string>",
"utm_content": "<string>",
"utm_term": "<string>",
"priceCost": 123
}
'import requests
url = "https://developers.nemu.com.br/api/v1/sales"
payload = {
"name": "<string>",
"transactionId": "<string>",
"isFromApp": True,
"netValue": 123,
"grossValue": 123,
"status": "<string>",
"quantity": 123,
"paymentType": "<string>",
"customerEmail": "<string>",
"date": "2023-12-25",
"orderCreatedAt": "2023-11-07T05:31:56Z",
"products": [
{
"productId": "<string>",
"name": "<string>",
"quantity": 123,
"netValue": 123,
"grossValue": 123,
"priceCost": 123
}
],
"utm_source": "<string>",
"utm_campaign": "<string>",
"utm_medium": "<string>",
"utm_content": "<string>",
"utm_term": "<string>",
"priceCost": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
transactionId: '<string>',
isFromApp: true,
netValue: 123,
grossValue: 123,
status: '<string>',
quantity: 123,
paymentType: '<string>',
customerEmail: '<string>',
date: '2023-12-25',
orderCreatedAt: '2023-11-07T05:31:56Z',
products: [
{
productId: '<string>',
name: '<string>',
quantity: 123,
netValue: 123,
grossValue: 123,
priceCost: 123
}
],
utm_source: '<string>',
utm_campaign: '<string>',
utm_medium: '<string>',
utm_content: '<string>',
utm_term: '<string>',
priceCost: 123
})
};
fetch('https://developers.nemu.com.br/api/v1/sales', 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://developers.nemu.com.br/api/v1/sales",
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([
'name' => '<string>',
'transactionId' => '<string>',
'isFromApp' => true,
'netValue' => 123,
'grossValue' => 123,
'status' => '<string>',
'quantity' => 123,
'paymentType' => '<string>',
'customerEmail' => '<string>',
'date' => '2023-12-25',
'orderCreatedAt' => '2023-11-07T05:31:56Z',
'products' => [
[
'productId' => '<string>',
'name' => '<string>',
'quantity' => 123,
'netValue' => 123,
'grossValue' => 123,
'priceCost' => 123
]
],
'utm_source' => '<string>',
'utm_campaign' => '<string>',
'utm_medium' => '<string>',
'utm_content' => '<string>',
'utm_term' => '<string>',
'priceCost' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://developers.nemu.com.br/api/v1/sales"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"isFromApp\": true,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"status\": \"<string>\",\n \"quantity\": 123,\n \"paymentType\": \"<string>\",\n \"customerEmail\": \"<string>\",\n \"date\": \"2023-12-25\",\n \"orderCreatedAt\": \"2023-11-07T05:31:56Z\",\n \"products\": [\n {\n \"productId\": \"<string>\",\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"priceCost\": 123\n }\n ],\n \"utm_source\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"priceCost\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://developers.nemu.com.br/api/v1/sales")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"isFromApp\": true,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"status\": \"<string>\",\n \"quantity\": 123,\n \"paymentType\": \"<string>\",\n \"customerEmail\": \"<string>\",\n \"date\": \"2023-12-25\",\n \"orderCreatedAt\": \"2023-11-07T05:31:56Z\",\n \"products\": [\n {\n \"productId\": \"<string>\",\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"priceCost\": 123\n }\n ],\n \"utm_source\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"priceCost\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developers.nemu.com.br/api/v1/sales")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"isFromApp\": true,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"status\": \"<string>\",\n \"quantity\": 123,\n \"paymentType\": \"<string>\",\n \"customerEmail\": \"<string>\",\n \"date\": \"2023-12-25\",\n \"orderCreatedAt\": \"2023-11-07T05:31:56Z\",\n \"products\": [\n {\n \"productId\": \"<string>\",\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"priceCost\": 123\n }\n ],\n \"utm_source\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"priceCost\": 123\n}"
response = http.request(request)
puts response.read_bodycustomerEmail field accepts the plain email or a hashed value of the email (e.g. SHA-256).
The isFromApp field should be used to indicate whether the sale was made in the app (true) or not (false).
Example (single product):
{
"name": "Product name",
"transactionId": "123",
"isFromApp": false,
"netValue": 10,
"grossValue": 30,
"status": "paid",
"quantity": 1,
"paymentType": "pix",
"utm_campaign": "string",
"utm_content": "string",
"utm_medium": "string",
"utm_source": "string",
"utm_term": "string",
"customerEmail": "customeremail@gmail.com",
"date": "2024-06-25",
"orderCreatedAt": "2024-06-25 00:00:00",
"priceCost": 5
}
Example (multiple products):
{
"name": "Order name",
"transactionId": "123",
"isFromApp": false,
"netValue": 20,
"grossValue": 40,
"status": "paid",
"quantity": 1,
"paymentType": "pix",
"utm_campaign": "string",
"utm_content": "string",
"utm_medium": "string",
"utm_source": "string",
"utm_term": "string",
"customerEmail": "customeremail@gmail.com",
"date": "2024-06-25",
"createdAt": "2024-06-25 00:00:00",
"products": [
{
"productId": "1",
"name": "Product name 1",
"quantity": 1,
"netValue": 10,
"grossValue": 20,
"priceCost": 5,
"category": {
"id": "15",
"name": "category 1"
}
},
{
"productId": "2",
"name": "Product name 2",
"quantity": 1,
"netValue": 10,
"grossValue": 20,
"priceCost": 5
}
]
}
Authorizations
Token de API gerado no dashboard. Envie no header Authorization sem 'Bearer'. Exemplo: Authorization: 123456abcdef
Body
Dados da venda ou pedido.
Nome do produto ou pedido
ID da transação ou pedido
Indica se a venda foi originada pelo aplicativo
Valor líquido da transação ou pedido
Valor bruto da transação ou pedido
Status da transação ou pedido (paid, waiting_payment, cancelled, chargeback, refunded, checkout_completed)
Quantidade vendida
Método de pagamento (pix, billet, credit_card, other)
Email do comprador. Também aceita um valor em hash do email (ex: SHA-256)
Data de criação do pedido (YYYY-MM-DD)
Order creation date and time in UTC 0 (YYYY-MM-DD HH:MM:SS)
Lista de produtos do pedido
Show child attributes
Show child attributes
utm_source parameter
utm_campaign parameter
utm_medium parameter
utm_content parameter
utm_term parameter
Preço de custo do produto/pedido
Response
Venda criada com sucesso.
curl --request POST \
--url https://developers.nemu.com.br/api/v1/sales \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"transactionId": "<string>",
"isFromApp": true,
"netValue": 123,
"grossValue": 123,
"status": "<string>",
"quantity": 123,
"paymentType": "<string>",
"customerEmail": "<string>",
"date": "2023-12-25",
"orderCreatedAt": "2023-11-07T05:31:56Z",
"products": [
{
"productId": "<string>",
"name": "<string>",
"quantity": 123,
"netValue": 123,
"grossValue": 123,
"priceCost": 123
}
],
"utm_source": "<string>",
"utm_campaign": "<string>",
"utm_medium": "<string>",
"utm_content": "<string>",
"utm_term": "<string>",
"priceCost": 123
}
'import requests
url = "https://developers.nemu.com.br/api/v1/sales"
payload = {
"name": "<string>",
"transactionId": "<string>",
"isFromApp": True,
"netValue": 123,
"grossValue": 123,
"status": "<string>",
"quantity": 123,
"paymentType": "<string>",
"customerEmail": "<string>",
"date": "2023-12-25",
"orderCreatedAt": "2023-11-07T05:31:56Z",
"products": [
{
"productId": "<string>",
"name": "<string>",
"quantity": 123,
"netValue": 123,
"grossValue": 123,
"priceCost": 123
}
],
"utm_source": "<string>",
"utm_campaign": "<string>",
"utm_medium": "<string>",
"utm_content": "<string>",
"utm_term": "<string>",
"priceCost": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
transactionId: '<string>',
isFromApp: true,
netValue: 123,
grossValue: 123,
status: '<string>',
quantity: 123,
paymentType: '<string>',
customerEmail: '<string>',
date: '2023-12-25',
orderCreatedAt: '2023-11-07T05:31:56Z',
products: [
{
productId: '<string>',
name: '<string>',
quantity: 123,
netValue: 123,
grossValue: 123,
priceCost: 123
}
],
utm_source: '<string>',
utm_campaign: '<string>',
utm_medium: '<string>',
utm_content: '<string>',
utm_term: '<string>',
priceCost: 123
})
};
fetch('https://developers.nemu.com.br/api/v1/sales', 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://developers.nemu.com.br/api/v1/sales",
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([
'name' => '<string>',
'transactionId' => '<string>',
'isFromApp' => true,
'netValue' => 123,
'grossValue' => 123,
'status' => '<string>',
'quantity' => 123,
'paymentType' => '<string>',
'customerEmail' => '<string>',
'date' => '2023-12-25',
'orderCreatedAt' => '2023-11-07T05:31:56Z',
'products' => [
[
'productId' => '<string>',
'name' => '<string>',
'quantity' => 123,
'netValue' => 123,
'grossValue' => 123,
'priceCost' => 123
]
],
'utm_source' => '<string>',
'utm_campaign' => '<string>',
'utm_medium' => '<string>',
'utm_content' => '<string>',
'utm_term' => '<string>',
'priceCost' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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://developers.nemu.com.br/api/v1/sales"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"isFromApp\": true,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"status\": \"<string>\",\n \"quantity\": 123,\n \"paymentType\": \"<string>\",\n \"customerEmail\": \"<string>\",\n \"date\": \"2023-12-25\",\n \"orderCreatedAt\": \"2023-11-07T05:31:56Z\",\n \"products\": [\n {\n \"productId\": \"<string>\",\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"priceCost\": 123\n }\n ],\n \"utm_source\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"priceCost\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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://developers.nemu.com.br/api/v1/sales")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"isFromApp\": true,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"status\": \"<string>\",\n \"quantity\": 123,\n \"paymentType\": \"<string>\",\n \"customerEmail\": \"<string>\",\n \"date\": \"2023-12-25\",\n \"orderCreatedAt\": \"2023-11-07T05:31:56Z\",\n \"products\": [\n {\n \"productId\": \"<string>\",\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"priceCost\": 123\n }\n ],\n \"utm_source\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"priceCost\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://developers.nemu.com.br/api/v1/sales")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"transactionId\": \"<string>\",\n \"isFromApp\": true,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"status\": \"<string>\",\n \"quantity\": 123,\n \"paymentType\": \"<string>\",\n \"customerEmail\": \"<string>\",\n \"date\": \"2023-12-25\",\n \"orderCreatedAt\": \"2023-11-07T05:31:56Z\",\n \"products\": [\n {\n \"productId\": \"<string>\",\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"netValue\": 123,\n \"grossValue\": 123,\n \"priceCost\": 123\n }\n ],\n \"utm_source\": \"<string>\",\n \"utm_campaign\": \"<string>\",\n \"utm_medium\": \"<string>\",\n \"utm_content\": \"<string>\",\n \"utm_term\": \"<string>\",\n \"priceCost\": 123\n}"
response = http.request(request)
puts response.read_body