跳转到主要内容

Apple Pay 会话

POST/api/v1/bank/public/charge/applepay/{uuid}/session
公共端点

此端点在 Apple Pay 支付流程中从浏览器调用。当用户点击 Apple Pay 按钮时,您的 JavaScript 调用 ApplePaySession.onvalidatemerchant,该操作会触发此端点,向 Apple 服务器验证 A55 作为支付处理商的身份。


请求头

请求头必填
Content-Typeapplication/json

路径参数

字段类型必填说明
uuidstring (UUID)Apple Pay 支付的收费 UUID

请求体

字段类型必填说明
validation_urlstring来自 onvalidatemerchant 事件的 Apple 商户验证 URL
domainstring您的网站域名(例如 www.your-store.com
display_namestringApple Pay 界面上显示的商户名称

响应字段

字段类型说明
merchant_sessionobject不透明的 Apple Pay 会话对象——传递给 completeMerchantValidation()
merchant_session.epochTimestampnumber会话创建时间戳
merchant_session.expiresAtnumber会话过期时间戳
merchant_session.merchantSessionIdentifierstringApple 会话 ID
merchant_session.merchantIdentifierstringApple 商户 ID

HTTP 状态码

状态码说明
200商户会话已创建
400validation_url 或域名无效
404收费未找到或不是 Apple Pay 收费
409此收费已创建会话
422域名未在 Apple Pay 注册
429超出请求频率限制
500服务器内部错误

代码示例

curl -s -X POST "https://core-manager.a55.tech/api/v1/bank/public/charge/applepay/a1b2c3d4-e5f6-7890-abcd-ef1234567890/session" \
-H "Content-Type: application/json" \
-d '{
"validation_url": "https://apple-pay-gateway.apple.com/paymentservices/startSession",
"domain": "www.your-store.com",
"display_name": "示例商户"
}'

错误响应示例

{
"status": "error",
"message": [
{
"code": "DOMAIN_NOT_REGISTERED",
"source": "applepay",
"description": "Domain www.your-store.com is not registered for Apple Pay. Register it in the A55 dashboard."
}
]
}