我尝试付款。我在此https://docs.adyen.com/checkout/drop-in-web指南中使用插件。然后我将加密的卡数据(例如,我添加一个“4000 0200 0000 0000”测试卡)作为 json 字符串发送到服务器(它使用“@adyen/api-library”:“^2.1.6”)。然后我尝试付款:
const config = new Config()
config.apiKey = MY_API_KEY
config.merchantAccount = MY_ACCOUNT
const client = new Client({ config })
client.setEnvironment('TEST')
const checkout = new CheckoutAPI(client)
try {
const paymentsResponse = await checkout.payments({
amount: {
currency: 'USD',
value: 10
},
paymentMethod: JSON.parse(paymentMethod),
reference: "123456",
merchantAccount: MY_ACCOUNT,
returnUrl: 'http://localhost:3003/'
})
console.info(JSON.stringify(paymentsResponse))
在控制台中我看到:
HttpClientException {
statusCode: 422,
name: 'HttpClientException',
message:
'HTTP Exception: 422. Unprocessable Entity: Invalid shopper interaction',
errorCode: '000',
.............................................................. (other)
我究竟做错了什么?