Google Wallet API JWT
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
JSON 表示法
{
"iss": "example_service_account@developer.gserviceaccount.com",
"aud": "google",
"typ": "savetowallet",
"iat": 1368029586,
"payload": {
"eventTicketClasses": [{
... //Event ticket Class JSON
}],
"eventTicketObjects": [{
// Event ticket Object JSON
}],
"flightClasses": [{
// Flight Class JSON
}],
"flightObjects": [{
// Flight Object JSON
}],
"giftCardClasses": [{
// Gift card Class JSON
}],
"giftCardObjects": [{
// Gift card Object JSON
}],
"loyaltyClasses": [{
// Loyalty Class JSON
}],
"loyaltyObjects": [{
// Loyalty Object JSON
}],
"offerClasses": [{
// Offer Class JSON
}],
"offerObjects": [{
// Offer Object JSON
}],
"transitClasses": [{
// Transit Class JSON
}],
"transitObjects": [{
// Transit Object JSON
}]
},
"origins": ["http://baconrista.com", "https://baconrista.com"]
}
字段
字段 |
类型 |
必需 |
说明 |
iss |
字符串 |
是 |
您的 Google Cloud 服务账号生成的电子邮件地址。 |
aud |
字符串 |
是 |
受众群体。Google Wallet API 对象的受众将始终为
google 。 |
typ |
字符串 |
是 |
JWT 的类型。Google Wallet API 对象的受众将始终为
savetowallet 。 |
iat |
整数 |
是 |
从新纪元开始的时间(以秒为单位)。 |
payload |
对象 |
是 |
载荷对象。 |
payload.eventTicketClasses |
数组 |
否 |
要保存的活动门票类。 |
payload.eventTicketObjects |
数组 |
否 |
要保存的活动门票对象。 |
payload.flightClasses |
数组 |
否 |
要保存的航班类。 |
payload.flightObjects |
数组 |
否 |
要保存的广告投放对象。 |
payload.giftCardClasses |
数组 |
否 |
要保存的礼品卡类。 |
payload.giftCardObjects |
数组 |
否 |
要保存的礼品卡对象。 |
payload.loyaltyClasses |
数组 |
否 |
要保存的会员卡类。 |
payload.loyaltyObjects |
数组 |
否 |
要保存的会员卡对象。 |
payload.offerObjects |
数组 |
否 |
要保存的优惠对象。 |
payload.offerClasses |
数组 |
否 |
要保存优惠类。 |
payload.transitObjects |
数组 |
否 |
要保存的公交对象。 |
payload.transitClasses |
数组 |
否 |
要保存的公交类。 |
origins |
数组 |
是 |
获准使用 JWT 保存功能的网域数组。Google Wallet API
如果未定义 origins 字段,按钮将不会呈现。您可以
系统可能会显示“Load denied by X-Frame-Options”或“已拒绝显示”中的消息
(当未定义来源字段时)。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eThe JSON structure defines a payload for saving various Google Wallet objects like event tickets, flights, gift cards, loyalty cards, offers, and transit passes.\u003c/p\u003e\n"],["\u003cp\u003eRequired fields include \u003ccode\u003eiss\u003c/code\u003e (issuer), \u003ccode\u003eaud\u003c/code\u003e (audience), \u003ccode\u003etyp\u003c/code\u003e (type), \u003ccode\u003eiat\u003c/code\u003e (issued at time), \u003ccode\u003epayload\u003c/code\u003e (object data), and \u003ccode\u003eorigins\u003c/code\u003e (allowed domains).\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003epayload\u003c/code\u003e object contains arrays for different object types, each with 'Class' and 'Object' entries for defining object structures and instances.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eorigins\u003c/code\u003e field is crucial for enabling the Google Wallet API button and preventing loading errors in the browser.\u003c/p\u003e\n"]]],["The JSON defines data for saving various passes to Google Wallet. Required fields include the service account email (`iss`), \"google\" as the audience (`aud`), \"savetowallet\" as the type (`typ`), and the issued-at time (`iat`). The `payload` contains arrays for classes and objects related to event tickets, flights, gift cards, loyalty programs, offers, and transit. `origins` lists approved domains for JWT saving. Each object or class array within the `payload` is optional.\n"],null,["# Google Wallet API JWT\n\n### JSON representation\n\n```gdscript\n{\n \"iss\": \"example_service_account@developer.gserviceaccount.com\",\n \"aud\": \"google\",\n \"typ\": \"savetowallet\",\n \"iat\": 1368029586,\n \"payload\": {\n \"eventTicketClasses\": [{\n ... //Event ticket Class JSON\n }],\n \"eventTicketObjects\": [{\n // Event ticket Object JSON\n }],\n \"flightClasses\": [{\n // Flight Class JSON\n }],\n \"flightObjects\": [{\n // Flight Object JSON\n }],\n \"giftCardClasses\": [{\n // Gift card Class JSON\n }],\n \"giftCardObjects\": [{\n // Gift card Object JSON\n }],\n \"loyaltyClasses\": [{\n // Loyalty Class JSON\n }],\n \"loyaltyObjects\": [{\n // Loyalty Object JSON\n }],\n \"offerClasses\": [{\n // Offer Class JSON\n }],\n \"offerObjects\": [{\n // Offer Object JSON\n }],\n \"transitClasses\": [{\n // Transit Class JSON\n }],\n \"transitObjects\": [{\n // Transit Object JSON\n }]\n },\n \"origins\": [\"http://baconrista.com\", \"https://baconrista.com\"]\n}\n```\n\n### Fields\n\n| Field | Type | Required | Description |\n|------------------------------|---------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `iss` | String | Y | Your Google Cloud service account generated email address. |\n| `aud` | String | Y | Audience. The audience for Google Wallet API Objects will always be `google`. |\n| `typ` | String | Y | Type of JWT. The audience for Google Wallet API Objects will always be `savetowallet`. |\n| `iat` | Integer | Y | Issued at time in seconds since epoch. |\n| `payload` | Object | Y | Payload object. |\n| `payload.eventTicketClasses` | Array | N | Event Ticket Class to save. |\n| `payload.eventTicketObjects` | Array | N | Event Ticket Object to save. |\n| `payload.flightClasses` | Array | N | Flight Class to save. |\n| `payload.flightObjects` | Array | N | Flight Object to save. |\n| `payload.giftCardClasses` | Array | N | Gift Card Class to save. |\n| `payload.giftCardObjects` | Array | N | Gift Card Object to save. |\n| `payload.loyaltyClasses` | Array | N | Loyalty Class to save. |\n| `payload.loyaltyObjects` | Array | N | Loyalty Object to save. |\n| `payload.offerObjects` | Array | N | Offer Object to save. |\n| `payload.offerClasses` | Array | N | Offer Class to save. |\n| `payload.transitObjects` | Array | N | Transit Object to save. |\n| `payload.transitClasses` | Array | N | Transit Class to save. |\n| `origins` | Array | Y | Array of domains to approve for JWT saving functionality. The Google Wallet API button will not render when the `origins` field is not defined. You could potentially get a \"Load denied by X-Frame-Options\" or \"Refused to display\" messages in the browser console when the origins field is not defined. |"]]