Dialog Flow /gogle action Payment gateway (Transaction Integration) or Integrate any third party payment gateway

695 Views Asked by At

I'm working payment related application by using google assitant / Dialogflow . I refer below google reference url but i didn't understood anything.

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

Finally I use this method Build Physical Transactions with Google Pay. I integrate below code with my application but it throw Application not responding right now .

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.');
  }

Kindly advise how to integrate any payment gateway in google assitant.

1

There are 1 best solutions below

0
On BEST ANSWER

The tokenizationParameters object is empty, and this will cause your application to throw errors such as the one you mentioned.

If you do not yet have your payment gateway setup, you can provide placeholder values to get around the error until you are ready to setup payments.

Here are example placeholder tokenizationParameters for the payment processor 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"
    },

You can also take a look at the open source transaction sample code provided on GitHub to get a better idea on how to create an Action with transactions.