Sales
Endpoints to create and query PIX sales.
POST /v1/sales
Creates a new sale and generates PIX QR Code for payment.
Headers
http
Authorization: Bearer {access_token}
Content-Type: application/jsonRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
amount | number | ✅ Yes | Amount in reais (minimum R$10.00, maximum 2 decimal places) |
customer_name | string | ❌ No | Customer name (minimum 4, maximum 100 characters) |
customer_email | string | ❌ No | Customer email (validated if provided) |
customer_document | string | ❌ No | CPF (11 digits) or CNPJ (14 digits) numbers only |
customer_phone | string | ❌ No | Customer phone (maximum 20 characters) |
reference | string | ❌ No | Custom reference (maximum 50 characters, auto-generated if not provided) |
expiration_minutes | integer | ❌ No | Minutes until expiration (minimum 15, default 15) |
Request Example
bash
curl -X POST https://api.misespay.com/v1/sales \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
-H "Content-Type: application/json" \
-d '{
"amount": 150.75,
"customer_name": "John Silva",
"customer_email": "john.silva@example.com",
"customer_document": "12345678909",
"customer_phone": "11999887766",
"expiration_minutes": 30
}'Response (201 Created)
json
{
"id": "cb931031-091a-4243-90ba-44842f39f42d",
"qrcode_url": "https://checkout.misespay.com/pagamento/cb931031-091a-4243-90ba-44842f39f42d",
"reference": "mj9z1j03UU3v",
"expires_at": "2025-12-17T09:42:08.259048-03:00",
"txid": "NOX237W9YZJRIQZP9B1IID7FMQSL1UYD",
"qrcode_text": "00020101021226710014br.gov.bcb.pix2549brcode.trio.com.br/cob/01KCP3K3F9AZE34F18CQH1KRWC5204000053039865802BR5919NOXPAYIO PAGAMENTOS6007Barueri62070503***63048D59",
"qrcode_base64": "iVBORw0KGgoAAAANSUhEUgAAAQAAAAEAAQMAAABmvDol..."
}Response Fields
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Unique sale ID |
qrcode_url | string (URL) | Checkout URL to pay the sale |
reference | string | Sale reference (generated or custom) |
expires_at | string (ISO 8601) | QR Code expiration date/time |
txid | string | Transaction ID in payment provider |
qrcode_text | string | PIX text (copy and paste) |
qrcode_base64 | string | QR Code image in base64 |
Displaying QR Code
HTML
html
<img src="data:image/png;base64,{qrcode_base64}" alt="PIX QR Code" />React
jsx
function QRCodeDisplay({ qrcode_base64 }) {
return (
<img
src={`data:image/png;base64,${qrcode_base64}`}
alt="PIX QR Code"
className="w-64 h-64"
/>
);
}Possible Errors
400 Bad Request - Invalid Amount
json
{
"error": "Validation Error",
"message": "amount must be at least 10.00"
}401 Unauthorized - Invalid Token
json
{
"error": "Unauthorized",
"message": "Invalid or expired token"
}GET /v1/sales/:id
Retrieves details of a specific sale by ID.
Headers
http
Authorization: Bearer {access_token}Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string (UUID) | Sale ID |
Request Example
bash
curl -X GET https://api.misespay.com/v1/sales/cb931031-091a-4243-90ba-44842f39f42d \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."Response (200 OK)
json
{
"id": "cb931031-091a-4243-90ba-44842f39f42d",
"user_id": "5016a25a-569c-43f5-98a8-6823f791f38a",
"origin": "api",
"amount": 150.75,
"currency": "BRL",
"reference": "mj9z1j03UU3v",
"customer_name": "John Silva",
"customer_email": "john.silva@example.com",
"customer_document": "12345678909",
"customer_phone": "11999887766",
"payer_name": "John Silva",
"payer_document": "12345678909",
"status": "pending",
"payment_method": "pix",
"payment_provider": "noxpay",
"payment_provider_transaction_id": "NOX237W9YZJRIQZP9B1IID7FMQSL1UYD",
"qrcode_data": "00020101021226710014br.gov.bcb.pix...",
"expires_at": "2025-12-17T12:42:08",
"created_at": "2025-12-17T12:12:08",
"updated_at": "2025-12-17T12:12:08",
"paid_at": null
}Response Fields
| Field | Type | Description |
|---|---|---|
id | string (UUID) | Unique sale ID |
user_id | string (UUID) | Owner user ID |
origin | string | Sale origin ("api", "dashboard", etc) |
amount | number | Sale amount in reais |
currency | string | Currency (always "BRL") |
reference | string | Sale reference |
customer_name | string | Customer name |
customer_email | string | Customer email |
customer_document | string | Customer CPF/CNPJ |
customer_phone | string | Customer phone |
payer_name | string | Payer name |
payer_document | string | Payer CPF/CNPJ |
status | string | Sale status (see below) |
payment_method | string | Payment method (always "pix") |
payment_provider | string | Payment provider |
payment_provider_transaction_id | string | Transaction ID in provider |
qrcode_data | string | PIX text (copy and paste) |
expires_at | string (ISO 8601) | Expiration date/time |
created_at | string (ISO 8601) | Creation date/time |
updated_at | string (ISO 8601) | Last update date/time |
paid_at | string (ISO 8601) or null | Payment date/time |
Sale Status
| Status | Description |
|---|---|
pending | Awaiting payment |
paid | Payment confirmed |
expired | QR Code expired |
cancelled | Sale cancelled |
Possible Errors
404 Not Found
json
{
"error": "Not Found",
"message": "Sale not found"
}Complete Examples
JavaScript - Create and Display Sale
javascript
class MisesPixAPI {
constructor(clientId, clientSecret) {
this.clientId = clientId;
this.clientSecret = clientSecret;
this.baseURL = "https://api.misespay.com";
this.token = null;
}
async authenticate() {
const response = await fetch(`${this.baseURL}/auth`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
client_id: this.clientId,
client_secret: this.clientSecret,
}),
});
const data = await response.json();
this.token = data.access_token;
return this.token;
}
async createSale(saleData) {
if (!this.token) await this.authenticate();
const response = await fetch(`${this.baseURL}/v1/sales`, {
method: "POST",
headers: {
Authorization: `Bearer ${this.token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(saleData),
});
return response.json();
}
async getSale(saleId) {
if (!this.token) await this.authenticate();
const response = await fetch(`${this.baseURL}/v1/sales/${saleId}`, {
headers: {
Authorization: `Bearer ${this.token}`,
},
});
return response.json();
}
}
// Usage
const api = new MisesPixAPI("your_client_id", "your_client_secret");
const sale = await api.createSale({
amount: 150.75,
customer_name: "John Silva",
customer_email: "john@example.com",
expiration_minutes: 30,
});
console.log("QR Code:", sale.qrcode_base64);
console.log("PIX Copy and Paste:", sale.qrcode_text);Python - Create Sale
python
import requests
from typing import Dict
class MisesPixAPI:
def __init__(self, client_id: str, client_secret: str):
self.client_id = client_id
self.client_secret = client_secret
self.base_url = 'https://api.misespay.com'
self.token = None
def authenticate(self) -> str:
response = requests.post(f'{self.base_url}/auth', json={
'client_id': self.client_id,
'client_secret': self.client_secret
})
data = response.json()
self.token = data['access_token']
return self.token
def create_sale(self, sale_data: Dict) -> Dict:
if not self.token:
self.authenticate()
response = requests.post(
f'{self.base_url}/v1/sales',
headers={'Authorization': f'Bearer {self.token}'},
json=sale_data
)
return response.json()
# Usage
api = MisesPixAPI('your_client_id', 'your_client_secret')
sale = api.create_sale({
'amount': 150.75,
'customer_name': 'John Silva',
'customer_email': 'john@example.com',
'expiration_minutes': 30
})
print(f'Sale ID: {sale["id"]}')
print(f'QR Code Base64: {sale["qrcode_base64"][:50]}...')