1

我目前正在使用PHP Simple Order Api REST 客户端 https://github.com/Cyber ​​Source/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方式,因为我在Simple Order API中找不到encryptedPayment字段引用的引用,但它不起作用。

要求

{
    "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/)
4

1 回答 1

0

您应该填充 paymentInformation->fluidData->value - 而不是“key”。应该看起来像这样:

    "paymentInformation": {
      "fluidData": {
        "value": "eyJzaWduYXR1cmUiOiJNRVlDSVFEOWNseWVWaDdjQ1FQNjhSYjVDYjNYREF1aEZxZzJDcVAxZmxuL0lHQmJ2Z0loQU1oM3YxYlZoRUVwQjFJdThib2VmN01POE1TR1Q0Ni9CenRUcUVTMmpiYysiLCJwcm90b2NvbFZlcnNpb24iOiJFQ3YxIiwic2lnbmVkTWVzc2FnZSI6IntcImVuY3J5cHRlZE1lc3NhZ2VcIjpcIkg2YzFVcUNsQnNVRkFNUGd4aVp3M3V5aFgyaVpEQnlIWWU2NSs3Mnh2MTh4OWZUczZFd1lEc3FNTHNiMnh6aUpqRlZ4Vm1kcXBWTWVSSCtJbTI4WU9PQXcxY05USjBucko3YVdFSlQxY2xZYm4vZy9JS1FWb3Y2Q3FpYzlrTzJGcVpyMWhMWVZmU255ZnhjdXVkNHBvSWgvb0daQXBCMzZOWDBvSktWeG93LzlaR2lKSXBaR3o1VXByYm9pMVl0VlpvOVJiN1NsL3RPTEJyRm5XU2hXem1sbi96V3hobU5hcEN0REVpM005MWtuU2ZhMWg0NVordG0ybWZuVzJub1oxM1pNMURsaGg3UHpmKzZqZ1grK09qbVpLS01nMEk1bEZBcnhReGFLckw5bmRCNmkxTTZ0MjAzTVNhSlRmbjFjY1pXaEF0K3Vlb2EzbVQxdWVveURUL09OaUU5a0dub1dpYjJINjRoNlIvM0oxaHJBdVlpY0p6NTNGcjkvZ09iUTFBT0huclNMTHNuTzJSUUVORmdzTXA5Ri8wOWIycC91NDRBOGt6TE1HT2svdGZPVURXL2V3c1JRcVZzaFEyY1plSjRcXHUwMDNkXCIsXCJlcGhlbWVyYWxQdWJsaWNLZXlcIjpcIkJFQnpZRk13QjlOVjVJenlhZzFFMHBVMGZXK0hYbmxXVm5iN1JZWGVSLzR1K0tmUjJweVhoekJzSXVMOWsvTkNLZFNTOXRpSG1LUzZHUEdjZHozU3dnVVxcdTAwM2RcIixcInRhZ1wiOlwiYktUZVQrSVlBeUgwbWw3VEJuaXpGQVpCa2l0Q2dKS09uTStqOTI3enhWb1xcdTAwM2RcIn0ifQ=="
      }
    },

顺便说一句,REST API 和 Simple Order API 是两个不同的 API,具有不同的字段名称。简单订单 API 是 SOAP。

于 2021-01-12T16:56:23.747 回答