⚙️
API Explorer
  • Overview
  • API Reference
    • 交易
      • Sessiontoken
      • customer
      • Payment methods
      • Confirm charge
      • Checkout payment
      • Local payment
    • 授权交易完成/撤销
      • Authorization
    • 拒付
    • 退款
    • 物流
    • 交易查询
    • 网关绑定支付通道查询
    • 结算明细查询
    • 风控-来源网址查询
  • Webhook
    • 概述
    • 交易事件
    • 预授权事件
    • 退款事件
    • 拒付事件
    • 支付结果跳转
  • 附录
    • 数据签名过程
    • 测试账号信息
    • 常见错误码
    • 常见问题
    • 旧版API文档
Powered by GitBook
On this page
  1. API Reference
  2. 交易

Payment methods

创建支付方式以及客户信息,并作关联操作

PreviouscustomerNextConfirm charge

Last updated 11 months ago

创建支付方式接口请求报文示例

createPaymentMethod.sh
curl --request POST \
  --url https://{paymentApiUrl}/V2022-03/payment_methods \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
  --data '{
    "billingDetail": {
        "address": {
            "city": "NEWARK VALLEY",
            "country": "US",
            "line1": "4348  Calico Drive",
            "postalCode": "13811",
            "state": "NY"
        },
        "email": "indubio@gmail.com",
        "firstName": "Di Mo",
        "lastName": "Shi",
        "phone": "509-675-8948"
    },
    "card": {
        "cardNo": "5333302221254276",
        "cardExpireMonth": "12",
        "cardExpireYear": "2025",
        "cardSecurityCode": "123"
    },
    "customerId": "cus_1526760517237616640"
}'

更新支付方式接口请求报文示例

updatePaymentMethod.sh
curl --request POST \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/update \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \
  --data '{
    "billingDetail": {
        "address": {
            "city": "NEWARK VALLEY",
            "country": "US",
            "line1": "4349  Calico Drive",
            "postalCode": "13811",
            "state": "NY"
        },
        "email": "indubio@gmail.com",
        "firstName": "Di Ma",
        "lastName": "Shi",
        "phone": "509-675-8948"
    },
    "customerPaymentMethodId": "pm_1526760521989763072"
}'

获取支付方式接口请求报文示例

curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/pm_1526760521989763072 \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \

获取支付方式接口请求报文示例

getPaymentMethod
curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/pm_1526760521989763072 \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \

根据客户获取所有支付方式接口请求报文示例

getPaymentMethodListByCustomerId.sh
curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/list/cus_1526760517237616640 \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \

客户附加支付方式接口请求报文示例

curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/pm_1526760521989763072/cus_1526760517237616640/attach \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \

解绑支付方式接口请求报文示例

curl --request GET \
  --url https://{paymentApiUrl}/V2022-03/payment_methods/pm_1526760521989763072/detach \
  --header 'Content-Type: application/json' \
  --header 'request-id: 58675' \
  --header 'request-time: 1651888520935' \
  --header 'gateway-no: 12345001' \
  --header 'sign-info: 787966BF2479A1BE8E1886CD18E6919447FAF4F357E7056188D4F035661B822B' \

以上接口,【根据客户获取所有支付方式】【解绑支付方式】返回结构差异外,其他均返回如下结构(由于数据字段并无差别所以不再展示)

结果对象属性描述

property name
type
description

code

String

返回码

message

String

返回信息

data

Object

数据对象

customerPaymentMethodId

String

支付方式id;

如:pm_1671231231232

card

Object

对象

last4

String

卡后四位

brand

String

卡组织;

如:Visa

billingDetail

Object

对象

email

String

邮箱

firstName

String

firstName

lastName

String

lastName

phone

String

电话

address

Object

对象

city

String

城市

country

String

国家代码,两位字母的ISO国家代码

line1

String

地址1,该地址优先使用

line2

String

地址2

postalCode

String

邮编

state

String

州;两位字母的ISO州代码

获取支付方式接口

get

获取支付方式接口

Path parameters
customerPaymentMethodIdstring(100)Required

卡支付ID,最大长度100,如:pm_1420997693836820480

Header parameters
gateway-nostring(16)Required

网关号

request-idstring(64)Required

请求id,30分钟之内唯一

request-timestring(16)Required

时间戳,以毫秒(ms)为单位,请求误差不能超过10分钟

sign-infostring(255)Required

验签字段,具体加签方式请参阅数据签名过程章节

