构建应用

使用 Lunium 构建应用

选择想构建的功能。每个场景均提供 REST、Node 及 Python 示例,也附有可交给编程智能体的提示词。

提示词围绕目标描述需求,让智能体通过发现机制查询当前接口、字段及资产,减少对固定实现细节的依赖。

Pix → USDT

接收客户 Pix 付款,并将结算金额以 USDT 交付至钱包。

# 1. 使用本人邮箱,通过一次请求获取测试密钥
curl -X POST https://api.luniumpay.com/keys/sandbox -H 'Content-Type: application/json' \
  -d '{"email":"voce@empresa.com","name":"meu-projeto"}'

# 2. 创建 Pix 收款单;按要求提供实际付款人的 CPF/CNPJ
curl -X POST https://api.luniumpay.com/cashin/charge \
  -H "X-API-Key: $LUNIUM_KEY" -H 'Content-Type: application/json' \
  -d '{"amount_cents": 15000,
       "payer_tax_number": "12345678901",
       "payout_address": "0xSuaCarteira",
       "chain": "polygon",
       "external_id": "pedido-123"}'

# 3. 跟踪至结算完成
curl https://api.luniumpay.com/cashin/$ID/status -H "X-API-Key: $LUNIUM_KEY" 
const API = "https://api.luniumpay.com";
const key = process.env.LUNIUM_KEY;

const call = (path, method = "GET", body) =>
  fetch(API + path, {
    method,
    headers: { "Content-Type": "application/json", "X-API-Key": key },
    body: body && JSON.stringify(body),
  }).then((r) => r.json());

// 创建收款单。金额单位为分;150 与 15000 均是有效输入,
// 但表示的金额不同,请勿混淆单位。
const charge = await call("/cashin/charge", "POST", {
  amount_cents: 15000,
  payer_tax_number: "12345678901",
  payout_address: "0xSuaCarteira",
  chain: "polygon",
  external_id: "pedido-" + Date.now(),
});

if (charge.erro) throw new Error(`${charge.erro}: ${charge.detail}`);
console.log("copia e cola:", charge.qr_copypaste);

// 随后通过签名 Webhook 跟踪,或查询状态。
const status = await call(`/cashin/${charge.cashin_id}/status`);
console.log(status.status, status.settlement_status);
import json, os, urllib.request

API = "https://api.luniumpay.com"
KEY = os.environ["LUNIUM_KEY"]


def call(path, method="GET", body=None):
    data = json.dumps(body).encode() if body else None
    req = urllib.request.Request(API + path, data=data, method=method)
    req.add_header("Content-Type", "application/json")
    req.add_header("X-API-Key", KEY)
    with urllib.request.urlopen(req, timeout=30) as r:
        return json.loads(r.read())


charge = call("/cashin/charge", "POST", {
    "amount_cents": 15000,          # 单位为分,而非巴西雷亚尔
    "payer_tax_number": "12345678901",     # 按要求提供实际付款人的证件
    "payout_address": "0xSuaCarteira",
    "chain": "polygon",
    "external_id": "pedido-123",
})
print("copia e cola:", charge["qr_copypaste"])
print(call(f"/cashin/{charge['cashin_id']}/status"))
Integre a Lunium a partir de https://luniumpay.com. Preciso receber PIX e liquidar em USDT. Descubra sozinho as capacidades e a API disponíveis, comece pelo sandbox e preserve a arquitetura atual deste projeto.

交给编程智能体,由它查询并理解 API。

USDT → Pix

卖出 USDT,向 Pix 收款账户支付 BRL。

# 1. 查询报价,不执行资金操作;有效期以返回值为准
curl -X POST https://api.luniumpay.com/cash-outs \
  -H "X-API-Key: $LUNIUM_KEY" -H 'Content-Type: application/json' \
  -d '{"asset":"USDT","network":"polygon","brl_amount":"150.00",
       "pix_key":"quem-recebe@exemplo.com",
       "refund_address":"0xCarteiraDoSeuUsuario",
       "external_id":"venda-123"}'

# 2. 接受报价,获取该订单的入金地址。
curl -X POST https://api.luniumpay.com/cash-outs/$ID/accept -H "X-API-Key: $LUNIUM_KEY"

