API 文档

有疑问?问问文档。

打开右下角的助手并输入问题。它会搜索整份文档,几秒内给出答案,并附上对应章节的链接。

#简介

Receivify 把一笔加密货币付款变成一次 API 调用。您为某个金额创建一张账单;我们返回一个全新的收款地址和一个托管收银台页面。后台进程会监视区块链,在确认数足够时为账单入账,将资金扣除我们的手续费后转发到您的钱包,并向您的服务器发送一条已签名的 webhook。

基础 URL 为 https://receivify.io。所有请求体和响应体都是 JSON。

http
Base URL   https://receivify.io
Invoices   POST   /api/v1/invoices
Status     GET    /api/public/invoices/:id   (no auth, for checkout)
自动转发。不存在需要提现的账户余额。已确认的资金会自动划转到您的结算地址——我们只保留手续费。
4 步即可运行

#快速入门

1. 创建账户,然后打开控制台 → API 密钥并创建一个密钥。它形如 rcv_live_…,只显示一次,请妥善保存。

2. 创建一张账单。本页每个示例都提供 cURL 和各个官方 SDK 版本;只需选择一次语言,所有代码块都会随之切换。安装命令见 SDK 页面。

curl -X POST https://receivify.io/api/v1/invoices \
  -H "Authorization: Bearer rcv_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "amount_btc": "0.0025", "reference": "order-1042" }'

3. 将客户重定向到响应中的 checkout_url。

4. 接收已签名的 invoice.paid webhook,然后履行订单。就这么简单。

#身份验证

