0

我尝试付款。我在此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)

我究竟做错了什么?

4

3 回答 3

1

好的,我找到了答案。“shopperInteraction”不是必填字段。但是如果我们不发送它,我们会收到一个错误“无效的购物者交互”。请参阅https://docs.adyen.com/api-reference/payments-api/paymentrequest截屏

于 2019-11-18T03:50:37.877 回答
1

我是adyen-node-api-library的作者,我已经在最新版本 (v2.1.7) 上测试了相同的请求,而没有发送 shopperInteraction 并且它有效。您使用的是哪种付款方式?我的要求是使用卡付款。此字段可能对于其他付款方式类型是必需的,而对于某些是可选的。

要求:

 {
  "amount": {
    "currency": "USD",
    "value": 10
  },
  "paymentMethod": {
    "type": "scheme",
    "cvc": "737",
    "expiryMonth": "10",
    "expiryYear": "2020",
    "holderName": "John Smith",
    "number": "4111111111111111"
  },
  "reference": "123456",
  "merchantAccount": MY_MERCHANT_ACCOUNT,
  "returnUrl": "http://localhost:3003/"
}

回复:

{
  ...
  "pspReference": PSP_REFERENCE,
  "resultCode": "Authorised",
  "merchantReference": "123456"
}
于 2019-11-19T15:10:20.753 回答
-2

我试过这个

{
    "amount": {
        "currency": "USD",
        "value": 10
    },
    "paymentMethod": {
        "type": "scheme",
        "number": "5555444433331111",
        "expiryMonth": "10",
        "expiryYear": "2020",
        "holderName": "John Smith",
        "cvc": "737"
    },
    "reference": "123456",
    "merchantAccount": "HugHubUK",
    "returnUrl": "www.google.com"
}

但出现错误

{
    "status": 422,
    "errorCode": "000",
    "message": "Please supply paymentDetails",
    "errorType": "validation",
    "pspReference": "881576842443252F"
}
于 2019-12-20T11:49:13.333 回答