公开接口

POST /core/v1/billing/nowpayments/ipn

NOWPayments IPN 验签、查询核实与原子唯一入账

NOWPayments 使用账户会话管理充值订单;仅 IPN 由供应商携带 x-nowpayments-sig 调用。先检查当前充值能力,USD 美分与 credit_micro 为不同单位。保留原订单和 Idempotency-Key,unknown 不重建 invoice;只有官方查询核实足额 finished 才唯一入账。签名为递归排序 JSON 的 HMAC SHA512,不能由浏览器伪造付款。

身份要求

公开接口. 会话/管理写操作不在公共 Playground 执行。

接口

curl --request POST 'https://api.oneaster.ai/core/v1/billing/nowpayments/ipn' \
  --header 'x-nowpayments-sig: '"$NOWPAYMENTS_SIGNATURE" \
  --header 'Content-Type: application/json' \
  --data-binary @"$NOWPAYMENTS_IPN_FILE"

参数

- x-nowpayments-sig (header, 必填): {"type":"string","pattern":"^[a-fA-F0-9]{128}$"} NOWPayments 官方 HMAC SHA512 签名。

请求 JSON Schema

{
  "type": "object",
  "description": "NOWPayments 原始 IPN JSON;保留 body 和 x-nowpayments-sig,递归排序/HMAC SHA512 验签后查询支付证据。不得通过浏览器伪造付款结果。"
}

响应

200

NOWPayments IPN 验签、查询核实与原子唯一入账

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "data": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "reused": {
                  "type": "boolean"
                }
              },
              "required": [
                "reused"
              ]
            },
            {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "ignored": {
                  "const": true
                }
              },
              "required": [
                "ignored"
              ]
            }
          ]
        }
      },
      "required": [
        "success",
        "data"
      ]
    }
  }
}

default

错误代码见 core-api.md;供应商/数据库错误已隐藏。

{
  "application/json": {
    "schema": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": false
        },
        "error": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "code": {
              "type": "string"
            },
            "message": {
              "type": "string"
            },
            "type": {
              "const": "oneaster_error"
            }
          },
          "required": [
            "code",
            "message",
            "type"
          ]
        },
        "data": {
          "type": "null"
        }
      },
      "required": [
        "success",
        "error",
        "data"
      ]
    }
  }
}