对 /api/v1/* 的每个请求,都用您的秘密 API 密钥作为 bearer 令牌进行鉴权。密钥只在创建时显示一次,且只以哈希形式存储——如果丢失,请轮换它。

http
Authorization: Bearer rcv_live_9f2c…
只在服务器端使用。该密钥可以创建账单并读取您账户下的所有账单。切勿将其放进浏览器或移动应用。公开状态端点(/api/public/invoices/:id)无需密钥,可以安全地用于您的收银台页面。
会话与 TOTP

#账户与双重验证

没有密码。只需邮箱即可注册,并通过我们发送的链接确认;之后使用我们发到邮箱的 6 位验证码登录。API 密钥用于插件和 API:在 控制台 → 开发者 中创建(每个密钥只显示一次)。控制台会话是一个 httpOnly cookie。

bash
# sign up — email only; returns your API key (once) and opens a session
curl -X POST https://receivify.io/api/auth/register \
  -H 'content-type: application/json' \
  -d '{"email":"[email protected]"}'

# sign in — email + API key. Add "totp":"123456" when 2FA is on
curl -X POST https://receivify.io/api/auth/login \
  -H 'content-type: application/json' \
  -d '{"email":"[email protected]","api_key":"rcv_live_…"}'

在控制台的 安全 中启用 TOTP 双重验证(或调用 POST /api/v1/2fa/setup → /enable)。启用后,登录需要 6 位验证码,缺少时返回 401 totp_required。

收款地址的更改受到保护。开启“先用验证码确认”后,每次更改收款地址都需要发送到您邮箱的验证码。每次更改也会向您发送提醒,被盗的会话无法悄悄转走您的资金。
轮换不停机

#API 密钥

可以签发多个带标签的密钥,并随时吊销其中任意一个。已登录的控制台或现有密钥都可以操作。

# create a labelled key (raw key returned once)
curl -X POST https://receivify.io/api/v1/keys \
  -H 'authorization: Bearer rcv_live_…' \
  -H 'content-type: application/json' \
  -d '{"label":"production"}'

# list keys (prefixes only) / revoke one
curl https://receivify.io/api/v1/keys -H 'authorization: Bearer rcv_live_…'
curl -X POST https://receivify.io/api/v1/keys/<id>/revoke -H 'authorization: Bearer rcv_live_…'
POST /api/v1/invoices

#创建账单

可以用法币定价(自动换算并锁定汇率)、用币种本身定价,或用基本单位定价。用 asset 选择币种(默认 btc;必须已启用且可结算)。

amount_fiat
类型
number | string
说明
法币价格,例如 49.99。与 currency 搭配使用。按当前汇率换算;汇率锁定在账单上。返回时是十进制字符串("49.99")。
currency
类型
string?
说明
amount_fiat 的 ISO 代码,例如 "USD"、"EUR"。默认 USD。支持 55 种。
asset
类型
string?
说明
要收取的币种,例如 btc(默认)、ltc、doge、bch、xmr、eth、sol、trx、usdt、usdc。必须已启用且可结算——参见 GET /api/v1/assets。
chain
类型
string?
说明
用于多网络币种:ethereum、polygon、bsc、base、arbitrum、… 或 solana / tron(例如 Tron 上的 USDT 是 asset usdt + chain tron)。
amount
类型
string?
说明
以币种计的十进制金额,例如 "0.0025"。
amount_btc
类型
string?
说明
旧版字段:十进制 BTC。精确解析——绝不当作浮点数。
amount_sats
类型
integer?
说明
币种的整数基本单位。
reference
类型
string?
说明
您的订单 ID。具有幂等性:同一商户 + reference 会返回已有账单——即使它已过期。要重试订单,请加上尝试次数(order-1042-2)。参见下文“重试订单”。
callback_url
类型
string?
说明
webhook 目标地址。生产环境必须为 https。
return_url
类型
string?
说明
付款完成后托管收银台把付款人送往的地址:一个“返回商店”按钮,外加 3 秒倒计时后的自动跳转(付款人可取消)。仅限 https,最长 2048 个字符,您的查询字符串(?order=1042)原样保留。
cancel_url
类型
string?
说明
账单过期或被取消时托管收银台把付款人送往的地址。规则与 return_url 相同。
customer_email
类型
string?
说明
可选。我们替您向客户发送付款请求、收据和提醒邮件。需要已解锁客户邮件——否则返回 403 customer_emails_locked。参见下文“客户邮件”。
notify
类型
boolean?
说明
默认 true。false 时只保存 customer_email,不发送邮件。
metadata
类型
object?
说明
任意 JSON,原样回传给您。永远不会展示给客户。

请求:

json
{
  "amount_btc": "0.0025",
  "reference": "order-1042",
  "callback_url": "https://shop.com/hooks/rcv",
  "return_url": "https://shop.com/checkout/thanks?order=1042",
  "cancel_url": "https://shop.com/cart?order=1042",
  "metadata": { "cart_id": "c_88f2" }
}

响应 201 Created(如果该 reference 已存在,也返回同样的 201 和响应体):

json
{
  "id": "82c6004a-a251-44f9-bbc7-9d22e03ee65c",
  "reference": "order-1042",
  "asset": "btc",
  "amount_expected": "250000",
  "amount_received": "0",
  "address": "bcrt1qam8t3w805yqehyy7hwl6sn5jlugkekfz2fpc5r",
  "status": "pending",
  "expires_at": "2026-07-26T20:53:00.000Z",
  "paid_at": null,
  "metadata": { "cart_id": "c_88f2" },
  "checkout_url": "https://receivify.io/pay/82c6004a-…",
  "return_url": "https://shop.com/checkout/thanks?order=1042",
  "cancel_url": "https://shop.com/cart?order=1042"
}

重试订单。reference 和 Idempotency-Key 都会去重:再次发送相同的值会返回同一张账单及其原始的 201,即使账单已过期。这正是双击或网络重试安全的原因。如果客户回来支付一个账单已过期的订单,请发起新的尝试:使用 order-1042-2 作为 reference,并配上相应的幂等键。我们的购物车插件会自动这样做,并在账单仍可支付时复用该账单。

响应中的金额是以整数基本单位表示的字符串,因此在任何语言中都不会受浮点舍入影响。amount_fiat 也是字符串——十进制字符串("49.99"),因为法币价格不是基本单位数量。本 API 中没有任何金额字段是 JSON 数字;只有外汇汇率是数字。

可选,解锁后可用

#客户邮件

传入 customer_email,我们就会替您给客户发邮件:带“立即付款”按钮的付款请求、部分付款时的提醒、确认后的收据,以及账单过期时的简短通知。每封邮件都带有您的名称、标志和颜色,发件人显示为“您的商店 via Receivify”(Scale 套餐可使用您自己的域名),客户回复会直接到达您。

月交易额达到 $25,000(上月或本月)、使用包含该功能的预付套餐,或购买邮件额度后,即可解锁客户邮件。在此之前,带有 customer_email 的请求会被拒绝并返回 403 customer_emails_locked,而不是被悄悄忽略——请省略该字段,或发送 notify: false 以仅保存地址而不发送邮件。

json
{
  "amount_fiat": "49.99",
  "currency": "USD",
  "reference": "order-1042",
  "customer_email": "[email protected]"
}

保护措施:只发送与真实账单关联的交易类邮件,每张账单最多四封,每个账户有每日上限,每封邮件都可一键退订,退信或投诉的地址永远不会再收到邮件。您可以在控制台的 客户邮件 中选择要发送的邮件、预览邮件并查看投递日志。

#查询账单

获取单张账单(需鉴权),或按状态筛选列出账单:

# one invoice
curl https://receivify.io/api/v1/invoices/82c6004a-… \
  -H "Authorization: Bearer rcv_live_…"

# list, newest first (limit ≤ 200)
curl "https://receivify.io/api/v1/invoices?status=paid&limit=50" \
  -H "Authorization: Bearer rcv_live_…"

在收银台页面上,请轮询无需密钥的公开端点——它只暴露状态、地址、金额、币种、网络、到期时间和确认数,没有任何敏感信息。它会发送 Access-Control-Allow-Origin: *,因此您商店自己的页面可以直接在浏览器中轮询它;它按 IP 限流(每分钟 120 次——每 4–5 秒轮询一次):

curl https://receivify.io/api/public/invoices/82c6004a-…
# { "status": "confirming", "amount_expected": "250000", "amount_received": "250000", … }
签名回调

#Webhook 与签名

账单状态变化时,我们会向您的 callback_url 发送 POST 请求,并附带 x-receivify-signature 请求头。投递失败会按指数退避重试。请求体与转发回调使用同一个信封——{ event, sequence, created_at, data }——账单位于 data 中。信封字段和重放语义参见转发回调。

http
x-receivify-signature: t=1753560000,v1=6f3b…

验证方法:用您的 webhook 密钥计算 `${t}.${rawBody}` 的 HMAC-SHA256,并以恒定时间比较。请使用原始请求体——而不是重新序列化后的 JSON。请接受一个密钥列表,而不是单个密钥:轮换期间会有两个密钥同时合法有效。

// client built with { webhookSecrets: [process.env.RECEIVIFY_WEBHOOK_SECRET] }
import { SIGNATURE_HEADER } from 'receivify'

app.post('/webhooks/receivify', express.raw({ type: 'application/json' }), (req, res) => {
  let event
  try {
    event = client.parseWebhook(req.body, req.get(SIGNATURE_HEADER))   // RAW bytes
  } catch {
    return res.sendStatus(400)   // bad signature, stale timestamp or bad JSON
  }
  if (event.event === 'invoice.paid') fulfil(event.data.reference)
  res.sendStatus(200)
})

您的语言没有 SDK?校验只需几行代码。下面是用 Node 手写的版本,方便您移植:

verify-webhook.js
javascript
import crypto from "node:crypto"

// `secrets` is an ARRAY: [current, previous?]. Pass one element when you are
// not mid-rotation — this signature then never has to change.
export function verify(rawBody, header, secrets) {
  const parts = Object.fromEntries(
    header.split(",").map((kv) => kv.split("="))
  )
  const sig = Buffer.from(parts.v1 || "")

  const ok = [].concat(secrets).some((secret) => {
    const expected = Buffer.from(crypto
      .createHmac("sha256", secret)
      .update(`${parts.t}.${rawBody}`)
      .digest("hex"))
    return sig.length === expected.length &&
      crypto.timingSafeEqual(sig, expected)
  })
  if (!ok) throw new Error("bad signature")

  // reject anything older than 5 minutes to stop replays
  if (Math.floor(Date.now() / 1000) - Number(parts.t) > 300) {
    throw new Error("stale webhook")
  }
}

轮换密钥。POST /api/v1/webhooks/secret/rotate 会生成一个新密钥,并且只返回一次。旧密钥在返回的 prev_expires_at(默认 24 小时)之前仍然有效——我们只用当前密钥签名,所以宽限期是给您接收端的说明:先用新密钥验证,在旧密钥过期前回退到旧密钥。短时间内连续轮换两次会替换上一个密钥,而不是串联,因此您的回退列表永远不超过两个。GET /api/v1/webhooks/secret 会报告 rotated_at、prev_expires_at 和 prev_active——但从不返回密钥本身。

invoice.confirming
触发时机
已在链上发现入账,正在等待确认。
invoice.partial
触发时机
到账了一部分金额,但不是全部。
invoice.paid
触发时机
确认数已足够;账单已全额支付。
sweep.sent
触发时机
净额已转发到您的结算地址。

独立核验付款

始终先校验签名(见上文,或 SDK 中的 verifyWebhook / verify_webhook)。有效的签名证明事件来自我们且未被篡改。如果您想在发货前再做一次独立核验,可以直接查询区块链本身——这一步无需信任我们。

对于真实账单,invoice.paid 包含核验所需的全部信息:address(该账单的收款地址)、amount_expected 和 amount_received(精确的整数基本单位——satoshi、wei、代币单位)、asset、chain、confirmations_required、confirmations 以及 payments[](每项含 txid、amount 和 confirmations)。sweep.sent 还会附加 payout:转发到您结算地址那笔交易的 txid、address 和 amount。从您自己的节点或公共区块浏览器获取每个 txid,然后确认:

  • 该交易付款到 address(如果是代币,则是来自该代币官方合约、转给该地址的 Transfer);
  • 付给该地址的总额不少于 amount_expected;
  • 在您的节点上至少有 confirmations_required 个确认。
verify-evm.js (viem)
javascript
import { createPublicClient, http, decodeEventLog, erc20Abi } from "viem"
import { mainnet } from "viem/chains" // pick the chain named in data.chain

const client = createPublicClient({ chain: mainnet, transport: http(process.env.MY_RPC_URL) })

// token: the official contract for data.asset on that chain, or null for the
// native coin (e.g. USDC on Ethereum: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)
export async function verifyEvm(data, token) {
  const to = data.address.toLowerCase()
  const head = await client.getBlockNumber()
  let paid = 0n
  for (const p of data.payments) {
    const r = await client.getTransactionReceipt({ hash: p.txid })
    if (r.status !== "success") continue
    if (head - r.blockNumber + 1n < BigInt(data.confirmations_required ?? 1)) continue
    if (!token) {
      const tx = await client.getTransaction({ hash: p.txid })
      if (tx.to?.toLowerCase() === to) paid += tx.value
      continue
    }
    for (const log of r.logs) {
      if (log.address.toLowerCase() !== token.toLowerCase()) continue
      try {
        const ev = decodeEventLog({ abi: erc20Abi, data: log.data, topics: log.topics })
        if (ev.eventName === "Transfer" && ev.args.to.toLowerCase() === to) paid += ev.args.value
      } catch { /* not a Transfer */ }
    }
  }
  if (paid < BigInt(data.amount_expected)) throw new Error("not paid on chain")
}
verify-btc.js (public explorer API)
javascript
// mempool.space's Esplora API; point it at your own instance or node if you run one.
const API = "https://mempool.space/api"

