我目前正在使用 PHP简单订单Api REST客户端 https://github.com/CyberSource/cybersource-rest-client-php
两个开发人员指南
以相同的方式描述通过Google Pay获得的数据的格式。但是,他们描述了格式化请求的不同方法。
1) Set the encryptedPayment_data field to the value of the
encryptedMessage field that was returned in the Full Wallet
response.
2) Set the paymentSolution field to 012.
和
2) In the authorization request under the paymentInformation
object, set the key field under the fluidData object to the
Base64-encoded value obtained from the Google Pay blob.
3) Under the processingInformation object, set the
paymentSolution field to 012.
我正在使用尝试 fluidData 的方式,因为我找不到 encryptedPayment 的引用> 简单订单API 中的字段引用,但无效。
请求
{
"clientReferenceInformation": {
"code": "testcode"
},
"processingInformation": {
"paymentSolution": "012"
},
"paymentInformation": {
"fluidData": {
"key":"<Google Pay Blob>"
}
},
"orderInformation": {
"amountDetails": {
"totalAmount": "100.00",
"currency": "USD"
},
"billTo": {
"firstName": "John",
"lastName": "Doe",
"company": "ABC Company",
"address1": "1 Market St",
"locality": "san francisco",
"administrativeArea": "CA",
"postalCode": "94105",
"country": "US",
"email": "test@cybs.com",
"phoneNumber": "4158880000"
}
}
}
回复
[body] => stdClass Object
(
[submitTimeUtc] => 2019-04-10T16:05:39Z
[status] => INVALID_REQUEST
[reason] => MISSING_FIELD
[message] => Declined - The request is missing one or more fields
[details] => Array
(
[0] => stdClass Object
(
[field] => recipientInformation.card.number
[reason] => MISSING_FIELD
)
)
)
[message] => [400] Error connecting to the API (https://apitest.cybersource.com/pts/v2/payments/)
答案 0 :(得分:0)
您应该填充 paymentInformation->fluidData->value - 而不是“key”。应该看起来像这样:
"paymentInformation": {
"fluidData": {
"value": "eyJzaWduYXR1cmUiOiJNRVlDSVFEOWNseWVWaDdjQ1FQNjhSYjVDYjNYREF1aEZxZzJDcVAxZmxuL0lHQmJ2Z0loQU1oM3YxYlZoRUVwQjFJdThib2VmN01POE1TR1Q0Ni9CenRUcUVTMmpiYysiLCJwcm90b2NvbFZlcnNpb24iOiJFQ3YxIiwic2lnbmVkTWVzc2FnZSI6IntcImVuY3J5cHRlZE1lc3NhZ2VcIjpcIkg2YzFVcUNsQnNVRkFNUGd4aVp3M3V5aFgyaVpEQnlIWWU2NSs3Mnh2MTh4OWZUczZFd1lEc3FNTHNiMnh6aUpqRlZ4Vm1kcXBWTWVSSCtJbTI4WU9PQXcxY05USjBucko3YVdFSlQxY2xZYm4vZy9JS1FWb3Y2Q3FpYzlrTzJGcVpyMWhMWVZmU255ZnhjdXVkNHBvSWgvb0daQXBCMzZOWDBvSktWeG93LzlaR2lKSXBaR3o1VXByYm9pMVl0VlpvOVJiN1NsL3RPTEJyRm5XU2hXem1sbi96V3hobU5hcEN0REVpM005MWtuU2ZhMWg0NVordG0ybWZuVzJub1oxM1pNMURsaGg3UHpmKzZqZ1grK09qbVpLS01nMEk1bEZBcnhReGFLckw5bmRCNmkxTTZ0MjAzTVNhSlRmbjFjY1pXaEF0K3Vlb2EzbVQxdWVveURUL09OaUU5a0dub1dpYjJINjRoNlIvM0oxaHJBdVlpY0p6NTNGcjkvZ09iUTFBT0huclNMTHNuTzJSUUVORmdzTXA5Ri8wOWIycC91NDRBOGt6TE1HT2svdGZPVURXL2V3c1JRcVZzaFEyY1plSjRcXHUwMDNkXCIsXCJlcGhlbWVyYWxQdWJsaWNLZXlcIjpcIkJFQnpZRk13QjlOVjVJenlhZzFFMHBVMGZXK0hYbmxXVm5iN1JZWGVSLzR1K0tmUjJweVhoekJzSXVMOWsvTkNLZFNTOXRpSG1LUzZHUEdjZHozU3dnVVxcdTAwM2RcIixcInRhZ1wiOlwiYktUZVQrSVlBeUgwbWw3VEJuaXpGQVpCa2l0Q2dKS09uTStqOTI3enhWb1xcdTAwM2RcIn0ifQ=="
}
},
顺便说一句,REST API 和 Simple Order API 是两个不同的 API,具有不同的字段名称。 Simple Order API 是 SOAP。