商户接入指南 商户接入指南
  • V2
  • V3 (opens new window)
  • V2
  • V3 (opens new window)
  • 接入指南

    • 起步
    • 名词约定
    • 对接流程(必读)
    • 签名规约
    • 服务端接入流程
    • 3D集成指南V1(From提交)
    • 3D集成指南V2(风控插件)
  • 接入方案

    • 收银台模式

      • 内嵌JS-SDK
      • 跳转接入
    • 端到端模式

      • 快速开始
        • 接入前提
        • 如何接入
          • 接入风控插件
          • 预下单
          • 请求参数
          • 响应参数
          • 处理响应
        • 预授权
          • 什么是预授权
          • 如何发起预授权交易
        • CAPTURE
          • 什么是CAPTURE
          • 如何发起
        • VOID
          • 什么是VOID
          • 如何发起
        • 快捷支付
          • 什么是快捷支付
          • 如何创建token
          • 查询用户绑定列表
      • 商户收银台规范
    • 交易处理方案

      • 处理交易状态
      • 交易数据处理方案
      • 交易状态处理方案
      • 自动续费场景处理方案
    • 开源建站工具插件支持

      • Magento235
      • Woocommerce
      • OpenCart
      • Prestashop
      • ZenCart
  • APIs

    • 交易下单

      • 收银台模式
      • 端到端模式
      • 退款和预授权
      • 修改交易信息
    • 交易查询

    • 快捷支付

    • 拒付查询

    • 物流信息

    • 交易账单

    • 币种汇率

    • 商户信息

  • 附录

  • v2

端到端模式

# 快速开始

商户与 pingpong checkout 完全通过API来进行交互,商户需自行开发收银台页面,保存、处理用户的信用卡信息。

注意 : 在交易进行中,为了更好地帮助商户提前规避风险,若PingPongPay 风控系统识别出订单风险存疑,会在客户端展示交易状态为“status=REVIEW”,PingPongPay将会对订单进行人工审核,商户可以对订单审核结果提出建议。

# 接入前提

  1. 商户具备PCI资质,并通过PingPongPay验证。

  2. 商户具有自行开发收银台的能力。

注意 : 该方案要求商户服务器自行保存、处理用户的信用卡信息,因此强制要求商户具备PCI资质。

# 如何接入

# 接入风控插件

当用户成输入卡号完之后,风控插件将会调用PingPongPayServer API发送卡号数据进行验证, 因此每次卡号改变必须调用get3DParams。

# 引入风控插件

####标签引入

 <script src="https://pay-cdn.pingpongx.com/production-fra/static-fra/sdk/ppAcquirerRisk.min-2.0.0.js"></script>
1

# 在Vue中使用

  1. 封装一个组件 remote-js
export default {
    components: {
        'remote-js': {
            render(createElement) {
                return createElement('script', {attrs: {type: 'text/javascript', src: this.src}});
            },
            props: {
                src: {type: String, required: true},
            },
        },
    },
}
1
2
3
4
5
6
7
8
9
10
11
12
  1. 通过组件引入
<remote-js src="https://pay-cdn.pingpongx.com/production-fra/static-fra/sdk/ppAcquirerRisk.min-2.0.0.js"></remote-js>
1

# 初始化

let options = {
    env: 'test', // 开发环境:dev;测试环境:test;生产环境:prod 
    accId: accId,
    clientId: clientId || '',//  clientId 
    elId: '#input', // 卡号输入框的 dom id
    merchantTransactionId: merchantTransactionId //填入网站订单流水号
}

let pp = new PPAcquirerRisk(options);

pp.install()
1
2
3
4
5
6
7
8
9
10
11

# 生成 jsGeneratedData




注意 : 每次订单号生成或改变时候必须重新初始化,卡号每次改变都必须重新调用get3DParams!!!



当持卡人输入卡号后 RiskJS 会自动执行 3DS 初始化操作,商户需要在用户正确输入卡号 且 RiskJS 执行之后 ,调用 JS 接口获取风控设备指纹参数,该参数将作为支付接口的 jsGeneratedData 参数值


 var threeDParams = pp.get3DParams(); // 函数返回值 3DParams 作为下一步支付 接口的 jsGeneratedData 的值
1

# 3DS 验证处理

商户在调用网关支付 Server to Server 支付接口后,根据响应的交易状态与 3D Secure 处 理标识判断是否需要 3DS 验证处理,支付状态 status 为 PROCESSING 或 PENDING 时,表示交易处理中,如果返回参数 threeDContinue 为 true 表示需要持卡人进行 3DS 验证,那么商户前端需要执行 JS 提供的 payment3DValidate 函数,将接口返回 的 threeDUnionParams 作为入参调用 payment3DValidate 函数,JS 插件会进行 3D Secure 验证页面的跳转或加载操作,3D Secure 验证页面打开后,持卡人可进行 3D 验 证,完成支付过程

/*
pp.payment3DValidate 方法聚合了所有 3D 流程的处理,应在正常支付流
程之前执行
@paramsthreeDUnionParams必传 s2s支付接口/v2/payment返回的
threeDUnionParams 字段
@params callback 回调函数 可不传,商户可在此处理正常支付流程。若
该笔交易进入 3D 流程,则该回调不会执行,否则执行该回调函数,处理正常支付逻辑
*/
pp.payment3DValidate(threeDUnionParams, callback)
1
2
3
4
5
6
7
8
9

