我正在使用google assantant / Dialogflow来处理与付款相关的应用程序。我在Google参考网址下面引用,但是我什么都不懂。
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.');
}
请告知如何在Google助手中集成任何付款网关。
答案 0 :(得分:0)
tokenizationParameters对象为空,这将导致您的应用程序引发错误,例如您提到的错误。
如果尚未设置付款网关,则可以提供占位符值来解决该错误,直到准备好设置付款为止。
以下是付款处理器Stripe的示例占位符tokenizationParameters:
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上提供的open source transaction sample code,以更好地了解如何使用事务创建操作。