Skip to content

在线支付下单

简述

  • 商户在线 Payin 下单接口

请求 URL

  • /pay/merchant/createOrder

请求参数

  • body
参数名必选类型长度说明
merchantIdString32商户编码(平台分配)
merOrderIdString64商户订单号,在商户系统保证唯一
subMerIdString32二级商户号 如存在则上送
orderTypeString32交易类型 固定值:online_payin
paymentTypeString100支付方式,非必填(商户可指定支付方式)可多值,","(英文输入法)隔开。
取值内容:附录-支付方式
orderAmtString12交易金额 两位小数 格式:100.00
orderCurrencyString10交易币种 例如:SAR
expireTimeString4订单有效时间 单位:min 默认 30min
serverNotifyUrlString255服务端支付结果通知地址。商户如果传该字段,以此 URL 为准给商户服务端回调;如果未传该字段,以后端配置的 URL 给商户服务端回调
frontRedirectUrlString255前端支付结果跳转地址
productInfoList<Object>订单商品信息 可以多种商品。对象格式,(Object:productInfo)
customerInfoObject客户信息,对象格式,(Object:customerInfo)
deliveryInfo条件Object物流信息,对象格式,(Object:deliveryInfo)
当 productInfo.productType=physical 必填
orderDescString128订单说明
cashierIsSdkString2收银台接入方式,不传默认为 0
0:统一收银台
1:SDK 方式
  • Object:productInfo
参数名必选类型长度说明
productTypeString32商品类型
virtual:虚拟商品
physical:实体商品
productNameString128商品名称
productSkuString100商品编码
productQuantityString5商品数量
productUnitPriceString12商品单价 如:1.00
productCurrencyString10币种 如:SAR
productDescString128商品描述
productAvatarUrlString255商品图片链接
  • Object:customerInfo
参数名必选类型长度说明
customerUidString40客户在商户的 uid,需要保证每个用户 uid 唯一
customerNameString128客户姓名
customerPlatformString128客户在购买商品的 APP 平台名称
customerPhone条件String18客户手机号
当 productType=physical 必填
customerEmailString64客户邮箱
  • Object:deliveryInfo
参数名必选类型长度说明
firstNameString64收货人:名
lastNameString64收货人:姓
phoneString18收货人手机号
countryString128收货地址:国家
cityString128收货地址:城市
addressString128收货地址:详细地址
zipCodeString10邮编

请求示例

json
{
  "merchantId": "M12345678",
  "merOrderId": "202412131543011234578",
  "subMerId": "",
  "orderType": "online_payin",
  "paymentType": "stcpay,cardpay,applepay",
  "orderAmt": "100.00",
  "orderCurrency": "SAR",
  "expireTime": "30",
  "serverNotifyUrl": "https://xxxxx.com",
  "frontRedirectUrl": "https://xxxxx.com",
  "productInfo": [
    {
      "productType": "physical",
      "productName": "huawei phone",
      "productSku": "12345689",
      "productQuantity": "2",
      "productUnitPrice": "50.00",
      "productCurrency": "SAR",
      "productDesc": "abc",
      "productAvatarUrl": "www.xxxx.com"
    }
  ],
  "customerInfo": {
    "customerUid": "abce_2323_2323",
    "customerName": "Mr balck",
    "customerPlatform": "hongkong sg",
    "customerPhone": "5001999921",
    "customerEmail": "abcdef@163.com"
  },
  "deliveryInfo": {
    "firstName": "alfa",
    "lastName": "zhang",
    "phone": "5001999921",
    "country": "Saudi Arabia",
    "city": "Riyadh",
    "address": "chaoyang road xxxxx",
    "zipCode": "100000"
  },
  "orderMemo": "123457xxxxx",
  "cashierIsSdk": "0"
}

响应参数

  • data
参数名类型说明
merchantIdString商户编码
orderIdString平台交易订单号
merOrderIdString商户订单号,原值返回
subMerIdString二级商户编号
orderTypeString支付类型 online_payin
paymentTypeString支付方式 可多值,"," 隔开。
取值内容: 附录-支付方式
paymentUrlString支付链接 跳转地址
orderStatusString交易状态:
init:初始化
pending:处理中
success:成功
fail:失败
expired:已过期

响应示例

json
{
  "code": 10000,
  "message": "success",
  "data": {
    "merchantId": "M12345678",
    "orderId": "TRD20241213154012000995",
    "merOrderId": "202412131543011234578",
    "subMerId": "",
    "orderType": "online_payin",
    "paymentType": "applepay,stcpay,cardpay",
    "paymentUrl": "https://api-dev.gccpay.cn/en-US/order/TRD20241213154012000995",
    "orderStatus": "init"
  }
}