Token支付
使用现有支付Token处理一次性支付。此端点允许商户在不创建订阅的情况下向客户收费,使用Token中安全存储的支付信息。
POSThttps://api.efundpay.com/v4/tokens/{token_id}/payment
This endpoint requires the
subscriptions.write
scope.Authorizations
Authorizationstringheaderrequired
Bearer认证头,格式为 `Bearer <token>`,其中 `<token>` 是您的认证令牌。
Headers
x-merchant-account-idstringrequired
用于此请求的商户账户ID。
Examples:
"default"
idempotency-keystring
确保请求幂等性的唯一密钥。如果提供,相同的请求不会被处理多次。
Examples:
"unique-key-123"
X-Forwarded-Forstringrequired
连接到服务器的客户端的原始IP地址。
Examples:
"203.0.113.195"
Body
application/jsonamountintegerrequired
支付金额,以分为单位(最小货币单位)。
Examples:
"1000"
"2999"
currencystringrequired
支付货币(ISO 4217格式)。
Examples:
"USD"
"EUR"
external_identifierstringrequired
此支付的商户引用标识。用于在您的系统中识别支付。
Length:1 - 64
Examples:
"payment-12345"
descriptionstring
支付的描述。
Length:1 - 255
Examples:
"One-time payment using token"
metadataobject
用于附加信息的自定义键值对。
Examples:
"{"campaign": "summer_promotion", "source": "website"}"
Response
application/json
Successful Response
idstringrequired
唯一支付标识符。
Examples:
"pay_1234567890abcdef"
objectstringrequired
对象类型,始终为"payment"。
Examples:
"payment"
token_idstringrequired
用于此支付的Token ID。
Examples:
"tok_a1b2c3d4"
amountintegerrequired
支付金额,以分为单位。
Examples:
"1000"
currencystringrequired
支付货币。
Examples:
"USD"
statusstringrequired
支付状态:succeeded、failed、processing。
Examples:
"succeeded"
"failed"
external_identifierstringrequired
此支付的商户引用标识。
Examples:
"payment-12345"
createdstringrequired
支付创建时间(ISO 8601)。
Examples:
"2025-08-12T09:00:00Z"
customerobjectrequired
来自Token的客户信息。
payment_methodobjectrequired
来自Token的支付方式信息。
descriptionstring
支付描述。
Examples:
"One-time payment using token"
metadataobject
自定义元数据。
Examples:
"{}"
curl --request POST \--url https://api.efundpay.com/v4/tokens/{token_id}/payment \--header 'Authorization: Bearer <token>' \--header 'x-merchant-account-id: <x-merchant-account-id>' \--header 'Content-Type: application/json' \--header 'idempotency-key: unique-key-123' \--header 'X-Forwarded-For: 203.0.113.195' \--data '{"amount": 1000,"currency": "USD","external_identifier": "payment-12345","description": "One-time payment using token","metadata": {"campaign": "summer_promotion","source": "website"}}'
{"id": "pay_1234567890abcdef","object": "payment","token_id": "tok_a1b2c3d4","amount": 1000,"currency": "USD","status": "succeeded","external_identifier": "payment-12345","created": "2025-08-12T09:00:00Z","customer": {"display_name": "John Doe","external_identifier": "customer-12345","first_name": "John","last_name": "Doe","email_address": "john@example.com","phone_number": "+1234567890"},"payment_method": {"type": "card","card": {"last4": "1111","expiration_date": "12/27"}},"description": "One-time payment using token","metadata": {"campaign": "summer_promotion","source": "website"}}