跳到主要内容

创建交易

使用 EFundFlow API 创建新的支付交易。该接口支持处理多种支付方式,包括信用卡、数字钱包及其他支付工具。

POSThttps://api.efundpay.com/v4/transactions
This endpoint requires the transactions.write scope.

Authorizations

Authorizationstringheaderrequired

认证请求头,格式为 `Bearer <token>`,`<token>` 为您的认证令牌。

Headers

x-merchant-account-idstring | null

此请求要使用的商户账户ID。

Examples:"default"
idempotency-keystring

幂等性键,用于确保请求的唯一性。如果提供,则相同请求不会被多次处理。

Examples:"unique-key-123"
X-Forwarded-Forstringrequired

上送买家浏览器等客户端获取的原始IP地址。

Examples:"203.0.113.195"

Body

application/json
amountintegerrequired

订单支付金额,以最小货币单位计算(例如,1.00美元对应100美分)。

Range:100 <= x <= 99999999
Examples:"1299"
currencystringrequired

订单币种,可参考ISO 4217三位货币代码。

Length:3
Examples:"USD""EUR""GBP"
external_identifierstringrequired

商户交易单号,商户需要保证该订单号全局唯一。

Length:1 - 64
Examples:"order-12345"
countrystring | null

交易处理所在国家的2位ISO代码。

Examples:"US""GB""TH"
payment_methodobject | nullrequired

支付方式。包括国际信用卡和本地支付方式(APM)。有关每种支付方式的详细说明,请参阅支付方式

buyerobject | null

买家信息。当payment_method.method是APM的时候必填

cart_itemsCartItem . object[] | nullrequired

商品信息。

billing_detailsobject | null

此交易的账单地址。

shipping_detailsobject | null

此交易的送货地址。

metadataobject | null

交易的其他信息,用于商户自定义信息。

Examples:"{"order_id": "12345", "customer_type": "premium"}"
browser_infoobject | null

买家使用的浏览器信息。这可以用于反欺诈服务。

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_methodobjectrequired

交易的支付方式。

methodenum<string>required

用于交易的支付方式。

Examples:"card"
countrystring

交易国家。

Examples:"US"
error_codestring

如果有错误,则为错误代码。

Examples:"missing_redirect_url"
buyerobject

买家信息。

shipping_detailsobject

送货地址。

cart_itemsarray

商品信息。

three_d_secureobject

3D Secure信息。

created_atstring

创建时间。

Examples:"2013-07-16T19:23:00.000+00:00"
curl --request POST \
--url https://api.efundpay.com/v4/transactions/payments \
--header 'Authorization: Bearer <token>' \
--header 'x-merchant-account-id: <x-merchant-account-id>' \
--header 'X-Forwarded-For: 203.0.113.195' \
--header 'Content-Type: application/json' \
--data '{
"amount": 1299,
"currency": "USD",
"payment_method": {
"method": "card",
"number": "4111111111111111",
"expiration_date": "12/25",
"security_code": "123",
"redirect_url": "https://example.com",
"webhooks_url": "https://yourdomain.com/webhooks/payment",
},
"buyer": {
"display_name": "John Doe",
"email_address": "john@example.com"
},
"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_method": {
"method": "card",
"scheme": "visa",
"expiration_date": "12/25",
"country": "US",
"details": {
"bin": "411111",
"card_type": "credit",
"card_issuer_name": "Test Bank",
"payment_url_link":"https://pay.efundpay.com/abc123",
"payment_app_link":"app://pay/abc123",
"url_link_expire_sec":300,
"payment_qr_code":"weixin://wxpay/bizpayurl?pr=abc123",
"payment_qr_code_expire_sec":300
}
},
"method": "card",
"buyer": {
"type": "buyer",
"id": "fe26475d-ec3e-4884-9553-f7356683f7f9",
"display_name": "John Doe",
"external_identifier": "buyer-12345",
"billing_details": {
"first_name": "John",
"last_name": "Doe",
"email_address": "john@example.com",
"phone_number": "+1234567890",
"address": {
"city": "San Jose",
"country": "US",
"postal_code": "94560",
"state": "California",
"state_code": "US-CA",
"house_number_or_name": "10",
"line1": "Stafford Appartments",
"line2": "29th Street",
"organization": "EFundFlow"
}
}
},
"created_at": "2013-07-16T19:23:00.000+00:00"
}
Powered by Docusaurus