export async function verifyBtc(data) {
  const tip = Number(await (await fetch(`${API}/blocks/tip/height`)).text())
  let paid = 0n
  for (const p of data.payments) {
    const tx = await (await fetch(`${API}/tx/${p.txid}`)).json()
    if (!tx.status.confirmed) continue
    if (tip - tx.status.block_height + 1 < (data.confirmations_required ?? 1)) continue
    for (const out of tx.vout) {
      if (out.scriptpubkey_address === data.address) paid += BigInt(out.value) // satoshis
    }
  }
  if (paid < BigInt(data.amount_expected)) throw new Error("not paid on chain")
}

在按最终性结算的链上(confirmations_required 为 null),请检查交易是否已最终确定,而不是数区块。如果 payments 为空,请轮询 GET /api/v1/invoices/:id,或在链上查看收款地址的余额。

在 sweep.sent 时,对 payout.txid 做同样的查询,可以看到资金到达 payout.address——请与您保存的收款地址核对。该地址受到保护:每次更改都会通过邮件提醒您;开启“先用验证码确认”后,更改还需要我们发送到您邮箱的验证码——因此泄露的 API 密钥或密码无法悄悄转走您的收款。

#账单状态

pending
含义
已创建;尚未收到任何款项。
confirming
含义
已在链上发现付款,确认数尚未达到阈值。
partial
含义
收到的金额少于应付金额。
paid
含义
已全额支付并确认。账本分录已记账。
swept
含义
净额已转发到您的钱包。
expired
含义
账单有效期已结束,未收到付款。
无状态,基于地址