Responses
200
OK
*/*
get
GET /V2022-03/payment_methods/{customerPaymentMethodId} HTTP/1.1
Host: {paymentapiurl}
gateway-no: null
request-id: null
request-time: null
sign-info: null
Accept: */*
200

OK

{
  "code": "success",
  "message": "message response",
  "data": {
    "billingDetail": {
      "Address": {
        "city": "Maryland",
        "country": "US",
        "line1": "west street",
        "postalCode": "21133",
        "state": "MD"
      },
      "email": "abc@mail.com",
      "firstName": "asia",
      "lastName": "bill",
      "phone": 13212344321
    },
    "card": {
      "brand": 2222,
      "last4": 1111
    },
    "customerPaymentMethodId": "pm_1420997693836820480"
  }
}

根据客户获取所有支付方式接口

get

根据客户获取所有支付方式接口

Path parameters
customerIdstring(100)Required

客户id,最大长度100,如:cus_1420997690607206400

Header parameters
gateway-nostring(16)Required

网关号

request-idstring(64)Required

请求id,30分钟之内唯一

request-timestring(16)Required

时间戳,以毫秒(ms)为单位,请求误差不能超过10分钟

sign-infostring(255)Required

验签字段,具体加签方式请参阅数据签名过程章节

Responses
200
OK
*/*
get
GET /V2022-03/payment_methods/list/{customerId} HTTP/1.1
Host: {paymentapiurl}
gateway-no: null
request-id: null
request-time: null
sign-info: null
Accept: */*
200

OK

{
  "code": "success",
  "message": "message response",
  "data": [
    {
      "billingDetail": {
        "Address": {
          "city": "Maryland",
          "country": "US",
          "line1": "west street",
          "postalCode": "21133",
          "state": "MD"
        },
        "email": "abc@mail.com",
        "firstName": "asia",
        "lastName": "bill",
        "phone": 13212344321
      },
      "card": {
        "brand": 2222,
        "last4": 1111
      },
      "customerPaymentMethodId": "pm_1420997693836820480"
    }
  ]
}

客户附加支付方式接口

get

客户附加支付方式接口

Path parameters
customerIdstring(100)Required

客户id,最大长度100,如:cus_1420997690607206400

customerPaymentMethodIdstring(100)Required

卡支付ID,最大长度100,如:pm_1420997693836820480

Header parameters
gateway-nostring(16)Required

网关号

request-idstring(64)Required

请求id,30分钟之内唯一

request-timestring(16)Required

时间戳,以毫秒(ms)为单位,请求误差不能超过10分钟

sign-infostring(255)Required

验签字段,具体加签方式请参阅数据签名过程章节

Responses
200
OK
*/*
get
GET /V2022-03/payment_methods/{customerPaymentMethodId}/{customerId}/attach HTTP/1.1
Host: {paymentapiurl}
gateway-no: null
request-id: null
request-time: null
sign-info: null
Accept: */*
200

OK

{
  "code": "success",
  "message": "message response",
  "data": {
    "billingDetail": {
      "Address": {
        "city": "Maryland",
        "country": "US",
        "line1": "west street",
        "postalCode": "21133",
        "state": "MD"
      },
      "email": "abc@mail.com",
      "firstName": "asia",
      "lastName": "bill",
      "phone": 13212344321
    },
    "card": {
      "brand": 2222,
      "last4": 1111
    },
    "customerPaymentMethodId": "pm_1420997693836820480"
  }
}

解绑支付方式接口

get

解绑支付方式接口

Path parameters
customerPaymentMethodIdstring(100)Required

卡支付ID,最大长度100,如:pm_1420997693836820480

Header parameters
gateway-nostring(16)Required

网关号

request-idstring(64)Required

请求id,30分钟之内唯一

request-timestring(16)Required

时间戳,以毫秒(ms)为单位,请求误差不能超过10分钟

sign-infostring(255)Required

验签字段,具体加签方式请参阅数据签名过程章节

Responses
200
OK
*/*
get
GET /V2022-03/payment_methods/{customerPaymentMethodId}/detach HTTP/1.1
Host: {paymentapiurl}
gateway-no: null
request-id: null
request-time: null
sign-info: null
Accept: */*
200

OK