# 3. 跟踪至 COMPLETED,再读取付款凭证信息
curl https://api.luniumpay.com/cash-outs/$ID -H "X-API-Key: $LUNIUM_KEY" 
const API = "https://api.luniumpay.com";
const key = process.env.LUNIUM_KEY;
const call = (p, m = "GET", b) => fetch(API + p, {
  method: m,
  headers: { "Content-Type": "application/json", "X-API-Key": key },
  body: b && JSON.stringify(b),
}).then((r) => r.json());

// 1. 报价仅提交 brl_amount 或 amount 之一,不得同时提交。
// 本例目标为 Pix 收款键收到 R$150。
const quote = await call("/cash-outs", "POST", {
  asset: "USDT", network: "polygon", brl_amount: "150.00",
  pix_key: "quem-recebe@exemplo.com",
  // Pix 无法付款时使用客户确认的退款钱包。
  // 未提供时等待 AWAITING_REFUND_ADDRESS;绝不自动退至入金来源地址。
  refund_address: "0xCarteiraDoSeuUsuario",
  external_id: "venda-" + Date.now(),
});
if (quote.erro) throw new Error(`${quote.erro}: ${quote.detail}`);
console.log(`envie ${quote.amount} USDT → R$ ${quote.brl_amount}`);

// 2. 接受报价并获取入金地址;按返回说明继续操作。
const accepted = await call(`/cash-outs/${quote.cashout_id}/accept`, "POST", {});
console.log("depositar em:", accepted.deposit_address);

// 3. COMPLETED 时读取 pix_e2e、receipt_url 和 verify_url
const done = await call(`/cash-outs/${quote.cashout_id}`);
console.log(done.state, done.pix_e2e ?? "");
import json, os, urllib.request

API = "https://api.luniumpay.com"
KEY = os.environ["LUNIUM_KEY"]


def call(path, method="GET", body=None):
    data = json.dumps(body).encode() if body else None
    req = urllib.request.Request(API + path, data=data, method=method)
    req.add_header("Content-Type", "application/json")
    req.add_header("X-API-Key", KEY)
    with urllib.request.urlopen(req, timeout=30) as r:
        return json.loads(r.read())


quote = call("/cash-outs", "POST", {
    "asset": "USDT", "network": "polygon",
    "brl_amount": "150.00",                    # 或使用 "amount",不可同时提交两者
    "pix_key": "quem-recebe@exemplo.com",
    "refund_address": "0xCarteiraDoSeuUsuario",
    "external_id": "venda-123",
})
print(f"envie {quote['amount']} USDT -> R$ {quote['brl_amount']}")

# 接受报价
aceita = call(f"/cash-outs/{quote['cashout_id']}/accept", "POST", {})
print("depositar em:", aceita["deposit_address"])

final = call(f"/cash-outs/{quote['cashout_id']}")
print(final["state"], final.get("pix_e2e", ""))
Integre a Lunium a partir de https://luniumpay.com. Preciso converter USDT em BRL via PIX. Descubra sozinho a API, comece pelo sandbox e preserve a arquitetura atual deste projeto.

交给编程智能体,由它查询并理解 API。

付款核验

在发货、记入余额或开通访问前,核验已结算 Pix,无需密钥。

# 无需密钥,可用于独立核验
# 并非由您发起、需要核实的交易对手付款。
curl https://api.luniumpay.com/v1/verificar/E12345678202608291200abcdefghijk
// 无需凭证,可公开核验。
const e2e = "E12345678202608291200abcdefghijk";
const r = await fetch(`https://api.luniumpay.com/v1/verificar/${e2e}`);
const prova = await r.json();

// `nao_encontrado` 不代表 Pix 不存在,仅表示
// Lunium 未结算此付款;可能由其他机构结算。
if (!prova.verificado) {
  console.log("não comprovado:", prova.erro);
} else {
  // 请自行核对金额与时间:R$1.00 的有效 E2E
  // 不能证明已支付 R$1,000.00。
  console.log(prova.valor_brl, prova.pago_em, prova.instituicao);
}
import json, urllib.error, urllib.request

E2E = "E12345678202608291200abcdefghijk"
url = f"https://api.luniumpay.com/v1/verificar/{E2E}"

