Skip to content

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/json

Request Body

FieldTypeRequiredDescription
amountnumber✅ YesAmount in reais (minimum R$10.00, maximum 2 decimal places)
customer_namestring❌ NoCustomer name (minimum 4, maximum 100 characters)
customer_emailstring❌ NoCustomer email (validated if provided)
customer_documentstring❌ NoCPF (11 digits) or CNPJ (14 digits) numbers only
customer_phonestring❌ NoCustomer phone (maximum 20 characters)
referencestring❌ NoCustom reference (maximum 50 characters, auto-generated if not provided)
expiration_minutesinteger❌ NoMinutes 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

FieldTypeDescription
idstring (UUID)Unique sale ID
qrcode_urlstring (URL)Checkout URL to pay the sale
referencestringSale reference (generated or custom)
expires_atstring (ISO 8601)QR Code expiration date/time
txidstringTransaction ID in payment provider
qrcode_textstringPIX text (copy and paste)
qrcode_base64stringQR 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

ParameterTypeDescription
idstring (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

FieldTypeDescription
idstring (UUID)Unique sale ID
user_idstring (UUID)Owner user ID
originstringSale origin ("api", "dashboard", etc)
amountnumberSale amount in reais
currencystringCurrency (always "BRL")
referencestringSale reference
customer_namestringCustomer name
customer_emailstringCustomer email
customer_documentstringCustomer CPF/CNPJ
customer_phonestringCustomer phone
payer_namestringPayer name
payer_documentstringPayer CPF/CNPJ
statusstringSale status (see below)
payment_methodstringPayment method (always "pix")
payment_providerstringPayment provider
payment_provider_transaction_idstringTransaction ID in provider
qrcode_datastringPIX text (copy and paste)
expires_atstring (ISO 8601)Expiration date/time
created_atstring (ISO 8601)Creation date/time
updated_atstring (ISO 8601)Last update date/time
paid_atstring (ISO 8601) or nullPayment date/time

Sale Status

StatusDescription
pendingAwaiting payment
paidPayment confirmed
expiredQR Code expired
cancelledSale 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]}...')

Mises API - Simplified PIX Payments