Google Actions中的响应格式错误

时间:2019-08-12 17:33:57

标签: dialogflow actions-on-google

正试图构建一个交易型Google Assistant应用并按如下所示对请求Order对象进行框架设计:

{
  "@type": "type.googleapis.com/google.actions.v2.TransactionDecisionValueSpec",
  "orderOptions": {
    "requestDeliveryAddress": false
  },
  "paymentOptions": {
    "googleProvidedOptions": {
      "prepaidCardDisallowed": false,
      "supportedCardNetworks": ["VISA", "AMEX", "DISCOVER", "MASTERCARD"],
      "tokenizationParameters": {
        "tokenizationType": "PAYMENT_GATEWAY",
        "parameters": {
          "gateway": "stripe",
          "stripe:publishableKey": "pk_live_KEY",
          "stripe:version": "2019-05-16"
        }
      }
    }
  },
  "proposedOrder": {
    "createTime": "2019-08-11T12:18:36-04:00",
    "lastUpdateTime": "2019-08-11T12:18:36-04:00",
    "merchantOrderId": "248276353077",
    "userVisibleOrderId": "248276353077",
    "transactionMerchant": {
      "id": "shopifystore.myshopify.com",
      "name": "Shoe Store"
    },
    "contents": {
      "lineItems": [{
        "name": "Amla Shots",
        "id": "29051889385525",
        "priceAttributes": {
          "type": "REGULAR",
          "name": "Item Price",
          "amount": {
            "currencyCode": "USD",
            "amountInMicros": "5000000"
          },
          "state": "ACTUAL",
          "taxIncluded": false
        },
        "purchase": {
          "quantity": "1"
        },
        "description": ""
      }, {
        "name": "Amla Shots",
        "id": "29051889418293",
        "priceAttributes": {
          "type": "REGULAR",
          "name": "Item Price",
          "amount": {
            "currencyCode": "USD",
            "amountInMicros": "10000000"
          },
          "state": "ACTUAL",
          "taxIncluded": false
        },
        "purchase": {
          "quantity": "1"
        },
        "description": ""
      }]
    },
    "buyerInfo": {
      "email": "123@gmail.com",
      "firstName": "123",
      "lastName": "123",
      "displayName": "123 123"
    },
    "priceAttributes": [{
      "type": "TOTAL",
      "name": "Total Price",
      "state": "ESTIMATE",
      "amount": {
        "currencyCode": "USD",
        "amountInMicros": "15990000"
      },
      "taxIncluded": true
    }, {
      "type": "TAX",
      "name": "Tax",
      "state": "ESTIMATE",
      "amount": {
        "currencyCode": "USD",
        "amountInMicros": "990000"
      },
      "taxIncluded": true
    }, {
      "type": "SUBTOTAL",
      "name": "Subtotal",
      "state": "ESTIMATE",
      "amount": {
        "currencyCode": "USD",
        "amountInMicros": "15000000"
      }
    }],
    "termsOfServiceUrl": "https://example.com",
    "note": "Powered by Example"
  }
}

显示的错误消息:

  

MalformedResponse:无法将Dialogflow响应解析为   由于平台响应无效,导致AppResponse:试图解析数据   从系统意图来看却失败了

JSON中哪里有错误?

1 个答案:

答案 0 :(得分:0)

{
  "payload": {
    "google": {
      "expectUserResponse": true,
      "systemIntent": {
        "intent": "actions.intent.TRANSACTION_DECISION",
        "data": {
              <add your above JSON here>
          }
        }
      }
    }
  }
}