#转发地址

转发地址是一个绑定到您已控制的目标钱包的常驻收款地址。付到这个地址的任何款项——任意次数、任意金额——都会被检测、入账,并在扣除您的手续费后自动在链上转发。不需要预先确定金额,也没有托管收银台页面:款项直接进入您自己的钱包。

金额
转发
任意金额,任意次数
账单
创建时固定
资金去向
转发
您自己的钱包(destination)
账单
划转到您的结算地址
收银台界面
转发
无——自行搭建
账单
托管的 checkout_url
地址复用
转发
永久(单会话币种除外)
账单
每张账单一个地址

一行搞定——一个普通的 GET 请求就会返回一个全新的收款地址:

terminal
bash
curl -H "Authorization: Bearer rcv_live_…" \
  "https://receivify.io/api/v1/address/create?ticker=usdc_base&destination=0xYourWallet&callback=https://you.com/hook"

或者用 JSON,或通过 SDK 完成同样的操作:

curl -X POST https://receivify.io/api/v1/address \
  -H "Authorization: Bearer rcv_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "ticker": "usdc_base", "destination": "0xYourWallet", "callback": "https://you.com/hook" }'

从完整列表中选择一个币种代码(币种 + 网络):

curl https://receivify.io/api/v1/tickers

单独的符号(eth、usdc、sol、trx)对应该币种的默认网络;其他网络请加上网络后缀——usdc_base、usdc_polygon、eth_arbitrum、usdc_solana、usdt_tron。btc、ltc、doge、bch、zec 和 xmr 完全没有网络后缀。

宽松的别名——沿用其他网关的习惯写法也能直接生效:

address, to, payout_address
代替
destination
coin, currency, asset
代替
ticker
callback_url, webhook, webhook_url, url
代替
callback
confs
代替
confirmations

无法识别的币种代码会得到有用的提示,而不是一个干巴巴的错误:

json
{ "error": "bad_ticker", "detail": "Unknown ticker \"usdcbase\". Did you mean: usdc_base?" }

响应 201 Created——这里的每个字段都与 serializeForward() 返回的完全一致:

json
{
  "id": "b3f2b6b0-...-c9a1",
  "forward_id": "b3f2b6b0-...-c9a1",
  "ticker": "usdc_base",
  "provider": "evm",
  "chain": "base",
  "address": "0xDepositAddressGeneratedForYou",
  "destination": "0xYourWallet",
  "callback_url": "https://you.com/hook",
  "confirmations_required": 2,
  "min_forward": "0.500000",
  "status": "active",
  "expires_at": null,
  "created_at": "2026-08-24T12:00:00.000Z",
  "updated_at": null
}

