获取支付链接 (Get Payment Link)
获取静态支付链接的详细信息,包括产品信息和支持的支付代币。这通常是 AI 支付流程的入口点。
GET /payment/link/:linkId
请求参数
| 字段 | 类型 | 必填 | 描述 |
|---|---|---|---|
linkId | String | ✅ | 支付链接的唯一标识符 (例如 lnk_...)。作为路径参数传递。 |
响应结构
响应包含链接详情和一个 aiView 对象,该对象描述了可用的支付选项 (supportedPaymentTokens) 和创建会话的要求。
响应示例
{
"merchantId": "f7d65b193454db...",
"linkId": "lnk_example_premium_plan_01",
"linkVersion": "ver_example_03",
"linkName": "Premium Membership",
"lineItems": [
{
"quantity": 1,
"productData": {
"productName": "Premium Plan",
"productDescription": "Unlock all features",
"imageUrl": "https://example.com/image.png",
"attributes": [
{ "name": "Duration", "value": "1 Month" }
]
},
"unitPriceInUSD": "1.00"
}
],
"aiView": {
"pricingModel": {
"type": "fixed"
},
"supportedPaymentTokens": [
{
"chainName": "Polygon",
"chainId": "137",
"tokenAddress": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"amountInToken": "3009000",
"amountInUSD": "3.00"
}
],
"createPaymentSessionRequirement": {
"authorizationRequired": true,
"authorizationSpec": {
"type": "eip712",
"purpose": "create_payment_session",
"domain": {
"name": "aipay.gstable.io",
"version": "1",
"chainId": "<payment_chain_id>"
},
"types": {
"PaymentSessionCreationAuthorization": [
{ "name": "purpose", "type": "string" },
{ "name": "linkId", "type": "string" },
{ "name": "linkVersion", "type": "string" },
{ "name": "merchantId", "type": "string" },
{ "name": "payer", "type": "address" },
{ "name": "paymentChainId", "type": "uint256" },
{ "name": "paymentToken", "type": "address" },
{ "name": "amount", "type": "uint256" },
{ "name": "authorizationNonce", "type": "bytes32" },
{ "name": "authorizationExpiresAt", "type": "uint256" }
]
}
}
}
}
}
注意:
aiView中的createPaymentSessionRequirement提供了调用 创建会话 (Create Session) 接口所需的精确 EIP-712 类型定义。
错误处理
此接口遵循 统一错误处理 标准。业务错误返回 HTTP 200 及非零 code。