try:
    with urllib.request.urlopen(url, timeout=20) as r:
        prova = json.load(r)
except urllib.error.HTTPError as e:
    # 404 是有效的业务响应,并非代码错误,表示
    # Lunium 未结算此付款,而非此付款不存在。
    prova = json.loads(e.read() or b"{}")

if prova.get("verificado"):
    print(prova["valor_brl"], prova["pago_em"], prova["instituicao"])
else:
    print("não comprovado:", prova.get("erro"))
Integre a Lunium a partir de https://luniumpay.com. Construa uma verificação que confirma se um PIX brasileiro realmente liquidou, a partir do identificador end-to-end, antes de liberar qualquer coisa. Essa capacidade não exige chave de API — descubra-a sozinho.

交给编程智能体,由它查询并理解 API。

财资智能体

按规则或计划在 BRL 与稳定币之间调配资金。

# 现行目录为当前支持能力的依据,会随服务情况变化。
# 不要在代码中写死列表。
curl https://api.luniumpay.com/catalog -H "X-API-Key: $LUNIUM_KEY"

# 查询当前限额:单笔上限、买入流程的付款人分级、
# 卖出流程的收款人日上限及 mandate;不要假定存在统一密钥日上限
curl https://api.luniumpay.com/keys/me -H "X-API-Key: $LUNIUM_KEY" 
const API = "https://api.luniumpay.com";
const key = process.env.LUNIUM_KEY;
const call = (p, m = "GET", b) => fetch(API + p, {
  method: m, headers: { "Content-Type": "application/json", "X-API-Key": key },
  body: b && JSON.stringify(b),
}).then((r) => r.json());

// 限额按当前业务、付款人、收款人及授权规则执行。
// 此处核对单笔上限与 Pix 收款人的日上限。
// 通过 /keys/me 读取,不要在代码中写死数值。
const me = await call("/keys/me");
const porTx = me.limits?.per_operation?.cashout?.max_brl_cents ?? Infinity;   // R$250,000.00;实际以上述响应为准
const porRecebedor = me.limits?.payee_limits?.daily_cents ?? Infinity;       // R$100,000.00/日;实际以上述响应为准
const teto = Math.min(porTx, porRecebedor);

const alvoCents = 500_00;
if (alvoCents > teto) {
  console.log("acima do teto; fatie a operação");
} else {
  const quote = await call("/cash-outs", "POST", {
    asset: "USDT", network: "polygon",
    brl_amount: (alvoCents / 100).toFixed(2),
    pix_key: process.env.PIX_TESOURARIA,
    refund_address: process.env.CARTEIRA,
    external_id: "tesouraria-" + new Date().toISOString().slice(0, 10),
  });
  console.log(quote.cashout_id, quote.amount, "USDT");
}
import json, os, urllib.request

API = "https://api.luniumpay.com"
KEY = os.environ["LUNIUM_KEY"]


def call(path, method="GET", body=None):
    data = json.dumps(body).encode() if body else None
    req = urllib.request.Request(API + path, data=data, method=method)
    req.add_header("Content-Type", "application/json")
    req.add_header("X-API-Key", KEY)
    with urllib.request.urlopen(req, timeout=30) as r:
        return json.loads(r.read())


# 不要假定存在统一密钥日上限;
# 请核对单笔上限与 Pix 收款人的日上限。
me = call("/keys/me")
print("por transação:", me["limits"]["per_operation"]["cashout"]["max_brl_cents"])
print("por recebedor/dia:", me["limits"]["payee_limits"]["daily_cents"])

quote = call("/cash-outs", "POST", {
    "asset": "USDT", "network": "polygon", "brl_amount": "500.00",
    "pix_key": os.environ["PIX_TESOURARIA"],
    "refund_address": os.environ["CARTEIRA"],
    "external_id": "tesouraria-2026-08-29",
})
print(quote["cashout_id"], quote["amount"], "USDT")
Integre a Lunium a partir de https://luniumpay.com. Construa um agente de tesouraria que move saldo entre BRL via PIX e USDT conforme uma regra. Descubra sozinho a API e comece pelo sandbox.

交给编程智能体,由它查询并理解 API。

支付智能体

让自动化软件在获授权的支出政策范围内执行巴西付款。