{
  "code": "success",
  "message": "message response",
  "data": {
    "billingDetail": {
      "Address": {
        "city": "Maryland",
        "country": "US",
        "line1": "west street",
        "postalCode": "21133",
        "state": "MD"
      },
      "email": "abc@mail.com",
      "firstName": "asia",
      "lastName": "bill",
      "phone": 13212344321
    },
    "card": {
      "brand": 2222,
      "last4": 1111
    },
    "customerPaymentMethodId": "pm_1420997693836820480"
  }
}
  • POST创建支付方式接口
  • 创建支付方式接口请求报文示例
  • POST更新PaymentMethod的信息
  • 更新支付方式接口请求报文示例
  • 获取支付方式接口请求报文示例
  • GET获取支付方式接口
  • 获取支付方式接口请求报文示例
  • GET根据客户获取所有支付方式接口
  • 根据客户获取所有支付方式接口请求报文示例
  • GET客户附加支付方式接口
  • 客户附加支付方式接口请求报文示例
  • GET解绑支付方式接口
  • 解绑支付方式接口请求报文示例

创建支付方式接口

post

创建支付方式接口

Header parameters
gateway-nostring(16)Required

网关号

request-idstring(64)Required

请求id,30分钟之内唯一

request-timestring(16)Required

时间戳,以毫秒(ms)为单位,请求误差不能超过10分钟

sign-infostring(255)Required

验签字段,具体加签方式请参阅数据签名过程章节

Body
customerIdstring(100)Optional

客户ID; 将客户与创建的支付方式进行绑定; 商户可以通过接口/customers发起post创建; 最大长度为100; 如:cus_1420997690607206400

Example: cus_1420997690607206400
Responses
200
OK
*/*
post
POST /V2022-03/payment_methods HTTP/1.1
Host: {paymentapiurl}
gateway-no: null
request-id: null
request-time: null
sign-info: null
Content-Type: application/json
Accept: */*
Content-Length: 331

{
  "billingDetail": {
    "Address": {
      "city": "Maryland",
      "country": "US",
      "line1": "west street",
      "postalCode": "21133",
      "state": "MD"
    },
    "email": "abc@mail.com",
    "firstName": "asia",
    "lastName": "bill",
    "phone": 13212344321
  },
  "card": {
    "cardExpireMonth": null,
    "cardExpireYear": null,
    "cardNo": null,
    "cardSecurityCode": null
  },
  "customerId": "cus_1420997690607206400"
}
200

OK

{
  "code": "success",
  "message": "message response",
  "data": {
    "billingDetail": {
      "Address": {
        "city": "Maryland",
        "country": "US",
        "line1": "west street",
        "postalCode": "21133",
        "state": "MD"
      },
      "email": "abc@mail.com",
      "firstName": "asia",
      "lastName": "bill",
      "phone": 13212344321
    },
    "card": {
      "brand": 2222,
      "last4": 1111
    },
    "customerPaymentMethodId": "pm_1420997693836820480"
  }
}

更新PaymentMethod的信息

post

更新PaymentMethod的信息

Header parameters
gateway-nostring(16)Required

网关号

request-idstring(64)Required

请求id,30分钟之内唯一

request-timestring(16)Required

时间戳,以毫秒(ms)为单位,请求误差不能超过10分钟

sign-infostring(255)Required

验签字段,具体加签方式请参阅数据签名过程章节

Body
customerPaymentMethodIdstring(100)Required

卡支付ID, 商户可以通过接口/payment_methods发起post创建,必填项; 如:pm_1420997693836820480

Example: pm_1420997693836820480
Responses
200
OK
*/*
post
POST /V2022-03/payment_methods/update HTTP/1.1
Host: {paymentapiurl}
gateway-no: null
request-id: null
request-time: null
sign-info: null
Content-Type: application/json
Accept: */*
Content-Length: 343

{
  "billingDetail": {
    "Address": {
      "city": "Maryland",
      "country": "US",
      "line1": "west street",
      "postalCode": "21133",
      "state": "MD"
    },
    "email": "abc@mail.com",
    "firstName": "asia",
    "lastName": "bill",
    "phone": 13212344321
  },
  "card": {
    "cardExpireMonth": null,
    "cardExpireYear": null,
    "cardNo": null,
    "cardSecurityCode": null
  },
  "customerPaymentMethodId": "pm_1420997693836820480"
}
200

OK

{
  "code": "success",
  "message": "message response",
  "data": {
    "billingDetail": {
      "Address": {
        "city": "Maryland",
        "country": "US",
        "line1": "west street",
        "postalCode": "21133",
        "state": "MD"
      },
      "email": "abc@mail.com",
      "firstName": "asia",
      "lastName": "bill",
      "phone": 13212344321
    },
    "card": {
      "brand": 2222,
      "last4": 1111
    },
    "customerPaymentMethodId": "pm_1420997693836820480"
  }
}