# 预下单

# 请求地址

https://{host}/v2/payment
1

# 请求参数


参数必填属性说明:必填(M),可选(O),条件必填(C)。



# 请求示例

      POST /v2/payment HTTP/1.1
    Host: {host}
    Content-Type: application/json
    Content-Length: 6136
    
    {
    	"accId": "t_accid",
    	"amount": "t_amount",
    	"createToken": "N",
    	"default": "N",
    	"merchantUserId": "12604896051315",
    	"currency": "t_currency",
    	"interactiveMode": "S2S",
    	"language": "en",
    	"merchantTransactionId": "t_merchantno",
    	"paymentType": "SALE",
    	"notificationUrl": "https://test-pay.pingpongx.com/qa/notify",
    	"shopperResultUrl": "https://test-pay.pingpongx.com/qa/result.html",
    	"threeDSecure": "N",
    	"remark": "merchantId=999",
    	"signType": "MD5",
    	"jsGeneratedData": {
    		"fingerprintId": "2018092714313010016549_PP20210608151727OB",
    		"forterSiteId": "e088dda90c4e",
    		"forterTokenCookie": "c3402ed6f84d4c50add3458a1ce51d60_1623137756842_87_UDF43_11ck",
    		"orderTerminal": "03",
    		"threeDSServerTransID": "5aefe125-226e-4360-b262-43eb71da19d1"
    	},
    	"paymentBrand": "VISA",
    	"payMethodInfo": {
    		"card": {
    			"cvv": "103",
    			"expireMonth": "10",
    			"expireYear": "2025",
    			"holderFirstName": "James",
    			"holderLastName": "LeBron",
    			"identificationId": "331081199112012361",
    			"identificationType": "ID",
    			"number": "4200000000000000"
    		}
    	},
    	"riskInfo": {
    		"airline": {
    			"adultsNumber": "1",
    			"aircraftCabinType": "FIRST CLASS",
    			"airlineCompanyID": "CA006",
    			"airlinePnr": "{dhsalh}",
    			"arrivalCity": "Adm",
    			"arrivalCountry": "DK",
    			"arrivalTime": "201912012010",
    			"arrivalTimezone": "UTC+8",
    			"babyNumber": "0",
    			"bestFare": "Y",
    			"bookChannel": "Y",
    			"changedTakeoffTime": "",
    			"childrenNumber": "0",
    			"connectingCity": "",
    			"connectionTicket": "N",
    			"contactEmail": "t_email",
    			"contactName": "James LeBron",
    			"contactPhone": "18301770495",
    			"flightNumber": "CA006122",
    			"freeChange": "Y",
    			"frequentFlyerNumber": "CA00612254651B",
    			"haveChanged": "N",
    			"hotel": {
    				"bookNumber": "1",
    				"bookRange": "2",
    				"checkInDate": "201912010020",
    				"city": "Adm",
    				"country": "DK",
    				"customerName": "James LeBron",
    				"name": "AdmHotel",
    				"refundPolicy": "FREE CANCELLATION",
    				"star": "5"
    			},
    			"ifConnectingFlight": "N",
    			"ifRoundtripFlight": "Y",
    			"insurance": "Y",
    			"leaveRange": "Y",
    			"passengers": [
    				{
    					"birthday": "1991120",
    					"firstName": "James",
    					"identificationId": "331081199112012361",
    					"identificationType": "ID",
    					"lastName": "LeBron",
    					"nationality": "US",
    					"phone": "18301770495"
    				},
    				{
    					"birthday": "19890112",
    					"firstName": "Dwyane",
    					"identificationId": "331081198901120012",
    					"identificationType": "ID",
    					"lastName": "Wade",
    					"nationality": "JP",
    					"phone": "13712459512"
    				}
    			],
    			"productType": "TICKET",
    			"routeType": "SINGLE",
    			"takeoffCity": "Birmingham",
    			"takeoffCountry": "US",
    			"takeoffTime": "201912012010",
    			"takeoffTimezone": "UTC+8",
    			"thirdPartyBook": "N",
    			"tripType": "SINGLE",
    			"valueAdded": "N"
    		},
    		"billing": {
    			"city": "Birmingham",
    			"country": "US",
    			"email": "t_email",
    			"firstName": "James",
    			"lastName": "LeBron",
    			"phone": "18301770495",
    			"postcode": "35222",
    			"state": "AL",
    			"street": "1986 Broad Street"
    		},
    		"browserInfo": {
    			"acceptHeader": "content-type=application/x-www-form-urlencoded;accept=*/*;cache-control=no-cache;postman-token=cf489264-5378-4d5d-a86c-72c86a408c03;accept-encoding=gzip, deflate;content-length=588;connection=keep-alive;",
    			"colorDepth": "32",
    			"jetLag": "480",
    			"screenHeight": "1980",
    			"screenWidth": "1080",
    			"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
    			"windowSize": "05"
    		},
    		"carRental": {
    			"childrenNumber": "1",
    			"discountAmount": "120",
    			"discountType": "15%",
    			"email": "t_email",
    			"firstName": "James",
    			"identificationId": "331081199112012361",
    			"identificationType": "ID",
    			"insuranceLimit": "8000",
    			"insuranceType": "RS",
    			"lastName": "Lebron",
    			"model": "SUV",
    			"nationality": "US",
    			"personNumber": "3",
    			"phone": "18301770495",
    			"purchasedInsurance": "Y",
    			"rentCity": "Birmingham",
    			"rentCountry": "US",
    			"rentTime": "201912200320",
    			"rentalCompany": "US",
    			"returnCity": "Birmingham",
    			"returnCountry": "US",
    			"returnTime": "201201200320"
    		},
    		"customer": {
    			"acquisitionChannel": "SEARCH_ENGINE",
    			"customerId": "20191201001",
    			"domain": "pingpongx.com",
    			"email": "t_email",
    			"firstName": "James",
    			"firstOrder": "N",
    			"identificationId": "331081199112012361",
    			"identificationType": "ID",
    			"lastName": "LeBron",
    			"lastPayTime": "201905120330",
    			"loginIp": "222.126.52.24",
    			"loginTime": "201912010032",
    			"middleName": "von",
    			"nonMemberOrder": "N",
    			"orderCountry": "US",
    			"orderIp": "222.126.52.23",
    			"orderTime": "20191201001",
    			"payCountry": "US",
    			"payIp": "222.126.52.25",
    			"phone": "18301770495",
    			"preferentialOrder": "Y",
    			"registerCountry": "US",
    			"registerIp": "222.126.52.26",
    			"registerRange": "3",
    			"registerTerminal": "PC",
    			"registerTime": "20191201122000",
    			"registerUserEmail": "t_email"
    		},
    		"device": {
    			"fingerprintId": "sad",
    			"orderTerminal": "01"
    		},
    		"eCommerce": {
    			"freeShipping": "N",
    			"shippingMethod": "SEA"
    		},
    		"goods": [
    			{
    				"averageUnitPrice": "18.64",
    				"description": "Colorful macaron",
    				"name": "Macaron",
    				"number": "1",
    				"sku": "20191201331",
    				"virtualProduct": "N"
    			},
    			{
    				"averageUnitPrice": "996.14",
    				"description": "Naruto Shikamaru 107CM",
    				"name": "Clay",
    				"number": "1",
    				"sku": "20191201223",
    				"virtualProduct": "N"
    			}
    		],
    		"reCharge": {
    			"accountId": "775330",
    			"accountName": "von",
    			"gameCategory": "OTHERS",
    			"gameName": "Over Watched",
    			"gameTerminal": "PC",
    			"platformCategory": "N",
    			"serverCountry": "US",
    			"type": "GAME RECHARGE"
    		},
    		"shipping": {
    			"city": "Miami",
    			"country": "US",
    			"email": "t_email",
    			"firstName": "Jamesbb",
    			"lastName": "LeBronbb",
    			"phone": "305-578-7342",
    			"postcode": "33131",
    			"state": "FL",
    			"street": "701 Brickell Avenue, Suite 2700",
    			"lastModifierStreetTime": "20191225162010",
    			"lastModifierPhoneTime": "20191225162010"
    		}
    	}
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    <?php
    
    $curl = curl_init();
    
    curl_setopt_array($curl, array(
    CURLOPT_URL => 'https://%7Bhost%7D/v2/payment',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>'{
      "accId": "t_accid",
      "amount": "t_amount",
      "createToken": "N",
      "default": "N",
      "merchantUserId": "12604896051315",
      "currency": "t_currency",
      "interactiveMode": "S2S",
      "language": "en",
      "merchantTransactionId": "t_merchantno",
      "paymentType": "SALE",
      "notificationUrl": "https://test-pay.pingpongx.com/qa/notify",
      "shopperResultUrl": "https://test-pay.pingpongx.com/qa/result.html",
      "threeDSecure": "N",
      "remark": "merchantId=999",
      "signType": "MD5",
      "jsGeneratedData": {
      	"fingerprintId": "2018092714313010016549_PP20210608151727OB",
      	"forterSiteId": "e088dda90c4e",
      	"forterTokenCookie": "c3402ed6f84d4c50add3458a1ce51d60_1623137756842_87_UDF43_11ck",
      	"orderTerminal": "03",
      	"threeDSServerTransID": "5aefe125-226e-4360-b262-43eb71da19d1"
      },
      "paymentBrand": "VISA",
      "payMethodInfo": {
      	"card": {
      		"cvv": "103",
      		"expireMonth": "10",
      		"expireYear": "2025",
      		"holderFirstName": "James",
      		"holderLastName": "LeBron",
      		"identificationId": "331081199112012361",
      		"identificationType": "ID",
      		"number": "4200000000000000"
      	}
      },
      "riskInfo": {
      	"airline": {
      		"adultsNumber": "1",
      		"aircraftCabinType": "FIRST CLASS",
      		"airlineCompanyID": "CA006",
      		"airlinePnr": "{dhsalh}",
      		"arrivalCity": "Adm",
      		"arrivalCountry": "DK",
      		"arrivalTime": "201912012010",
      		"arrivalTimezone": "UTC+8",
      		"babyNumber": "0",
      		"bestFare": "Y",
      		"bookChannel": "Y",
      		"changedTakeoffTime": "",
      		"childrenNumber": "0",
      		"connectingCity": "",
      		"connectionTicket": "N",
      		"contactEmail": "t_email",
      		"contactName": "James LeBron",
      		"contactPhone": "18301770495",
      		"flightNumber": "CA006122",
      		"freeChange": "Y",
      		"frequentFlyerNumber": "CA00612254651B",
      		"haveChanged": "N",
      		"hotel": {
      			"bookNumber": "1",
      			"bookRange": "2",
      			"checkInDate": "201912010020",
      			"city": "Adm",
      			"country": "DK",
      			"customerName": "James LeBron",
      			"name": "AdmHotel",
      			"refundPolicy": "FREE CANCELLATION",
      			"star": "5"
      		},
      		"ifConnectingFlight": "N",
      		"ifRoundtripFlight": "Y",
      		"insurance": "Y",
      		"leaveRange": "Y",
      		"passengers": [
      			{
      				"birthday": "1991120",
      				"firstName": "James",
      				"identificationId": "331081199112012361",
      				"identificationType": "ID",
      				"lastName": "LeBron",
      				"nationality": "US",
      				"phone": "18301770495"
      			},
      			{
      				"birthday": "19890112",
      				"firstName": "Dwyane",
      				"identificationId": "331081198901120012",
      				"identificationType": "ID",
      				"lastName": "Wade",
      				"nationality": "JP",
      				"phone": "13712459512"
      			}
      		],
      		"productType": "TICKET",
      		"routeType": "SINGLE",
      		"takeoffCity": "Birmingham",
      		"takeoffCountry": "US",
      		"takeoffTime": "201912012010",
      		"takeoffTimezone": "UTC+8",
      		"thirdPartyBook": "N",
      		"tripType": "SINGLE",
      		"valueAdded": "N"
      	},
      	"billing": {
      		"city": "Birmingham",
      		"country": "US",
      		"email": "t_email",
      		"firstName": "James",
      		"lastName": "LeBron",
      		"phone": "18301770495",
      		"postcode": "35222",
      		"state": "AL",
      		"street": "1986 Broad Street"
      	},
      	"browserInfo": {
      		"acceptHeader": "content-type=application/x-www-form-urlencoded;accept=*/*;cache-control=no-cache;postman-token=cf489264-5378-4d5d-a86c-72c86a408c03;accept-encoding=gzip, deflate;content-length=588;connection=keep-alive;",
      		"colorDepth": "32",
      		"jetLag": "480",
      		"screenHeight": "1980",
      		"screenWidth": "1080",
      		"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36",
      		"windowSize": "05"
      	},
      	"carRental": {
      		"childrenNumber": "1",
      		"discountAmount": "120",
      		"discountType": "15%",
      		"email": "t_email",
      		"firstName": "James",
      		"identificationId": "331081199112012361",
      		"identificationType": "ID",
      		"insuranceLimit": "8000",
      		"insuranceType": "RS",
      		"lastName": "Lebron",
      		"model": "SUV",
      		"nationality": "US",
      		"personNumber": "3",
      		"phone": "18301770495",
      		"purchasedInsurance": "Y",
      		"rentCity": "Birmingham",
      		"rentCountry": "US",
      		"rentTime": "201912200320",
      		"rentalCompany": "US",
      		"returnCity": "Birmingham",
      		"returnCountry": "US",
      		"returnTime": "201201200320"
      	},
      	"customer": {
      		"acquisitionChannel": "SEARCH_ENGINE",
      		"customerId": "20191201001",
      		"domain": "pingpongx.com",
      		"email": "t_email",
      		"firstName": "James",
      		"firstOrder": "N",
      		"identificationId": "331081199112012361",
      		"identificationType": "ID",
      		"lastName": "LeBron",
      		"lastPayTime": "201905120330",
      		"loginIp": "222.126.52.24",
      		"loginTime": "201912010032",
      		"middleName": "von",
      		"nonMemberOrder": "N",
      		"orderCountry": "US",
      		"orderIp": "222.126.52.23",
      		"orderTime": "20191201001",
      		"payCountry": "US",
      		"payIp": "222.126.52.25",
      		"phone": "18301770495",
      		"preferentialOrder": "Y",
      		"registerCountry": "US",
      		"registerIp": "222.126.52.26",
      		"registerRange": "3",
      		"registerTerminal": "PC",
      		"registerTime": "20191201122000",
      		"registerUserEmail": "t_email"
      	},
      	"device": {
      		"fingerprintId": "sad",
      		"orderTerminal": "01"
      	},
      	"eCommerce": {
      		"freeShipping": "N",
      		"shippingMethod": "SEA"
      	},
      	"goods": [
      		{
      			"averageUnitPrice": "18.64",
      			"description": "Colorful macaron",
      			"name": "Macaron",
      			"number": "1",
      			"sku": "20191201331",
      			"virtualProduct": "N"
      		},
      		{
      			"averageUnitPrice": "996.14",
      			"description": "Naruto Shikamaru 107CM",
      			"name": "Clay",
      			"number": "1",
      			"sku": "20191201223",
      			"virtualProduct": "N"
      		}
      	],
      	"reCharge": {
      		"accountId": "775330",
      		"accountName": "von",
      		"gameCategory": "OTHERS",
      		"gameName": "Over Watched",
      		"gameTerminal": "PC",
      		"platformCategory": "N",
      		"serverCountry": "US",
      		"type": "GAME RECHARGE"
      	},
      	"shipping": {
      		"city": "Miami",
      		"country": "US",
      		"email": "t_email",
      		"firstName": "Jamesbb",
      		"lastName": "LeBronbb",
      		"phone": "305-578-7342",
      		"postcode": "33131",
      		"state": "FL",
      		"street": "701 Brickell Avenue, Suite 2700",
      		"lastModifierStreetTime": "20191225162010",
      		"lastModifierPhoneTime": "20191225162010"
      	}
      }
    }',
    CURLOPT_HTTPHEADER => array(
      'Content-Type: application/json'
    ),
    ));
    
    $response = curl_exec($curl);
    
    curl_close($curl);
    echo $response;
    
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
    MediaType mediaType = MediaType.parse("application/json");
    RequestBody body = RequestBody.create(mediaType, "{\n\t\"accId\": \"t_accid\",\n\t\"amount\": \"t_amount\",\n\t\"createToken\": \"N\",\n\t\"default\": \"N\",\n\t\"merchantUserId\": \"12604896051315\",\n\t\"currency\": \"t_currency\",\n\t\"interactiveMode\": \"S2S\",\n\t\"language\": \"en\",\n\t\"merchantTransactionId\": \"t_merchantno\",\n\t\"paymentType\": \"SALE\",\n\t\"notificationUrl\": \"https://test-pay.pingpongx.com/qa/notify\",\n\t\"shopperResultUrl\": \"https://test-pay.pingpongx.com/qa/result.html\",\n\t\"threeDSecure\": \"N\",\n\t\"remark\": \"merchantId=999\",\n\t\"signType\": \"MD5\",\n\t\"jsGeneratedData\": {\n\t\t\"fingerprintId\": \"2018092714313010016549_PP20210608151727OB\",\n\t\t\"forterSiteId\": \"e088dda90c4e\",\n\t\t\"forterTokenCookie\": \"c3402ed6f84d4c50add3458a1ce51d60_1623137756842_87_UDF43_11ck\",\n\t\t\"orderTerminal\": \"03\",\n\t\t\"threeDSServerTransID\": \"5aefe125-226e-4360-b262-43eb71da19d1\"\n\t},\n\t\"paymentBrand\": \"VISA\",\n\t\"payMethodInfo\": {\n\t\t\"card\": {\n\t\t\t\"cvv\": \"103\",\n\t\t\t\"expireMonth\": \"10\",\n\t\t\t\"expireYear\": \"2025\",\n\t\t\t\"holderFirstName\": \"James\",\n\t\t\t\"holderLastName\": \"LeBron\",\n\t\t\t\"identificationId\": \"331081199112012361\",\n\t\t\t\"identificationType\": \"ID\",\n\t\t\t\"number\": \"4200000000000000\"\n\t\t}\n\t},\n\t\"riskInfo\": {\n\t\t\"airline\": {\n\t\t\t\"adultsNumber\": \"1\",\n\t\t\t\"aircraftCabinType\": \"FIRST CLASS\",\n\t\t\t\"airlineCompanyID\": \"CA006\",\n\t\t\t\"airlinePnr\": \"{dhsalh}\",\n\t\t\t\"arrivalCity\": \"Adm\",\n\t\t\t\"arrivalCountry\": \"DK\",\n\t\t\t\"arrivalTime\": \"201912012010\",\n\t\t\t\"arrivalTimezone\": \"UTC+8\",\n\t\t\t\"babyNumber\": \"0\",\n\t\t\t\"bestFare\": \"Y\",\n\t\t\t\"bookChannel\": \"Y\",\n\t\t\t\"changedTakeoffTime\": \"\",\n\t\t\t\"childrenNumber\": \"0\",\n\t\t\t\"connectingCity\": \"\",\n\t\t\t\"connectionTicket\": \"N\",\n\t\t\t\"contactEmail\": \"t_email\",\n\t\t\t\"contactName\": \"James LeBron\",\n\t\t\t\"contactPhone\": \"18301770495\",\n\t\t\t\"flightNumber\": \"CA006122\",\n\t\t\t\"freeChange\": \"Y\",\n\t\t\t\"frequentFlyerNumber\": \"CA00612254651B\",\n\t\t\t\"haveChanged\": \"N\",\n\t\t\t\"hotel\": {\n\t\t\t\t\"bookNumber\": \"1\",\n\t\t\t\t\"bookRange\": \"2\",\n\t\t\t\t\"checkInDate\": \"201912010020\",\n\t\t\t\t\"city\": \"Adm\",\n\t\t\t\t\"country\": \"DK\",\n\t\t\t\t\"customerName\": \"James LeBron\",\n\t\t\t\t\"name\": \"AdmHotel\",\n\t\t\t\t\"refundPolicy\": \"FREE CANCELLATION\",\n\t\t\t\t\"star\": \"5\"\n\t\t\t},\n\t\t\t\"ifConnectingFlight\": \"N\",\n\t\t\t\"ifRoundtripFlight\": \"Y\",\n\t\t\t\"insurance\": \"Y\",\n\t\t\t\"leaveRange\": \"Y\",\n\t\t\t\"passengers\": [\n\t\t\t\t{\n\t\t\t\t\t\"birthday\": \"1991120\",\n\t\t\t\t\t\"firstName\": \"James\",\n\t\t\t\t\t\"identificationId\": \"331081199112012361\",\n\t\t\t\t\t\"identificationType\": \"ID\",\n\t\t\t\t\t\"lastName\": \"LeBron\",\n\t\t\t\t\t\"nationality\": \"US\",\n\t\t\t\t\t\"phone\": \"18301770495\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"birthday\": \"19890112\",\n\t\t\t\t\t\"firstName\": \"Dwyane\",\n\t\t\t\t\t\"identificationId\": \"331081198901120012\",\n\t\t\t\t\t\"identificationType\": \"ID\",\n\t\t\t\t\t\"lastName\": \"Wade\",\n\t\t\t\t\t\"nationality\": \"JP\",\n\t\t\t\t\t\"phone\": \"13712459512\"\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"productType\": \"TICKET\",\n\t\t\t\"routeType\": \"SINGLE\",\n\t\t\t\"takeoffCity\": \"Birmingham\",\n\t\t\t\"takeoffCountry\": \"US\",\n\t\t\t\"takeoffTime\": \"201912012010\",\n\t\t\t\"takeoffTimezone\": \"UTC+8\",\n\t\t\t\"thirdPartyBook\": \"N\",\n\t\t\t\"tripType\": \"SINGLE\",\n\t\t\t\"valueAdded\": \"N\"\n\t\t},\n\t\t\"billing\": {\n\t\t\t\"city\": \"Birmingham\",\n\t\t\t\"country\": \"US\",\n\t\t\t\"email\": \"t_email\",\n\t\t\t\"firstName\": \"James\",\n\t\t\t\"lastName\": \"LeBron\",\n\t\t\t\"phone\": \"18301770495\",\n\t\t\t\"postcode\": \"35222\",\n\t\t\t\"state\": \"AL\",\n\t\t\t\"street\": \"1986 Broad Street\"\n\t\t},\n\t\t\"browserInfo\": {\n\t\t\t\"acceptHeader\": \"content-type=application/x-www-form-urlencoded;accept=*/*;cache-control=no-cache;postman-token=cf489264-5378-4d5d-a86c-72c86a408c03;accept-encoding=gzip, deflate;content-length=588;connection=keep-alive;\",\n\t\t\t\"colorDepth\": \"32\",\n\t\t\t\"jetLag\": \"480\",\n\t\t\t\"screenHeight\": \"1980\",\n\t\t\t\"screenWidth\": \"1080\",\n\t\t\t\"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36\",\n\t\t\t\"windowSize\": \"05\"\n\t\t},\n\t\t\"carRental\": {\n\t\t\t\"childrenNumber\": \"1\",\n\t\t\t\"discountAmount\": \"120\",\n\t\t\t\"discountType\": \"15%\",\n\t\t\t\"email\": \"t_email\",\n\t\t\t\"firstName\": \"James\",\n\t\t\t\"identificationId\": \"331081199112012361\",\n\t\t\t\"identificationType\": \"ID\",\n\t\t\t\"insuranceLimit\": \"8000\",\n\t\t\t\"insuranceType\": \"RS\",\n\t\t\t\"lastName\": \"Lebron\",\n\t\t\t\"model\": \"SUV\",\n\t\t\t\"nationality\": \"US\",\n\t\t\t\"personNumber\": \"3\",\n\t\t\t\"phone\": \"18301770495\",\n\t\t\t\"purchasedInsurance\": \"Y\",\n\t\t\t\"rentCity\": \"Birmingham\",\n\t\t\t\"rentCountry\": \"US\",\n\t\t\t\"rentTime\": \"201912200320\",\n\t\t\t\"rentalCompany\": \"US\",\n\t\t\t\"returnCity\": \"Birmingham\",\n\t\t\t\"returnCountry\": \"US\",\n\t\t\t\"returnTime\": \"201201200320\"\n\t\t},\n\t\t\"customer\": {\n\t\t\t\"acquisitionChannel\": \"SEARCH_ENGINE\",\n\t\t\t\"customerId\": \"20191201001\",\n\t\t\t\"domain\": \"pingpongx.com\",\n\t\t\t\"email\": \"t_email\",\n\t\t\t\"firstName\": \"James\",\n\t\t\t\"firstOrder\": \"N\",\n\t\t\t\"identificationId\": \"331081199112012361\",\n\t\t\t\"identificationType\": \"ID\",\n\t\t\t\"lastName\": \"LeBron\",\n\t\t\t\"lastPayTime\": \"201905120330\",\n\t\t\t\"loginIp\": \"222.126.52.24\",\n\t\t\t\"loginTime\": \"201912010032\",\n\t\t\t\"middleName\": \"von\",\n\t\t\t\"nonMemberOrder\": \"N\",\n\t\t\t\"orderCountry\": \"US\",\n\t\t\t\"orderIp\": \"222.126.52.23\",\n\t\t\t\"orderTime\": \"20191201001\",\n\t\t\t\"payCountry\": \"US\",\n\t\t\t\"payIp\": \"222.126.52.25\",\n\t\t\t\"phone\": \"18301770495\",\n\t\t\t\"preferentialOrder\": \"Y\",\n\t\t\t\"registerCountry\": \"US\",\n\t\t\t\"registerIp\": \"222.126.52.26\",\n\t\t\t\"registerRange\": \"3\",\n\t\t\t\"registerTerminal\": \"PC\",\n\t\t\t\"registerTime\": \"20191201122000\",\n\t\t\t\"registerUserEmail\": \"t_email\"\n\t\t},\n\t\t\"device\": {\n\t\t\t\"fingerprintId\": \"sad\",\n\t\t\t\"orderTerminal\": \"01\"\n\t\t},\n\t\t\"eCommerce\": {\n\t\t\t\"freeShipping\": \"N\",\n\t\t\t\"shippingMethod\": \"SEA\"\n\t\t},\n\t\t\"goods\": [\n\t\t\t{\n\t\t\t\t\"averageUnitPrice\": \"18.64\",\n\t\t\t\t\"description\": \"Colorful macaron\",\n\t\t\t\t\"name\": \"Macaron\",\n\t\t\t\t\"number\": \"1\",\n\t\t\t\t\"sku\": \"20191201331\",\n\t\t\t\t\"virtualProduct\": \"N\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"averageUnitPrice\": \"996.14\",\n\t\t\t\t\"description\": \"Naruto Shikamaru 107CM\",\n\t\t\t\t\"name\": \"Clay\",\n\t\t\t\t\"number\": \"1\",\n\t\t\t\t\"sku\": \"20191201223\",\n\t\t\t\t\"virtualProduct\": \"N\"\n\t\t\t}\n\t\t],\n\t\t\"reCharge\": {\n\t\t\t\"accountId\": \"775330\",\n\t\t\t\"accountName\": \"von\",\n\t\t\t\"gameCategory\": \"OTHERS\",\n\t\t\t\"gameName\": \"Over Watched\",\n\t\t\t\"gameTerminal\": \"PC\",\n\t\t\t\"platformCategory\": \"N\",\n\t\t\t\"serverCountry\": \"US\",\n\t\t\t\"type\": \"GAME RECHARGE\"\n\t\t},\n\t\t\"shipping\": {\n\t\t\t\"city\": \"Miami\",\n\t\t\t\"country\": \"US\",\n\t\t\t\"email\": \"t_email\",\n\t\t\t\"firstName\": \"Jamesbb\",\n\t\t\t\"lastName\": \"LeBronbb\",\n\t\t\t\"phone\": \"305-578-7342\",\n\t\t\t\"postcode\": \"33131\",\n\t\t\t\"state\": \"FL\",\n\t\t\t\"street\": \"701 Brickell Avenue, Suite 2700\",\n\t\t\t\"lastModifierStreetTime\": \"20191225162010\",\n\t\t\t\"lastModifierPhoneTime\": \"20191225162010\"\n\t\t}\n\t}\n}");
    Request request = new Request.Builder()
    .url("https://{host}/v2/payment")
    .method("POST", body)
    .addHeader("Content-Type", "application/json")
    .build();
    Response response = client.newCall(request).execute();
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    // Make sure to add code blocks to your code group

    # 响应参数

    参数字段 参数属性 参数说明
    clientId M PingPong 商户商户号
    accId M PingPong 商户店铺编号
    transactionId M PingPong 交易流水号
    merchantTransactionId M 商户网站的的交易流水号
    code M 结果状态码
    description M 结果描述
    paymentType M 交易类型: SALE-直接付款 AUTH-预授权
    currency M 交易币种
    amount M 交易金额
    transactionTime M 交易发起时间,yyyyMMddHHmmss
    completeTime O 交易处理完成时间,yyyyMMddHHmmss
    status M SUCCESS-成功 FAILED-失败 PROCESSING-进行中 REVIEW-待审核
    signType M 签名规约,支持 MD5、SHA256,具体⻅本文“签名规约” 一栏
    sign M 签名内容,具体⻅本文“签名规约”一栏
    remark C 商户扩展字段
    threeDSecure C 3DS 交易标示 Y/N
    acsUrl C 发卡行 3DS 验证⻚面 URL,3DS 交易场景下特有,由 于 3DS 交易的时效性,只在同步响应中返回
    paReq C 3DS 验证参数,3DS 交易场景下特有,由于 3DS 交易 的时效性,只在同步响应中返回
    termUrl C 3DS 验证后重定向的目标 URL,3DS 交易场景下特 有,由于 3DS 交易的时效性,只在同步响应中返回
    requestMethod C 请求发卡行 3DS 验证⻚面的请求方式,POST 或 GET, 默认为 POST
    md C 自定义参数,3DS 交易场景下特有,由于 3DS 交易的 时效性,只在同步响应中返回
    connector C 连接器类型,3DS 交易场景下特有,由于 3DS 交易的 时效性,只在同步响应中返回
    threedDHighLevelPara C 3DS 验证参数集合,3DS 交易场景下特有,该参数集 ms 封装 3DS 验证所需的参;当需要验证时,参数名作为form 表单的参数名,参数值作为 form 表单的参数值
    threeDContinue C 是否需要 3DS 验证处理, true:是, false:否 (使用⻛控插件对接的商户使用)
    threeDUnionParams C 3DS 验证参数集合,当交易需要 3DS 验证处理的时 候,将该参数的返回值传入 PingPong 提供的插件 js指定的函数中(使用⻛控插件对接的商户使用)

    # 响应示例

    {
    	"accId": "2018092714313010016291",
    	"amount": "1.08",
    	"clientId": "2018092714313010016",
    	"code": "002000",
    	"currency": "USD",
    	"description": "Transaction processing",
    	"language": "en",
    	"merchantTransactionId": "PShop20211217111845UX",
    	"paymentType": "SALE",
    	"relateTransactionId": "PS21121711231072775",
    	"shopperResultUrl": "https://test-pay.pingpongx.com/qa/result.html",
    	"sign": "C0E42CFCE9614079288A8CB49E094100",
    	"signType": "MD5",
    	"status": "PROCESSING",
    	"transactionId": "PS21121711231072775",
    	"transactionTime": "1639711392000"
    }
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

    # 异步响应

    参数字段 参数属性 参数说明
    clientId M PingPong 商户商户号
    accId M PingPong 商户店铺编号
    transactionId M PingPong 交易流水号
    merchantTransactionId M 商户网站的的交易流水号
    code M 结果状态码
    description M 结果描述
    paymentType M 交易类型: SALE-直接付款 AUTH-预授权
    currency M 交易币种
    amount M 交易金额
    transactionTime M 交易发起时间,yyyyMMddHHmmss
    completeTime O 交易处理完成时间,yyyyMMddHHmmss
    status M SUCCESS-成功 FAILED-失败 PROCESSING-进行中 REVIEW-待审核
    signType M 签名规约,支持 MD5、SHA256,具体⻅本文“签名规约” 一栏
    sign M 签名内容,具体⻅本文“签名规约”一栏
    remark C 商户扩展字段
    threeDSecure C 3DS 交易标示 Y/N

    # 处理响应

    请求交易接口之后,pingpong checkout 根据请求参数响应结果,商户应根据响应处理交易。 处理结果可能是中间态,需要接入异步通知处理交易状态。

    交易结果分4种情况:

    • 交易成功        交易结束
    • 3DS                需引导客户前往3DS页面进行验证
    • 交易处理中    需要从异步通知中获取最终结果
    • 交易失败        交易结束

    # 预授权

    # 什么是预授权

    • 商户在持卡人消费前先冻结持卡人creditcard的余额或者额度。
    • 持卡人消费结束后,商户再正式扣掉这部分资金,常用于酒店住宿、出租等行业。
    • 线上交易正常预授权资金冻结期限为7天,部分发卡行是30天。

    注意 :
    • PingPongPay默认不会自动解冻持卡人资金。
    • 预授权交易7天或者30天后,如果商户在这期间没有任何操作,发卡行会自动解冻持卡人冻结的资金。
    • 商户发起Auth之后必须发起在恰当时间(通常为7天)发起CAPTURE,否则交易将被超时取消

    交易类型 类型描述
    SALE 消费交易,直接发起一笔正向交易
    AUTH 预授权交易,发起一笔预授权交易(此时交易实际并未完成,用户资金将被暂 时冻结,需要结合预授权确认操作完成交易)

    # 如何发起预授权交易

    v2/payment 接口中 填入paymentType= AUTH 即视为AUTH 业务

    # CAPTURE

    # 什么是CAPTURE

    对已经预授权成功的交易,在资金冻结期限内使用预授权完成进行请款操作。

    # 业务前提

    针对“预授权”交易可以发起“预授权完成”操作。

    # 业务限制

    1. 当前“预授权”交易未被判定为“预授权取消”。
    2. 预授权完成的金额需小于等于关联的 CAPTURE 交易。

    # 如何发起

    收银台模式和端到端模式都请求二次交易接口,填入paymentType=CAPTURE发起退款

    # 接口地址

    https://{host}/v2/payment/{transactionId}
    
    1

    参数详见 退款预授权

    # VOID

    # 什么是VOID

    对已经预授权的交易,通知发卡行进行预授权撤销,预授权撤销成功后发卡行会解冻持卡人冻结的资金。

    # 业务前提

    针对“预授权”交易可以发起“预授权撤销”操作。

    # 业务限制

    1. 当前“预授权”交易未被判定为“预授权完成”。
    2. 预授权撤销只能全额撤销。

    # 如何发起

    收银台模式和端到端模式都请求二次交易接口,填入paymentType=VOID发起退款

    # 接口地址

    https://{host}/v2/payment/{transactionId}
    
    1

    参数详见退款预授权

    # 快捷支付

    # 什么是快捷支付

    • 持卡人进行首次支付时,商户可通过指定 createToken=Y,发起一笔消费/预授权交易。

    • 交易成功后, pingpong checkout 会为该持卡人的该卡片创建 token 令牌。

    • token 令牌创建成功后,pingpong checkout 会将创 建的 token 令牌值返回给商户。

    • 该持卡人以当前信用卡进行的后续交易,可使用 token 令牌代替卡信息进行支付。

    • 适用于循环支付、 快捷一键支付等场景。

    • “消费”或“预授权”交易时,需要上送 merchantUserId , 同时指定字段 createToken=Y。

    # 如何创建token

    • 端到端模式下,商户在接口请求时,需要明确指定 createToken 字段是否为 Y。

    • 同时需要商户自主维护 用户绑定的卡列表信息。

    • 如商户的收银台需要展示用户的卡列表信息,可以通过查询用户绑定列表接口进行查询。

    # 关键请求参数

    参数字段 参数类型 参数属性 参数说明
    merchantUserId String(255) M 商户网站上的当前用户的 ID
    createToken String(1) M 是否保存当前用户所使用的信用卡信息,用于 下次一键支付

    # 关键返回报文(同步/异步)

    参数字段 参数类型 参数说明
    token String(16) 用户绑定的 Token

    # 查询用户绑定列表

    详见接口 查询用户绑定列表

    上次更新: 2024/01/12, 17:42:45
    跳转接入
    商户收银台规范

    ← 跳转接入 商户收银台规范→

    杭州乒乓智能技术有限公司 | Copyright © 2015-2024 All rights reserved. pay.pingpongx.com
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式