创建是确定性的。一个转发的身份由 (ticker, destination, callback_url) 决定:用相同的三个值调用两次创建,会得到相同的 id 和相同的收款地址,返回 200 OK 而不是 201 Created。重试、代理和重复触发的请求都不会让一个集成出现两个地址。LTC、DOGE、BCH、ZEC 和 XMR 例外——它们是单会话的,因此每次调用都会生成一个新地址,并且总是返回 201。

以及生命周期的其余部分:

GET /api/v1/address
作用
列出您的转发。?status=active|paused|disabled|expired, ?ticker=, ?limit=, ?cursor=.
GET /api/v1/address/:id
作用
单个转发,以及它的付款记录和回调投递日志。
PATCH /api/v1/address/:id
作用
暂停或恢复(status: active | paused),或修改 callback_url。
DELETE /api/v1/address/:id
作用
软删除——设置 status: disabled。记录永远不会被移除。
destination 不可修改。改指一个正在使用的转发地址,会悄悄改变所有已持有该地址的付款人的去向——这恰恰是持有被盗 API 密钥的人会做的事。要更换结算钱包,请创建一个新转发并暂停旧的。暂停或停用只会停止为新的存入入账;已入账的款项仍会转发到您的 destination。已收到的钱永远不会被丢弃。

min_forward 是该币种代码的经济下限,以该币种自身的单位计——低于它时,处理进程会推迟转发代币付款,而不是花掉比付款本身还多的 gas(原生币除外)。所有永久地址——BTC、EVM、Solana 和 Tron——的 expires_at 都是 null。五个单会话币种(ltc、doge、bch、xmr、zec)则不同:每次创建调用都会生成一个有真实有效期的新地址,所以请为每笔预期付款申请一个新地址——不要把同一个地址用于第二笔付款。

出站发送按链单独开关。每条链的出站广播都有自己的开关,我们只会在该链发生事故时为保护资金而关闭它。Bitcoin 没有这个开关。开关关闭期间,付款仍会被检测并记入您的账本余额(forward.confirmed 照常触发);结算只是等待开关重新打开。不会丢失任何款项,您还会收到带 reason: gate_disabled 的 forward.deferred,所以等待从来不会是无声的。
就在此处,立即试用

#在线试用

在当前部署上创建一个真实的转发地址。选择一个币种代码,填入您想收款的钱包,然后运行——下方的请求预览和代码片段会随着您的输入实时更新。

请求预览
GET /api/v1/address/create
bash
curl -H "Authorization: Bearer rcv_live_YOUR_KEY" \
  "https://receivify.io/api/v1/address/create?ticker=btc&destination=YOUR_PAYOUT_ADDRESS&callback=https%3A%2F%2Fyou.com%2Fwebhooks%2Freceivify"
每笔付款触发

#转发回调

六种事件会发送到转发自己的 callback_url(而不是您账户级的 webhook 端点——那些只用于账单)。正常路径是 detected → confirmed → sent;另外三种事件的存在,是为了让您永远不必去猜测“没有消息”意味着什么。

forward.detected
时机
我们已看到该交易,但它尚未达到确认阈值。目前还没有入账——这只是提前通知,不是资金。
pending
true
forward.confirmed
时机
付款已确认并记入您的账本余额,即使链上转发尚未发生。
pending
false
forward.deferred
时机
已入账,但暂不发出——reason 会说明原因。这不是错误;没有任何损失。
pending
false
forward.sent
时机
净额已在链上广播到您的 destination。
pending
false
forward.reversed
时机
一笔入账被撤销,因为为其提供资金的交易已不存在(重组,或 Replace-By-Fee 替换)。
pending
false
forward.failed
时机
该付款被暂扣等待人工审核,不会自行流转。您的资金仍保持入账状态。
pending
false

forward.deferred 在付款进入延迟状态时触发,之后只在 reason 变化时再次触发——绝不会每次轮询都触发。原因包括 gate_disabled、uneconomical、below_minimum、insufficient_funds、wallet_unavailable、nonce_collision、not_forwardable 和 books_halted。forward.reversed 携带 reorg 或 rbf;forward.failed 携带 unverifiable、max_attempts 或 reversal_conflict。

不存在 forward.partial。转发地址没有应付金额,所以不可能少付——到账多少就入账多少。如果金额太小、转发不划算,您会收到带 below_minimum 或 uneconomical 的 forward.deferred,等之后付到同一地址的款项把它推过下限时就会发出。

账单 webhook 和转发回调共用同一个信封,因此一个接收端就能同时解析两者。按 event 分支处理;资源位于 data 中。

