Sale

交易

请求地址:POST /api/payment

请求参数

M-必填,O-非必填,C-条件选填

参数
类型
必填
说明

transactionType

String(32)

C

Sale / Authorization (目前默认 Sale)

transactionId

String(128)

M

商户交易唯一 ID

orderId

String(128)

O

商户订单 ID,可以重复但只能存在一笔成功交易

currency

String(3)

M

币种 (CNY/USD)

amount

Number(12,3)

M

交易金额

appId

Number(20)

C

APP ID(omain 二选一)

domain

String(128)

C

请求网站域名 (appId 二选一)

callbackUrl

String(255)

C

3D/Checkout 回调 URL,3D/Checkout 交易必填

notificationUrl

String(255)

C

异步通知 URL,此参数不为空,交易完成会往此地址发送通知

transactionIp

String(128)

M

持卡人交易 IP

productName

String(255)

O

产品名称

productInfos

Array

O

产品详情,详见下表

Object

M

卡信息,JSON 对象,见下表

Object

C

账单信息,JSON 对象,见下表

Object

C

邮寄信息,JSON 对象,见下表

Object

C

3D 交易请求浏览器参数,JSON 对象,见下表

secure

Boolean

O

是否请求 3D 交易 true/false

extension

Object

C

扩展字段,某些交易特定字段

ProductInfos 对象

参数
类型
必填

productName

String(128)

O

商品名称

currency

String(3)

O

商品币种

price

Number(12,3)

O

单个商品价格

sku

String(128)

O

商品 SKU

quantity

Number(4)

O

商品个数

productLink

String(255)

O

商品链接

Card对象

参数
类型
必填
说明

cardNumber

String(20)

M

卡号

expiredYear

String(2)

M

过期年份两位(23)

expiredMonth

String(2)

M

过期月份两位(02)

cardholder

String(128)

M

持卡人姓名

cvv

String(4)

M

安全码

BillingAddress&ShippingAddress 对象

参数
类型
必填
说明

firstName

String(64)

O

lastName

String(64)

O

email

String(255)

O

邮箱

phone

String(32)

O

电话

country

String(2)

O

国家 2 位 CODE

state

String(128)

O

city

String(128)

O

城市

address

String(255)

O

地址

zipCode

String(64)

O

邮编

Browser 浏览器参数

参数
类型
必填
说明

accept

String(128)

O

浏览器参数

userAgent

String(128)

O

浏览器参数

acceptLanguage

String(128)

O

浏览器参数

javaEnabled

Boolean

O

浏览器参数

colorDepth

String(16)

O

浏览器参数

screenHeight

String(16)

O

浏览器参数

screenWidth

String(16)

O

浏览器参数

timeZoneOffset

String(32)

O

浏览器参数

referer

String(128)

O

浏览器参数

请求实例

{
    "transactionType": "Sale",
    "transactionId": "123456",
    "currency": "USD",
    "amount": "8.88",
    "appId": "123456",
    "callbackUrl": "https://domain/callback",
    "notificationUrl": "https://domain/notification",
    "transactionIp": "127.0.0.1",
    "productName": "Stonebriar Unscented Tea Light Candles with 6-7 Hour Burn Time - White, Pack of 100",
    "productInfos": [
        {
            "productName": "Stonebriar Unscented Tea Light Candles with 6-7 Hour Burn Time - White, Pack of 100",
            "currency": "USD",
            "price": "8.88",
            "sku": "123-456-789",
            "quantity": 1,
            "productLink": "https://domain/123-456-789"
        }
    ],
    "card": {
        "expiredYear": "23",
        "expiredMonth": "12",
        "cardNumber": "4200000000000000",
        "cardholder": "san zhang",
        "cvv": "123"
    },
    "billingAddress": {
        "firstName": "Gross",
        "lastName": "Schmidt",
        "country": "CA",
        "email": "[email protected]",
        "city": "Longueuil",
        "address": "3226 rue Saint-Charles",
        "phone": "450-928-5752",
        "state": "Quebec",
        "zipCode": "J4H 1M3"
    },
    "shippingAddress": {
        "firstName": "Gross",
        "lastName": "Schmidt",
        "country": "CA",
        "email": "[email protected]",
        "city": "Longueuil",
        "address": "3226 rue Saint-Charles",
        "phone": "450-928-5752",
        "state": "Quebec",
        "zipCode": "J4H 1M3"
    },
    "browser": {
        "userAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.24 Safari/537.36 Edg/83.0.478.18",
        "referer": "https://www.domain.com"
    },
    "extension": {
        "identificationType": "IDENTITY",
        "identificationValue": "1234567890",
        "thirdPartyId": "1234567890",
        "thirdPartyName": "ABC"
    }
}

返回实例

交易成功

{
    "code": 100,
    "isTest": true,
    "appId": 123456,
    "uniqueId": "1669548151356891137",
    "billDescription": "*Description",
    "message": "successful transaction",
    "timestamp": 1686886273516,
    "transactionAmount": "8.88",
    "transactionAt": "2023-06-16 11:31:12",
    "transactionCardNumber": "420000******0000",
    "transactionCurrency": "USD",
    "transactionId": "123456",
    "transactionMessage": "Approved"
}

交易失败

{
    "code": 101,
    "isTest": true,
    "appId": 123456,
    "uniqueId": "1669548151356891137",
    "billDescription": "*Description",
    "message": "transaction failed",
    "timestamp": 1686886273516,
    "transactionAmount": "8.88",
    "transactionAt": "2023-06-16 11:31:12",
    "transactionCardNumber": "420000******0000",
    "transactionCurrency": "USD",
    "transactionId": "123456",
    "transactionMessage": "Do not honor"
}

交易跳转

{
    "code": 301,
    "isTest": true,
    "appId": 123456,
    "uniqueId": "1669548151356891137",
    "billDescription": "*Description",
    "message": "order processing",
    "timestamp": 1686886273516,
    "transactionAmount": "8.88",
    "transactionAt": "2023-06-16 11:31:12",
    "transactionCardNumber": "420000******0000",
    "transactionCurrency": "USD",
    "transactionId": "123456",
    "transactionMessage": "Redirect",
    "redirectUrl": "https://domain/redirect/a6354c630cba488caa56a0113bb0ef34"
}

返回参数

参数
类型
必填

code

Number(3)

M

返回码,详见附录

uniqueId

String(32)

M

系统返回唯一交易 ID

appId

Number(20)

M

APP ID

transactionId

String(128)

M

商户支付唯一 ID

transactionCurrency

String(3)

M

交易币种(CNY/USD)

transactionAmount

String(12)

M

交易金额

transactionCardNumber

String(20)

O

交易卡号,前六后四

billDescription

String(128)

O

账单信息

transactionMessage

String(255)

O

交易错误信息,可能是渠道直接返回的错误信息

redirectUrl

String(255)

O

3D 跳转 URL

transactionAt

String(32)

M

交易时间

message

String(255)

M

普通返回信息

timestamp

Number

M

返回时间戳

isTest

Boolean

M

当前交易是否为测试交易,真实交易返回 false

Last updated