首页 > 解决方案 > 支付令牌没有响应

问题描述

==== 已解决 ====

问题解决了。Adyen 希望您将整个字符串作为对象发送。JSON.parse(令牌)。确保在 Adyen 平台中启用了 Google 支付。

=================

我正在与 Actions on Google 进行交易并与 Google Pay 集成。我按照 Actions on Google 的文档执行了所有步骤。

为了提出订单,我发送以下代码片段。笔记:


// Handle order with Google Pay.
conv.ask(new TransactionDecision({
  orderOptions: {
    requestDeliveryAddress: true,
    userInfoOptions: {
      userInfoProperties: [
        'EMAIL',
      ],
    },
  },
  paymentParameters: {
    googlePaymentOption: {
      facilitationSpec: JSON.stringify({
        apiVersion: 2,
        apiVersionMinor: 0,
        environment: 'TEST',
        merchantInfo: {
          merchantName: 'Example Merchant',
          merchantId: '12345678901234567890',
        },
        allowedPaymentMethods: [
          {
            type: 'CARD',
            parameters: {
              allowedAuthMethods: ['PAN_ONLY', 'CRYPTOGRAM_3DS'],
              allowedCardNetworks: [
                'AMEX', 'DISCOVER', 'JCB', 'MASTERCARD', 'VISA',
              ],
            },
            tokenizationSpecification: {
              type: 'PAYMENT_GATEWAY',
              parameters: {
                'gateway': 'my_gateway',
                'gatewayMerchantId': 'my_gateway_id',
              },
            },
          },
        ],
        transactionInfo: {
          totalPriceStatus: 'FINAL',
          totalPrice: prodPriceInclBtwInMicros.toString(),
          currencyCode: 'EUR',
        },
      }),
    },
  },
  presentationOptions: {
    actionDisplayName: 'PLACE_ORDER',
  },
  order: order,
}));

处理事务决策值的意图获得以下arg值:

    const arg = conv.arguments.get('TRANSACTION_DECISION_VALUE');

{
'@type': 'type.googleapis.com/google.actions.transactions.v3.TransactionDecisionValue',
  transactionDecision: 'ORDER_ACCEPTED',
  order: {
    googleOrderId: '02458320178127324049',
    merchantOrderId: 'example',
    userVisibleOrderId: 'example',
    buyerInfo: {
      email: 'example@example.com',
      firstName: 'example',
      lastName: 'example',
      displayName: 'example example'
    },
    createTime: '2020-07-21T10:59:16.624Z',
    lastUpdateTime: '2020-07-21T10:59:16.624Z',
    transactionMerchant: { name: 'Example Merchant' },
    contents: { lineItems: [Array] },
    priceAttributes: [ [Object], [Object], [Object] ],
    paymentData: { paymentResult: [Object], paymentInfo: [Object] },
    purchase: {
      status: 'CREATED',
      type: 'RETAIL',
      userVisibleStatusLabel: 'CREATED'
    },
    vertical: {
      '@type': 'type.googleapis.com/google.actions.orders.v3.verticals.purchase.PurchaseOrderExtension',
      status: 'CREATED',
      type: 'RETAIL',
      userVisibleStatusLabel: 'CREATED'
    }
  }
}

根据 [Adyen][1],我应该提供支付令牌:“从 Google Pay API 的 PaymentData 响应中获取令牌。” [Google][2] 声明在用户批准付款后,令牌将在响应对象中返回。这肯定不是在 `arg` 对象中可以看到的情况。

通过深入挖掘 paymentData,我们得到以下值:

{
  paymentResult: {
    googlePaymentData: '{"signature":"MEYCIQDS8Tiu9bprWqamQ24oNx+Wa43Wg6Vi3sP5PArDeOtOEAIhAOBqe4sQvN5tD390qWzDn9DIgwA8gjS8ajynrusOix6O","protocolVersion":"ECv1","signedMessage":"{\\"encryptedMessage\\":\\"Some_tokens_IUHASIDHUSAGFUAHS\\",\\"ephemeralPublicKey\\":\\"SOMEKEYSASD\\\\u003d\\",\\"tag\\":\\"SOMETAG_OIASJDJSOIJ\\\\u003d\\"}"}'
  },
  paymentInfo: {
    paymentMethodDisplayInfo: {
      paymentType: 'PAYMENT_CARD',
      paymentMethodDisplayName: 'Visa •••• 1234'
    },
    paymentMethodProvenance: 'PAYMENT_METHOD_PROVENANCE_GOOGLE'
  }
}

响应中仍然没有token返回...这对于网关来说是必需的。

有谁知道如何解决这个问题?或者这与生产事务 API 有关系吗?

任何帮助表示赞赏。[1]:https ://docs.adyen.com/payment-methods/google-pay/api-only [2]:https ://developers.google.com/pay/api/web/reference/response-objects #PaymentData

标签: actions-on-googlegoogle-pay

解决方案


推荐阅读