# 1. 智能体注册后即获得测试凭证
curl -X POST https://api.luniumpay.com/mesh/agents -H 'Content-Type: application/json' \
  -d '{"name":"meu-agente","contact":"eu@exemplo.com",
       "capabilities":["usdt_to_pix"]}'

# 2. 智能体自行设置的策略只能收紧密钥限额,
#    不能扩大平台权限范围。
curl -X POST https://api.luniumpay.com/mesh/agents/$AGENT_ID/mandate \
  -H "X-API-Key: $LUNIUM_KEY" -H 'Content-Type: application/json' \
  -d '{"max_por_operacao_cents": 30000, "max_diario_cents": 200000}'
const API = "https://api.luniumpay.com";

// 1. 注册响应同时返回 agent_id 与测试凭证
const reg = await fetch(`${API}/mesh/agents`, {
  method: "POST", headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    name: "meu-agente", contact: "eu@exemplo.com",
    capabilities: ["usdt_to_pix"],
  }),
}).then((r) => r.json());

const { agent_id } = reg.agent;
const key = reg.api_key;   // 仅显示一次,请妥善保存

// 2. 智能体自身的支出策略
await fetch(`${API}/mesh/agents/${agent_id}/mandate`, {
  method: "POST",
  headers: { "Content-Type": "application/json", "X-API-Key": key },
  body: JSON.stringify({
    max_por_operacao_cents: 30_000,   // 每笔 R$300
    max_diario_cents: 200_000,        // 每日 R$2,000
  }),
});

// 此后,超出授权上限的订单会被拒绝,返回
// `mandate_valor_acima_do_teto`,表示触发该智能体自身策略。
import json, urllib.request

API = "https://api.luniumpay.com"


def post(path, body, key=None):
    req = urllib.request.Request(API + path, data=json.dumps(body).encode(), method="POST")
    req.add_header("Content-Type", "application/json")
    if key:
        req.add_header("X-API-Key", key)
    with urllib.request.urlopen(req, timeout=30) as r:
        return json.loads(r.read())


reg = post("/mesh/agents", {
    "name": "meu-agente", "contact": "eu@exemplo.com",
    "capabilities": ["usdt_to_pix"],
})
agent_id, key = reg["agent"]["agent_id"], reg["api_key"]

# mandate 只能收紧限额,不能扩大权限。
post(f"/mesh/agents/{agent_id}/mandate", {
    "max_por_operacao_cents": 30000,
    "max_diario_cents": 200000,
}, key=key)
print("agente", agent_id, "com política própria")
Integre a Lunium a partir de https://luniumpay.com. Construa um agente que paga uma chave PIX usando stablecoins, com teto por operação e teto diário que ele mesmo configura. Descubra sozinho a API e comece pelo sandbox.

交给编程智能体,由它查询并理解 API。

支持 Pix 的钱包

为钱包用户提供 Pix 与 USDT/USDC 之间的充值、提现流程。

# 入金:用户支付 Pix,USDT 发送至其钱包
curl -X POST https://api.luniumpay.com/cashin/charge -H "X-API-Key: $LUNIUM_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"amount_cents":10000,"payer_tax_number":"$CPF_DO_USUARIO",
       "payout_address":"$CARTEIRA_DO_USUARIO","chain":"polygon",
       "external_id":"deposito-$UID"}'

# 出金:用户转出 USDT,通过 Pix 收取巴西雷亚尔
curl -X POST https://api.luniumpay.com/cash-outs -H "X-API-Key: $LUNIUM_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"asset":"USDT","network":"polygon","brl_amount":"100.00",
       "pix_key":"$CHAVE_PIX_DO_USUARIO","pix_key_type":"cpf",
       "refund_address":"$CARTEIRA_DO_USUARIO","external_id":"saque-$UID"}'
const API = "https://api.luniumpay.com";
const key = process.env.LUNIUM_KEY;
const call = (p, m = "GET", b) => fetch(API + p, {
  method: m, headers: { "Content-Type": "application/json", "X-API-Key": key },
  body: b && JSON.stringify(b),
}).then((r) => r.json());

