创建支付

为您的服务创建支付链接

POST

https://api.fps.pro/invoices/create

请求格式application/json

amount

required

number

指定法币中的支付金额

currency

required

string

接受的法币(见法币列表)

order_id

string

您系统中的订单 ID

network

string

您可以指定必须接收支付的网络,也可以留空以接受任意可用网络的支付

webhook_link

url

支付状态回传的 URL

默认值: merchant settings

success_link

url

支付成功后客户跳转的 URL

默认值: merchant settings

error_link

url

支付失败后客户跳转的 URL

默认值: merchant settings

part_payment

boolean

您可以允许或禁止单笔支付中的部分付款

默认值: true or merchant settings

ignore_client_amount

boolean

如果设置为 True,客户支付的任意金额都会成功完成发票

默认值: false or merchant settings

payment_accuracy

number

指定 1 到 100 的百分比。例如 $100 支付设置为 5 时,客户支付 $95 即视为成功并完成

默认值: 0 or merchant settings

fee

number

1 到 100 的值,将按百分比为支付增加手续费

默认值: 0

discount

number

1 到 100 的值,将按指定百分比为支付应用折扣

默认值: 0

additional_info

string

任意信息

auto_convert

boolean

收到付款后自动兑换

默认值: false

响应格式data object

id

uuid

发票 ID

info.currency

string | null

发票的法币代码

info.token

string | null

支付代币

info.network

string | null

支付网络

info.address

string | null

用于支付的钱包地址

amount.starting_price

number

发票的初始法币金额

amount.discount_percent

number

折扣百分比

amount.merchant_fee_percent

number

商户手续费百分比

amount.service_fee_percent

number | null

平台服务费百分比

amount.total

number

折扣和手续费后的最终金额

url.webhook

url | null

商户 Webhook URL

url.success

url | null

支付成功后的跳转 URL

url.error

url | null

支付失败后的跳转 URL

url.payment

url

支付页面链接

options.part_payment

boolean

是否允许部分付款

options.ignore_client_amount

boolean

是否忽略客户的精确金额

options.payment_accuracy

number

允许的付款误差

additional.order_id

string | null

外部订单 ID

additional.info

string | null

订单附加信息

status

string

发票当前状态

expired_at

string (ISO 8601, UTC)

发票过期日期

created_at

string (ISO 8601, UTC)

发票创建日期

请求示例

curl --request POST 'https://api.fps.pro/invoices/create' \
  --header 'Content-Type: application/json' \
  --header 'X-Client-Id: YOUR_CLIENT_ID' \
  --header 'X-Timestamp: 1720000000' \
  --header 'X-Signature: YOUR_HMAC_SHA256_SIGNATURE' \
  --data '{
  "amount": 150.75,
  "currency": "usd",
  "order_id": "ORD-1001",
  "network": "tron",
  "webhook_link": "https://merchant.example.com/webhooks/fps",
  "success_link": "https://merchant.example.com/payments/success",
  "error_link": "https://merchant.example.com/payments/error",
  "part_payment": true,
  "ignore_client_amount": false,
  "payment_accuracy": 0,
  "fee": 1.5,
  "discount": 3,
  "additional_info": "Premium subscription",
  "auto_convert": false
}'

成功响应

{
  "status": 201,
  "message": "invoice created",
  "data": {
    "id": "0a718b02-138d-495a-9661-39ca52139c07",
    "info": {
      "currency": "USD",
      "token": null,
      "network": null,
      "address": null
    },
    "amount": {
      "starting_price": 1000,
      "discount_percent": 0,
      "merchant_fee_percent": 10,
      "service_fee_percent": 1,
      "total": 1100
    },
    "url": {
      "webhook": "https://merchant.example/webhook",
      "success": "https://merchant.example/success",
      "error": "https://merchant.example/error",
      "payment": "https://frontend.example/0a718b02-138d-495a-9661-39ca52139c07"
    },
    "options": {
      "part_payment": true,
      "ignore_client_amount": false,
      "payment_accuracy": 0
    },
    "additional": {
      "order_id": "1",
      "info": ""
    },
    "status": "init",
    "expired_at": "2026-01-05 14:30:43",
    "created_at": "2026-01-05T13:30:43.000Z"
  }
}

错误

详细的授权错误列表位于 授权 - 错误

{
  "status": 422,
  "message": "Validation Error",
  "errors": [
    {
      "field": "currency",
      "message": "currency is required"
    }
  ]
}
{
  "status": 500,
  "message": "Internal Server Error"
}