event
类型
string
含义
事件名称——按它分支,就能知道 data 是什么。
sequence
类型
number
含义
在您的所有投递中递增。可用于排序和去重。
created_at
类型
string
含义
ISO-8601 UTC——事件发生的时间,而不是本次尝试发送的时间。
data
类型
object
含义
资源:forward.* 对应一笔转发付款,invoice.* 对应一张账单。

data 对每一个 forward.* 事件都是同样的结构——只有 pending、reason 和 detail 会随事件变化:

forward_id
类型
string
含义
这笔付款所属的转发。
ticker
类型
string
含义
创建该转发时使用的币种代码。
address_in
类型
string
含义
收到这笔付款的收款地址。
address_out
类型
string
含义
您的目标地址。
txid_in
类型
string
含义
入账交易的 ID。
txid_out
类型
string | null
含义
出账交易的 ID——在 forward.sent 之前为 null。
value
类型
string
含义
收到的总额,以基本单位表示的整数字符串。
value_forwarded
类型
string
含义
转发的净额(总额减去手续费),以基本单位表示的整数字符串。
fee
类型
string
含义
扣留的手续费,以基本单位表示的整数字符串。
confirmations
类型
number
含义
事件发生时的确认数。
pending
类型
boolean
含义
仅在 forward.detected 时为 true——已发现,但尚未入账。
reason
类型
string | null
含义
deferred/reversed/failed 时的机器可读原因;其他情况为 null。请按它分支,而不是按 detail。
detail
类型
string | null
含义
解释 reason 的一句人类可读文字,可安全地显示在控制台中。这是说明文字,不是契约——切勿解析它。
network_fee_paid_by
类型
'merchant' | 'platform'
含义
可选,发送后出现:merchant = 网络费从您收到的金额中扣除。
network_fee
类型
string | null
含义
可选:该笔网络费,以基本单位表示(已知时提供)。
value_received
类型
string | null
含义
可选:您的地址实际收到的金额(已知时提供)。
json
{
  "event": "forward.confirmed",
  "sequence": 41,
  "created_at": "2026-08-24T12:05:00.000Z",
  "data": {
    "forward_id": "b3f2b6b0-...-c9a1",
    "ticker": "usdc_base",
    "address_in": "0xDepositAddressGeneratedForYou",
    "address_out": "0xYourWallet",
    "txid_in": "0xabc...",
    "txid_out": null,
    "value": "1500000",
    "value_forwarded": "1485000",
    "fee": "15000",
    "confirmations": 2,
    "pending": false,
    "reason": null,
    "detail": null
  }
}

……以及携带延迟信息的同一个信封,让您始终知道某笔款项为何在等待:

json
{
  "event": "forward.deferred",
  "sequence": 42,
  "created_at": "2026-08-24T12:06:00.000Z",
  "data": {
    "forward_id": "b3f2b6b0-...-c9a1",
    "ticker": "usdc_base",
    "address_in": "0xDepositAddressGeneratedForYou",
    "address_out": "0xYourWallet",
    "txid_in": "0xabc...",
    "txid_out": null,
    "value": "1500000",
    "value_forwarded": "1485000",
    "fee": "15000",
    "confirmations": 2,
    "pending": false,
    "reason": "uneconomical",
    "detail": "forwarding this payment would currently cost more in network fees than the payment is worth; it is held and retried as fees move"
  }
}

签名方式与账单 webhook 相同——x-receivify-signature 请求头和校验代码见上文Webhook 与签名。金额是精确的整数基本单位字符串;请用 BigInt 解析,而不是 Number。

重试和重放发送的是冻结的负载。请求体在事件发生时只构建一次,每次重试都会逐字节重新发送——重放的 invoice.paid 永远显示 paid,即使该账单此后已被划转。webhook 告诉您发生了什么;要了解当前的真实状态,请轮询 GET /api/v1/invoices/:id 或 GET /api/v1/address/:id。请把投递视为“至少一次”,并按 sequence 去重。

#错误

错误会返回一个 JSON 响应体,其中包含机器可读的 error 和人类可读的 detail:

json
{ "error": "bad_request", "detail": "Provide amount_sats or amount_btc." }
400
error
bad_request
时机
请求体格式错误、金额无效或 callback_url 无效。
401
error
unauthorized
时机
缺少 API 密钥或密钥无效。
404
error
not_found
时机
不存在该 id 的账单。
502
error
upstream_error
时机
无法从节点派生收款地址。
所有端点

#API 参考

商户路由既接受 Bearer API 密钥,也接受控制台会话 cookie。

