Google APi错误请求

时间:2018-09-05 10:41:33

标签: google-api google-oauth2 google-pay

我尝试在我们的网站上实施Google Api的通行证服务,但始终遇到错误400问题

我们遵循本文档 Giftcardclass: insert

我使用邮递员进行测试

  

POST https://www.googleapis.com/walletobjects/v1/giftCardClass

请求正文

{  
   "kind":"walletobjects#loyaltyObject",
   "id":"test2.test",
   "classId":"test.test",
   "version":12,
   "state":"active",
   "issuername":"dsadasdasdas",
   "barcode":{  
      "kind":"walletobjects#barcode",
      "type":"ean13",
      "value":"aaaa",
      "alternateText":"aaaa"
   }
}

jSon响应

{    "error": {
       "errors": [
           {
               "domain": "global",
               "reason": "invalidArgument",
               "message": "Bad Request"
          }
      ],
      "code": 400,
      "message": "Bad Request"    } 
}

从文档中看来,仅需要id,issuerstate和reviewStatus。

1 个答案:

答案 0 :(得分:0)

好像您的ID格式错误,应该为issuer_id.unique_id。请参阅https://developers.google.com/pay/passes/rest/v1/giftcardclass#GiftCardClass.FIELDS.id以供参考。