创建收银台交易
此端点是checkout模式下的创单接口,创建订单后会跳转到一个支付链接进行支付。此端点允许您处理各种支付方式,包括信用卡、数字钱包和其他支付工具。
POSThttps://api.efundpay.com/v4/checkout/payments
This endpoint requires the
transactions.write
scope.Authorizations
Authorizationstringheaderrequired
Bearer 认证头,格式为 `Bearer <token>`,其中 `<token>` 是您的认证令牌。
Headers
x-merchant-account-idstringrequired
用于此请求的商户账户ID。
Examples:
"default"
idempotency-keystring
确保请求幂等性的唯一密钥。如果提供,相同的请求不会被处理多次。
Examples:
"unique-key-123"
Body
application/jsonamountintegerrequired
要收取的货币金额,以最小货币单位表示(例如,100分表示收取$1.00)。
Range:100 <= x <= 99999999
Examples:
"1299"
currencystringrequired
ISO 4217三字母货币代码。对于重定向请求,此值必须与payment_method中指定的currency匹配
Length:3
Examples:
"USD"
"EUR"
"GBP"
external_identifierstringrequired
此交易的商户参考。用于在您的系统中识别交易。
Length:1 - 64
Examples:
"order-12345"
countrystring | null
处理交易的国家/地区的2字母ISO代码。这也用于过滤可以处理交易的支付服务。如果为重定向请求提供此值且不为null,则必须与payment_method中指定的country匹配。否则,将隐式假定payment_method中指定的country值。
Examples:
"US"
"GB"
"TH"
redirect_urlstringrequired
在浏览器中完成3DS后重定向用户返回的URL。
Examples:
"https://example.com"
webhooks_urlstringrequired
接收支付状态通知的webhook URL。
Examples:
"https://merchant.com/webhooks/payment"
cancel_urlstring
如果支付被取消,重定向用户的URL。
Examples:
"https://merchant.com/payment/cancel"
buyerobjectrequired
内联提供的访客买家详情,而不是预先创建买家资源并使用buyer_id或buyer_external_identifier键。
cart_itemsCartItem . object[] | nullrequired
表示交易行项目的购物车项目数组。
billing_detailsobject | null
此交易的账单详情。
shipping_detailsobject | null
此交易的配送详情。
metadataobject | null
您希望存储为键值对的关于交易的任何附加信息。此数据会传递给支持它的支付服务提供商。
Examples:
"{"order_id": "12345", "customer_type": "premium"}"
Response
application/json
Successful Response
typestring
资源类型。
Examples:
"transaction"
idstringrequired
此交易的唯一标识符。
Examples:
"7099948d-7286-47e4-aad8-b68f7eb44591"
merchant_account_idstringrequired
商户账户ID。
Examples:
"default"
currencystringrequired
交易的货币。
Examples:
"EUR"
"USD"
amountintegerrequired
交易的金额。
Examples:
"1299"
statusstringrequired
交易状态。
Examples:
"authorization_succeeded"
"processing"
external_identifierstringrequired
交易的外部标识符。
Examples:
"transaction-12345"
payment_url_linkstring | null
待处理支付的URL链接。
Examples:
"https://pay.efundpay.com/abc123"
countrystring
交易的国家/地区。
Examples:
"US"
error_codestring
如果有错误,则为错误代码。
Examples:
"missing_redirect_url"
buyerobject
买家信息。
shipping_detailsobject
配送详情。
cart_itemsarray
购物车商品列表。
created_atstring
创建时间。
Examples:
"2013-07-16T19:23:00.000+00:00"
curl --request POST \--url https://api.efundpay.com/v4/checkout/payments \--header 'Authorization: Bearer <token>' \--header 'x-merchant-account-id: <x-merchant-account-id>' \--header 'Content-Type: application/json' \--data '{"amount": 1299,"currency": "USD","redirect_url": "https://yourdomain.com/redirect","webhooks_url": "https://yourdomain.com/webhooks/payment","cancel_url": "https://yourdomain.com/cancel","buyer": {"external_identifier": "buyer-12345","display_name": "John Doe","email_address": "john@example.com","first_name": "John","last_name": "Doe"},"cart_items": [{"name": "GoPro HD","quantity": 1,"unit_amount": 1299}],"external_identifier": "order-12345"}'
{"type": "transaction","id": "7099948d-7286-47e4-aad8-b68f7eb44591","merchant_account_id": "default","currency": "USD","amount": 1299,"status": "processing","country": "US","external_identifier": "order-12345","payment_url_link":"https://pay.efundpay.com/abc123""buyer": {"external_identifier": "buyer-12345","display_name": "John Doe",},"created_at": "2013-07-16T19:23:00.000+00:00"}