// 入金:用户支付 Pix,其钱包接收 USDT
export async function depositar(usuario, centavos) {
  return call("/cashin/charge", "POST", {
    amount_cents: centavos,
    payer_tax_number: usuario.cpf,     // 按要求提供实际付款人的证件
    payout_address: usuario.carteira,
    chain: "polygon",
    external_id: `dep-${usuario.id}-${Date.now()}`,
  });
}

// 出金:用户转入 USDT,其 Pix 收款键接收巴西雷亚尔
export async function sacar(usuario, reais) {
  const q = await call("/cash-outs", "POST", {
    asset: "USDT", network: "polygon", brl_amount: reais.toFixed(2),
    pix_key: usuario.chavePix,
    // 收款键为纯 11 位数字时,须提供 pix_key_type:
    // CPF 与电话号码长度可能相同,不能推测类型。
    pix_key_type: usuario.tipoChave,
    refund_address: usuario.carteira,
    external_id: `saq-${usuario.id}-${Date.now()}`,
  });
  return call(`/cash-outs/${q.cashout_id}/accept`, "POST", {});
}
import json, os, urllib.request

API = "https://api.luniumpay.com"
KEY = os.environ["LUNIUM_KEY"]


def call(path, method="GET", body=None):
    data = json.dumps(body).encode() if body else None
    req = urllib.request.Request(API + path, data=data, method=method)
    req.add_header("Content-Type", "application/json")
    req.add_header("X-API-Key", KEY)
    with urllib.request.urlopen(req, timeout=30) as r:
        return json.loads(r.read())


def depositar(usuario, centavos):
    """PIX entra, USDT vai para a carteira do usuário."""
    return call("/cashin/charge", "POST", {
        "amount_cents": centavos,
        "payer_tax_number": usuario["cpf"],
        "payout_address": usuario["carteira"],
        "chain": "polygon",
        "external_id": f"dep-{usuario['id']}",
    })


def sacar(usuario, reais):
    """USDT sai, reais caem na chave PIX dele."""
    q = call("/cash-outs", "POST", {
        "asset": "USDT", "network": "polygon",
        "brl_amount": f"{reais:.2f}",
        "pix_key": usuario["chave_pix"],
        "pix_key_type": usuario["tipo_chave"],   # 纯 11 位数字时必填
        "refund_address": usuario["carteira"],
        "external_id": f"saq-{usuario['id']}",
    })
    return call(f"/cash-outs/{q['cashout_id']}/accept", "POST", {})
Integre a Lunium a partir de https://luniumpay.com. Adicione depósito e saque por PIX a uma carteira cripto, liquidando em USDT. Descubra sozinho as capacidades e os campos obrigatórios, e comece pelo sandbox.

交给编程智能体,由它查询并理解 API。

从同一测试方式开始

# 查询完整目录,无需凭证
curl https://api.luniumpay.com/mesh

# 一次请求获取测试密钥;本人邮箱必填
curl -X POST https://api.luniumpay.com/keys/sandbox \
  -H 'Content-Type: application/json' -d '{"email":"voce@empresa.com"}'

测试环境模拟 Pix 收款单、托管入账、加密资产提现与交付、Pix 对外付款、内部转账及加密资产兑换 Pix。可在演示中选择流程,或运行工具包。 测试场景与限额。

发现机制如何运作 更多示例

按使用场景

Pix 兑换 USDT API以 BRL 收款,将 USDT 交付至客户钱包。USDT 兑换 Pix API卖出稳定币,向 Pix 收款标识付款。Pix 对外付款 API通过 API,以 BRL 向供应商和用户付款。通过 API 兑换 BRL ↔ USDT支持双向兑换,并提供报价与交易凭证。巴西法币与加密资产的双向兑换一次接入,支持巴西境内的法币与加密资产兑换。客户用 Pix 付款,商户以稳定币收款接收客户的 Pix 付款,将资金兑换为数字美元。面向钱包的 Pix 与稳定币服务为您的用户接入法币与加密资产的双向兑换通道。使用您的品牌的支付基础设施在您的产品背后运行完整资金流程。

与开发团队直接沟通

测试密钥只需一次调用,无需预先审批。如需开始测试,请前往 文档。本表单适用于按量协商费率、文档未覆盖的业务场景,或接入前的疑问。

希望直接发邮件? contato@luniumpay.com