POST /api/auth/register
鉴权
公开
作用
创建账户;返回第一个 API 密钥。
POST /api/auth/login
鉴权
公开
作用
邮箱 + API 密钥(+ TOTP)→ 会话 cookie。
POST /api/auth/logout
鉴权
会话
作用
结束会话。
GET /api/auth/me
鉴权
会话
作用
当前账户。
POST /api/v1/invoices
鉴权
密钥/会话
作用
创建账单。
GET /api/v1/invoices
鉴权
密钥/会话
作用
列出账单(可按状态筛选)。
GET /api/v1/invoices/:id
鉴权
密钥/会话
作用
查询一张账单。
POST /api/v1/invoices/:id/cancel
鉴权
密钥/会话
作用
取消一张待支付的账单。
POST /api/v1/invoices/bulk
鉴权
密钥/会话
作用
批量取消账单。
GET /api/v1/tickers
鉴权
公开
作用
所有支持转发的币种代码。
GET /api/v1/address/create
鉴权
密钥/会话
作用
通过查询参数创建转发地址(下方 POST 的 GET 版本)。
POST /api/v1/address
鉴权
密钥/会话
作用
创建转发地址。新建返回 201,已存在返回 200。
GET /api/v1/address
鉴权
密钥/会话
作用
列出转发地址(可按状态 / 币种代码筛选)。
GET /api/v1/address/:id
鉴权
密钥/会话
作用
查询转发地址、其状态及付款记录。
PATCH /api/v1/address/:id
鉴权
密钥/会话
作用
暂停/恢复,或修改 callback_url。destination 不可修改。
DELETE /api/v1/address/:id
鉴权
密钥/会话
作用
停用转发地址(软删除)。
GET /api/v1/summary
鉴权
密钥/会话
作用
按币种统计的交易额、手续费、30 天序列和汇率。
GET/PATCH /api/v1/payouts
鉴权
密钥/会话
作用
查看 / 更改收款地址(受保护)。
POST /api/v1/payouts/changes/:id/cancel
鉴权
密钥/会话
作用
取消一项待生效的结算地址变更。
GET /api/v1/keys
鉴权
密钥/会话
作用
列出 API 密钥。
POST /api/v1/keys
鉴权
会话
作用
创建 API 密钥(仅限控制台;若已启用双重验证需提供验证码)。
POST /api/v1/keys/:id/revoke
鉴权
会话
作用
吊销密钥(仅限控制台;若已启用双重验证需提供验证码)。
POST /api/v1/2fa/setup · /enable · /disable
鉴权
会话
作用
管理 TOTP 双重验证。
GET/POST /api/v1/webhooks/endpoints
鉴权
密钥/会话
作用
列出 / 添加账户的 webhook 端点。
PATCH /api/v1/webhooks/endpoints/:id
鉴权
密钥/会话
作用
暂停(active: false)或更正 URL。
DELETE /api/v1/webhooks/endpoints/:id
鉴权
密钥/会话
作用
删除一个端点。
GET /api/v1/webhooks/deliveries
鉴权
密钥/会话
作用
投递日志。?event=, ?status=, ?limit=, ?cursor=.
POST /api/v1/webhooks/deliveries/:id/replay
鉴权
密钥/会话
作用
重新排队一次投递。
GET /api/v1/webhooks/secret
鉴权
密钥/会话
作用
轮换状态(仅元数据——从不返回密钥本身)。
POST /api/v1/webhooks/secret/rotate
鉴权
密钥/会话
作用
轮换签名密钥;旧密钥在 24 小时内仍然有效。
GET/POST /api/v1/payment-links
鉴权
密钥/会话
作用
列出 / 创建收款链接。
GET/PATCH/DELETE /api/v1/payment-links/:id
鉴权
密钥/会话
作用
读取、编辑(title/amount/active)或吊销一个链接。
GET /api/v1/assets
鉴权
公开
作用
已启用的币种及其最低金额和手续费。
GET /api/public/invoices/:id
鉴权
公开
作用
供您的收银台页面使用的免密钥状态查询。
GET /api/health
鉴权
公开
作用
供监控使用的服务健康状态。

Fee Guard 是您仪表板中的一个开关。开启期间,网络手续费异常偏高的币种会从客户选择的币种列表中隐藏,并会自动恢复。使用 API 密钥时,GET /api/v1/assets?expand=networks 会省略这些币对,并在 fee_guard.hidden 中列出;加上 fee_guard=off 可获取完整列表。创建发票永远不会因 Fee Guard 而被拒绝。 规则:仅当某币种的网络手续费超过该网络过去 7 天常规水平的两倍,且至少为 0.10 美元时,才会隐藏该币种。

复制一个完整可运行的应用

#完整示例项目

用您的语言编写的同一个小商店,逐个文件展示:一个创建账单并把客户送往托管收银台的购买页面,一个基于原始请求体校验签名并将订单标记为已付款的 webhook 路由,以及一个订单页面。下面的每个项目都发布在 receivify-sdks/examples 中,并在上线前对 API 做过端到端运行。它会跟随您在上方选择的语言。

