对话框流/护目镜操作支付网关(交易集成)或集成任何第三方支付网关



我正在使用谷歌助手/对话流来处理与支付相关的应用程序。我在下面引用谷歌参考网址,但我什么都不懂。

https://developers.google.com/actions/transactions/

最后,我使用此方法使用Google Pay构建物理交易。我将以下代码与我的应用程序集成,但它抛出应用程序现在没有响应

conv.ask(new TransactionRequirements({
orderOptions: {
requestDeliveryAddress: false,
},
paymentOptions: {
googleProvidedOptions: {
prepaidCardDisallowed: false,
supportedCardNetworks: ['VISA', 'AMEX'],
// These will be provided by payment processor,
// like Stripe, Braintree, or Vantiv.
tokenizationParameters: {},
},
},
}));
const arg = conv.arguments.get('TRANSACTION_REQUIREMENTS_CHECK_RESULT');
if (arg && arg.resultType ==='OK') {
// Normally take the user through cart building flow
conv.ask(`Looks like you're good to go! ` +
`Try saying "Get Delivery Address".`);
} else {
conv.close('Transaction failed.');
}

请告知如何在谷歌助手中集成任何支付网关。

tokenizationParameters 对象为空,这将导致您的应用程序引发错误,例如您提到的错误。

如果您尚未设置支付网关,则可以提供占位符值来绕过错误,直到您准备好设置付款为止。

以下是占位符标记化支付处理器 Stripe 的参数示例:

tokenizationParameters: {
parameters: {
"gateway": "braintree",
"braintree:sdkVersion": "1.4.0",
"braintree:apiVersion": "v1",
"braintree:merchantId": "xxxxxxxxxxx",
"braintree:clientKey": "sandbox_xxxxxxxxxxxxxxx",
"braintree:authorizationFingerprint": "sandbox_xxxxxxxxxxxxxxx"
},
tokenizationType: "PAYMENT_GATEWAY"
},

您还可以查看 GitHub 上提供的开源事务示例代码,以更好地了解如何使用事务创建操作。

最新更新