package.json在 GitHub 上查看
{
  "name": "receivify-example-node-express",
  "private": true,
  "version": "1.0.0",
  "description": "A tiny shop that takes crypto with Receivify: create an invoice, redirect to checkout, mark the order paid from a signed webhook.",
  "type": "module",
  "main": "server.js",
  "scripts": {
    "start": "node --env-file-if-exists=.env server.js",
    "dev": "node --watch --env-file-if-exists=.env server.js"
  },
  "engines": { "node": ">=20.6" },
  "dependencies": {
    "express": "^4.21.2",
    "receivify": "^1.0.0"
  }
}
  1. 1安装
    npm install
  2. 2添加密钥并启动
    cp .env.example .env   # fill in RECEIVIFY_API_KEY and RECEIVIFY_WEBHOOK_SECRET
    npm start
  3. 3测试您的 webhook
    npx localtunnel --port 3000   # or cloudflared / ngrok
    # then Dashboard → Webhooks → Send test

使用 git clone https://github.com/receivify/receivify-sdks 克隆全部内容,然后执行 cd receivify-sdks/examples/node-express。

llms.txt, OpenAPI, AGENTS.md

#用 AI 集成

正在用 Cursor、Claude Code、Copilot 或 ChatGPT 编写集成?把这些文件交给它们。它们由 API 测试所依据的同一份 openapi.yaml 生成,因此助手读到的是真实的契约,而不是凭旧博客文章去猜。

在让助手构建任何东西之前,先把这段粘贴给它:

prompt
markdown
You are integrating Receivify crypto payments into this project.
Read https://receivify.io/llms-full.txt first and follow it exactly.

Rules:
- Use the official SDK for this language if one exists (Node: npm install receivify,
  Python: pip install receivify, PHP: composer require receivify/receivify after
  composer config repositories.receivify vcs https://github.com/receivify/receivify-php
  (from the GitHub repository), Go: go get github.com/receivify/receivify-sdks/go). Otherwise call the REST API.
- Create one invoice per order with a reference unique to that order, then redirect
  the customer to invoice.checkout_url.
- Verify every webhook on the RAW request body with the SDK's verify function, and
  mark the order paid only on invoice.paid. Never trust the redirect back.
- Amounts are strings in base units or decimal strings; never use floats for money.
- Read RECEIVIFY_API_KEY and RECEIVIFY_WEBHOOK_SECRET from environment variables.

或者在您的仓库里放一个 AGENTS.md,这样打开该项目的每个助手(Claude Code、Cursor、Copilot、Codex)都会自动获取这些规则:

AGENTS.md
markdown
# Payments: Receivify

- API reference for agents: https://receivify.io/llms-full.txt
- Spec: https://receivify.io/openapi.yaml
- Example projects: https://github.com/receivify/receivify-sdks/tree/main/examples

## Rules
- Create invoices server-side only; never expose RECEIVIFY_API_KEY to the browser.
- One invoice per order; reference = a unique order id, prefixed with the store name.
- Webhook route: read the raw body, verify x-receivify-signature with the SDK,
  dedupe by event sequence, set the order paid only on invoice.paid, reply 2xx fast.
- Money is never a float: base-unit strings or decimal strings only.
- Test with Dashboard → Webhooks → Send test, then one small real payment.

提示:在 Cursor 中,把 https://receivify.io/llms-full.txt 添加到 Docs 下以便建立索引;在 Claude Code 中,上面的 AGENTS.md 会被自动读取;在 Copilot 或 ChatGPT 中,粘贴提示词并附上该文件。想先看看结果?示例项目正是一个正确集成的样子。各工具的具体步骤和 AI 智能体使用场景见用 AI 集成页面。

想让智能体在你的账户里直接操作,而不只是写代码?Receivify MCP 服务器为 Claude Code、Cursor、Codex 等 MCP 客户端提供工具,凭你的 API 密钥即可创建发票和付款链接、查询付款。它的任何工具都不会转出资金。各智能体的设置方法见:AI 智能体。

在第一笔真实订单之前

#测试您的集成

测试 webhook,无需付任何款。向您的端点发送一个已签名的示例事件,检查您的服务器是否校验签名并返回 2xx:

curl -X POST https://receivify.io/api/v1/webhooks/test \
  -H "Authorization: Bearer rcv_live_…"

响应会显示您的端点返回了什么。请先注册端点(控制台 → Webhook),或者直接在那里使用发送测试。

检查投递了什么。真实的投递记录列在 GET /api/v1/webhooks/deliveries 中;修复端点后,可以重放失败的投递:

# failed deliveries, newest first
curl "https://receivify.io/api/v1/webhooks/deliveries?status=failed" \
  -H "Authorization: Bearer rcv_live_…"

# re-send one once your endpoint is fixed
curl -X POST https://receivify.io/api/v1/webhooks/deliveries/<id>/replay \
  -H "Authorization: Bearer rcv_live_…"

一笔真实付款,端到端。按该币种的最低金额(由 GET /api/v1/assets 列出)创建一张账单,并用您自己的钱包支付。您会看到账单变为 paid,收到 invoice.paid webhook,资金扣除手续费后到达您的结算地址。

准备好收款了吗?
看看交互式结账的实际效果。
返回概览