코드 스니펫

다음 패스 카테고리 중 하나를 선택하여 사용 방법을 자세히 알아보세요.


이 섹션에는 이벤트 티켓의 코드 스니펫이 포함되어 있습니다. 다음 클래스와 객체가 나와 있습니다.

JSON EventTicketClass

EventTicketClass를 정의한 후 다음 REST URI에 대해 POST 요청을 실행하여 해당 클래스를 삽입합니다.

https://walletobjects.googleapis.com/walletobjects/v1/eventTicketClass

엄격한 오류 파싱을 설정하고 중복 ID 필드와 같은 더 많은 오류를 포착하려면 REST URI에 strict=true 매개변수를 추가합니다.

https://walletobjects.googleapis.com/walletobjects/v1/eventTicketClass?strict=true

다음은 EventTicketClass를 나타내는 JSON 리소스를 보여주는 예시입니다. JSON은 POST 요청의 본문으로 보내야 합니다. 다음 코드 샘플은 EventTicketClass를 정의하고 삽입하는 구체적인 방법을 보여줍니다.

리소스

{
    "kind": "walletobjects#eventTicketClass",
     "id": string,
    "reviewStatus": string,
    "issuerName": string,
     "eventName": {
        "kind": "walletobjects#localizedString",
          "translatedValues": [   {
            "kind": "walletobjects#translatedString",
                "language": string,
                "value": string
        }  ],
          "defaultValue": {
            "kind": "walletobjects#translatedString",
               "language": string,
               "value": string
        }
    },
    "venue": {
        "kind": "walletobjects#eventVenue",
          "name": {
            "kind": "walletobjects#localizedString",
               "translatedValues": [    {
                "kind": "walletobjects#translatedString",
                     "language": string,
                     "value": string
            }   ],
               "defaultValue": {
                "kind": "walletobjects#translatedString",
                    "language": string,
                    "value": string
            }
        },
          "address": {
            "kind": "walletobjects#localizedString",
               "translatedValues": [    {
                "kind": "walletobjects#translatedString",
                     "language": string,
                     "value": string
            }   ],
               "defaultValue": {
                "kind": "walletobjects#translatedString",
                    "language": string,
                    "value": string
            }
        }
    },
     "dateTime": {
        "kind": "walletobjects#eventDateTime",
          "doorsOpenLabel": string,
          "customDoorsOpenLabel": {
            "kind": "walletobjects#localizedString",
               "translatedValues": [    {
                "kind": "walletobjects#translatedString",
                     "language": string,
                     "value": string
            }   ],
               "defaultValue": {
                "kind": "walletobjects#translatedString",
                    "language": string,
                    "value": string
            }
        },
          "doorsOpen": string,
          "start": string,
          "end": string
    },
}

자바

// Define the Image Module Data
List<ImageModuleData> imageModuleData = new ArrayList<ImageModuleData>();

ImageModuleData image = new ImageModuleData().setMainImage(
    new Image().setSourceUri(
        new ImageUri().setUri("http://farm4.staticflickr.com/3738/12440799783_3dc3c20606_b.jpg")));

imageModuleData.add(image);

// Define Links Module Data
List<Uri> uris = new ArrayList<Uri>();
Uri uri1 = new Uri().setDescription("Nearby Locations").setUri("http://maps.google.com/?q=google");
Uri uri2 = new Uri().setDescription("Call Customer Service").setUri("tel:6505555555");

uris.add(uri1);
uris.add(uri2);

LinksModuleData linksModuleData = new LinksModuleData().setUris(uris);

// Define Text Areas
List<TextModuleData> textModulesData = new ArrayList<TextModuleData>();

TextModuleData details = new TextModuleData().setHeader("Custom EventTicket Details").setBody(
    "Baconrista events have pushed the limits since its founding.");

textModulesData.add(details);

// Define Geofence locations
List<LatLongPoint> locations = new ArrayList<LatLongPoint>();
locations.add(new LatLongPoint().setLatitude(37.422601).setLongitude(
    -122.085286));
locations.add(new LatLongPoint().setLatitude(37.424354).setLongitude(
    -122.09508869999999));
locations.add(new LatLongPoint().setLatitude(40.7406578).setLongitude(
    -74.00208940000002));

// Define event name
LocalizedStringDefaultValue eventnameDefault = new LocalizedStringDefaultValue().setlanguage("en-us").setValue("Baconrista Event-o-rama");
LocalizedString eventName = new LocalizedString().setDefaultValue(eventnameDefault);

// Define Event logo
ImageModuleData logoImage = new ImageModuleData().setMainImage(
    new Image().setSourceUri(
        new ImageUri().setUri("https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png")));

// Define Event ticket venue details
LocalizedStringDefaultValue venueNameDefault = new LocalizedStringDefaultValue().setlanguage("en-us").setValue("Baconrista Stadium");
LocalizedString venueName = new LocalizedString().setDefaultValue(venueNameDefault);
LocalizedStringDefaultValue venueAddressDefault = new LocalizedStringDefaultValue().setlanguage("en-us").setValue("101 Baconrista Dr.");
LocalizedString venueAddress = new LocalizedString().setDefaultValue(venueAddressDefault);

Venue venue = new Venue().setName(venueName).setAddress(venueAddress);

// Define event start, end, and door opent datetimes.  DateTime should be String value in ISO 8601 extended format date/time, with or without an offset
VenueDateTime dateTime = new VenueDateTime()
    .setDoorsOpen("2020-04-12T10:20:50.52Z")
    .setStart("2020-04-12T11:20:50.52Z")
    .setEnd("2020-04-12T16:20:50.52Z");

EventTicketClass wobClass = new EventTicketClass()
    .setId('2945482443380251551.ExampleEventTicketClass1')
    .setIssuerName("Baconrista Stadium")
    .setReviewStatus("underReview")
    .setLocations(locations)
    .setLinksModuleData(linksModuleData)
    .setImageModulesData(imageModuleData)
    .setTextModulesData(textModulesData)
    .setEventName(eventName)
    .setLogo(logoImage)
    .setVenue(venue)
    .setDateTime(dateTime);

EventTicketClass response = client.EventTicketClass().insert(wobClass).execute();

PHP

// A list of locations at which the Wallet Class can be used.
$locations = array(
    array(
        'kind' => 'walletobjects#latLongPoint',
        'latitude' => 37.424015499999996,
        'longitude' => -122.09259560000001
    ),
    array(
        'kind' => 'walletobjects#latLongPoint',
        'latitude' => 37.424354,
        'longitude' => -122.09508869999999
    ),
    array(
        'kind' => 'walletobjects#latLongPoint',
        'latitude' => 37.7901435,
        'longitude' => -122.39026709999997
    ),
    array(
        'kind' => 'walletobjects#latLongPoint',
        'latitude' => 40.7406578,
        'longitude' => -74.00208940000002
    )
);
// Source uri of title image.
$uriTitleImageInstance = new Google_Service_Walletobjects_ImageUri();
$imageTitleImageInstance = new Google_Service_Walletobjects_Image();
$uriTitleImageInstance->setUri(
    'http://farm4.staticflickr.com/3723/11177041115_6e6a3b6f49_o.jpg'
);
$imageTitleImageInstance->setSourceUri($uriTitleImageInstance);
// Define text module data.
$textModulesData = array(
    array(
        'header' => 'Custom Details',
        'body' => 'Baconrista events have pushed the limits since its founding.'
    ),
);
// Define links module data.
$linksModuleData = new Google_Service_Walletobjects_LinksModuleData();
$uris = array (
    array(
        'uri' => 'http://maps.google.com/map?q=google',
        'kind' => 'walletobjecs#uri',
        'description' => 'Nearby Locations'
    ),
    array(
        'uri' => 'tel:6505555555',
        'kind' => 'walletobjecs#uri',
        'description' => 'Call Customer Service'
    )
);
$linksModuleData->setUris($uris);

$uriModuleImageInstance = new Google_Service_Walletobjects_ImageUri();
$uriModuleImageInstance->setUri(
    'http://farm8.staticflickr.com/7401/11177116434_d8e600bba6_o.jpg'
);
$uriModuleImageInstance->setDescription('Coffee beans');
$imageModuleImageInstance = new Google_Service_Walletobjects_Image();
$imageModuleImageInstance->setSourceUri($uriModuleImageInstance);
$imagesModuleData = new Google_Service_Walletobjects_ImageModuleData();
$imagesModuleData->setMainImage($imageModuleImageInstance);
$imagesModuleDataArr = array ($imagesModuleData);

// Define event name
$eventnameDefault = new LocalizedStringDefaultValue()->setlanguage("en-us")->setValue("Baconrista Event-o-rama");
$eventName = new LocalizedString()->setDefaultValue($eventnameDefault);

// Define Event logo
$uriLogoImageInstance = new Google_Service_Walletobjects_ImageUri();
$imageLogoImageInstance = new Google_Service_Walletobjects_Image();
$uriLogoImageInstance->setUri(
    'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'
);
$imageLogoImageInstance->setSourceUri($uriLogoImageInstance);
$logoImage = new Logo()->setMainImage($imageLogoImageInstance);

// Define Event ticket venue details
$venueNameDefault = new LocalizedStringDefaultValue()->setlanguage("en-us")->setValue("Baconrista Stadium");
$venueName = new LocalizedString()->setDefaultValue(venueNameDefault);
$venueAddressDefault = new LocalizedStringDefaultValue()->setlanguage("en-us")->setValue("101 Baconrista dr.");
$venueAddress = new LocalizedString()->setDefaultValue(venueAddressDefault);

$venue = new Venue().setName($venueName).setAddress($venueAddress);

// Define event start, end, and door opent datetimes.  DateTime should be String value in ISO 8601 extended format date/time, with or without an offset
$dateTime = new VenueDateTime();
$dateTime->setDoorsOpen("2020-04-12T10:20:50.52Z")
$dateTime->setStart("2020-04-12T11:20:50.52Z")
$dateTime->setEnd("2020-04-12T16:20:50.52Z");

// Create wallet class.
$wobClass = new Google_Service_Walletobjects_EventTicketClass();
$EventTicketClass->setId('2945482443380251551.EventTicketClass');
$wobClass->setIssuerName('Baconrista Stadium');
$wobClass->setReviewStatus('underReview');
$wobClass->setLocations($locations);
$wobClass->setEventName($eventName);
$wobClass->setLogo($logoImage);
$wobClass->setVenue($venue);
$wobClass->setDateTime($dateTime);

$service->EventTicketClass->insert($wobClass);

Python

api_object = generate_eventticket_class(
      '1234567', 'ExampleeventticketClass')
api_request = service.eventticketclass().insert(body=api_object)
api_response = api_request.execute()

def generate_eventticket_class(issuer_id, class_id):
  eventticket_class = {
      'kind': 'walletobjects#eventTicketClass',
      'id': '%s.%s' % (issuer_id, class_id),
      'issuerName': 'Baconrista Stadium',
      'eventName': {
            'defaultValue': {
             'language': 'en-US',
             'value': 'Bacon Coffee Fun Event'
            }
      },
      'locations': [{
          'kind': 'walletobjects#latLongPoint',
          'latitude': 37.424015499999996,
          'longitude': -122.09259560000001
      }, {
          'kind': 'walletobjects#latLongPoint',
          'latitude': 37.424354,
          'longitude': -122.09508869999999
      }, {
          'kind': 'walletobjects#latLongPoint',
          'latitude': 37.7901435,
          'longitude': -122.39026709999997
      }, {
          'kind': 'walletobjects#latLongPoint',
          'latitude': 40.7406578,
          'longitude': -74.00208940000002
      }],
      'reviewStatus': 'underReview',
      'review': {
          'comments': 'Real auto approval by system'
      },
      'textModulesData': [{
          'header': 'Custom Details',
          'body': 'Baconrista events have pushed the limits since its founding.'
      }],
      'linksModuleData': {
          'uris': [{
              'kind': 'walletobjects#uri',
              'uri': 'http://maps.google.com/map?q=google',
              'description': 'Nearby Locations'
          }, {
              'kind': 'walletobjects#uri',
              'uri': 'tel:6505555555',
              'description': 'Call Customer Service'
          }]
      },
      'imageModulesData': [{
          'mainImage': {
              'kind': 'walletobjects#image',
              'sourceUri': {
                  'kind': 'walletobjects#uri',
                  'uri': 'http://farm4.staticflickr.com/3738/12440799783_3dc3c20606_b.jpg',
                  'description': 'Coffee beans'
              }
          }
      }],
      "logo": {
          "kind": "walletobjects#image",
            "sourceUri": {
              "kind": "walletobjects#uri",
                 "uri": 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png',
                 "description": 'Baconrista stadium logo'
          }
      },
      "venue": {
          "kind": "walletobjects#eventVenue",
            "name": {
              "kind": "walletobjects#localizedString",
                    "defaultValue": {
                  "kind": "walletobjects#translatedString",
                      "language": 'en-us',
                      "value": 'Baconrista Stadium'
              }
          },
            "address": {
              "kind": "walletobjects#localizedString",
                    "defaultValue": {
                  "kind": "walletobjects#translatedString",
                      "language": 'en-us',
                      "value": '101 Baconrista Dr.'
              }
          }
      },
       "dateTime": {
          "kind": "walletobjects#eventDateTime",
            "doorsOpen": '2020-04-12T10:20:50.52Z',
            "start": '2020-04-12T11:20:50.52Z',
            "end": '2020-04-12T16:20:50.52Z'
      }
  }
  return eventticket_class

JSON EventTicketObject

다음 샘플은 EventTicketObject를 정의합니다.

리소스

{
  "kind": "walletobjects#eventTicketObject",
  "id": string,
  "classId": string,
  "state": string,
  "barcode": {
    "kind": "walletobjects#barcode",
    "type": string,
    "value": string,
    "alternateText": string
  },
  "messages": [
    {
      "kind": "walletobjects#walletObjectMessage",
      "header": string,
      "localizedHeader": {
        "kind": "walletobjects#localizedString",
        "translatedValues": [
          {
            "kind": "walletobjects#translatedString",
            "language": string,
            "value": string
          }
        ],
        "defaultValue": {
          "kind": "walletobjects#translatedString",
          "language": string,
          "value": string
        }
      },
      "body": string,
      "localizedBody": {
        "kind": "walletobjects#localizedString",
        "translatedValues": [
          {
            "kind": "walletobjects#translatedString",
            "language": string,
            "value": string
          }
        ],
        "defaultValue": {
          "kind": "walletobjects#translatedString",
          "language": string,
          "value": string
        }
      },
      "displayInterval": {
        "kind": "walletobjects#timeInterval",
        "start": {
          "date": datetime
        },
        "end": {
          "date": datetime
        }
      },
      "id": string,
      "messageType": string
    }
  ],
  "validTimeInterval": {
    "kind": "walletobjects#timeInterval",
    "start": {
      "date": datetime
    },
    "end": {
      "date": datetime
    }
  },
  "locations": [
    {
      "kind": "walletobjects#latLongPoint",
      "latitude": double,
      "longitude": double
    }
  ],
  "hasUsers": boolean,
  "smartTapRedemptionValue": string,
  "hasLinkedDevice": boolean,
  "disableExpirationNotification": boolean,
  "infoModuleData": {
    "labelValueRows": [
      {
        "columns": [
          {
            "label": string,
            "localizedLabel": {
              "kind": "walletobjects#localizedString",
              "translatedValues": [
                {
                  "kind": "walletobjects#translatedString",
                  "language": string,
                  "value": string
                }
              ],
              "defaultValue": {
                "kind": "walletobjects#translatedString",
                "language": string,
                "value": string
              }
            },
            "value": string,
            "localizedValue": {
              "kind": "walletobjects#localizedString",
              "translatedValues": [
                {
                  "kind": "walletobjects#translatedString",
                  "language": string,
                  "value": string
                }
              ],
              "defaultValue": {
                "kind": "walletobjects#translatedString",
                "language": string,
                "value": string
              }
            }
          }
        ]
      }
    ],
    "showLastUpdateTime": boolean
  },
  "imageModulesData": [
    {
      "mainImage": {
        "kind": "walletobjects#image",
        "sourceUri": {
          "kind": "walletobjects#uri",
          "uri": string,
          "description": string,
          "localizedDescription": {
            "kind": "walletobjects#localizedString",
            "translatedValues": [
              {
                "kind": "walletobjects#translatedString",
                "language": string,
                "value": string
              }
            ],
            "defaultValue": {
              "kind": "walletobjects#translatedString",
              "language": string,
              "value": string
            }
          }
        }
      }
    }
  ],
  "textModulesData": [
    {
      "header": string,
      "body": string,
      "localizedHeader": {
        "kind": "walletobjects#localizedString",
        "translatedValues": [
          {
            "kind": "walletobjects#translatedString",
            "language": string,
            "value": string
          }
        ],
        "defaultValue": {
          "kind": "walletobjects#translatedString",
          "language": string,
          "value": string
        }
      },
      "localizedBody": {
        "kind": "walletobjects#localizedString",
        "translatedValues": [
          {
            "kind": "walletobjects#translatedString",
            "language": string,
            "value": string
          }
        ],
        "defaultValue": {
          "kind": "walletobjects#translatedString",
          "language": string,
          "value": string
        }
      }
    }
  ],
  "linksModuleData": {
    "uris": [
      {
        "kind": "walletobjects#uri",
        "uri": string,
        "description": string,
        "localizedDescription": {
          "kind": "walletobjects#localizedString",
          "translatedValues": [
            {
              "kind": "walletobjects#translatedString",
              "language": string,
              "value": string
            }
          ],
          "defaultValue": {
            "kind": "walletobjects#translatedString",
            "language": string,
            "value": string
          }
        }
      }
    ]
  },
  "classReference": eventticketclass Resource,
  "seatInfo": {
    "kind": "walletobjects#eventSeat",
    "seat": {
      "kind": "walletobjects#localizedString",
      "translatedValues": [
        {
          "kind": "walletobjects#translatedString",
          "language": string,
          "value": string
        }
      ],
      "defaultValue": {
        "kind": "walletobjects#translatedString",
        "language": string,
        "value": string
      }
    },
    "row": {
      "kind": "walletobjects#localizedString",
      "translatedValues": [
        {
          "kind": "walletobjects#translatedString",
          "language": string,
          "value": string
        }
      ],
      "defaultValue": {
        "kind": "walletobjects#translatedString",
        "language": string,
        "value": string
      }
    },
    "section": {
      "kind": "walletobjects#localizedString",
      "translatedValues": [
        {
          "kind": "walletobjects#translatedString",
          "language": string,
          "value": string
        }
      ],
      "defaultValue": {
        "kind": "walletobjects#translatedString",
        "language": string,
        "value": string
      }
    },
    "gate": {
      "kind": "walletobjects#localizedString",
      "translatedValues": [
        {
          "kind": "walletobjects#translatedString",
          "language": string,
          "value": string
        }
      ],
      "defaultValue": {
        "kind": "walletobjects#translatedString",
        "language": string,
        "value": string
      }
    }
  },
  "reservationInfo": {
    "kind": "walletobjects#eventReservationInfo",
    "confirmationCode": string
  },
  "ticketHolderName": string,
  "ticketNumber": string,
  "ticketType": {
    "kind": "walletobjects#localizedString",
    "translatedValues": [
      {
        "kind": "walletobjects#translatedString",
        "language": string,
        "value": string
      }
    ],
    "defaultValue": {
      "kind": "walletobjects#translatedString",
      "language": string,
      "value": string
    }
  },
  "faceValue": {
    "kind": "walletobjects#money",
    "micros": long,
    "currencyCode": string
  }
}

자바

// Define Barcode
Barcode barcode = new Barcode().setType("upcA").setValue("123456789012")
    .setAlternateText("12345");

// Define Seat Info
LocalizedStringDefaultValue gateDefault = new LocalizedStringDefaultValue().setlanguage("en-us").setValue("A");
LocalizedString gate = new LocalizedString().setDefaultValue(gateDefault);

LocalizedStringDefaultValue sectionDefault = new LocalizedStringDefaultValue().setlanguage("en-us").setValue("5");
LocalizedString section = new LocalizedString().setDefaultValue(sectionDefault);

LocalizedStringDefaultValue rowDefault = new LocalizedStringDefaultValue().setlanguage("en-us").setValue("G3");
LocalizedString row = new LocalizedString().setDefaultValue(rowDefault);

LocalizedStringDefaultValue seatDefault = new LocalizedStringDefaultValue().setlanguage("en-us").setValue("42");
LocalizedString seat = new LocalizedString().setDefaultValue(seatDefault);

SeatInfo seatInfo = new SeatInfo()
  .setGate(gate)
  .setSection(section)
  .setRow(row)
  .setSeat(seat);

// Define Wallet Object
eventTicketObject object = new eventTicketObject()
  .setClassId('2945482443380251551.ExampleeventTicketClass1')
    .setId('2945482443380251551.ExampleeventTicketObject1')
    .setBarcode(barcode)
    .setState("active")
    .setSeatInfo(seatInfo)
    .setTicketHolderName("Sir Bacon IV")
    .setTicketNumber("123abc");

PHP

$barcode = new Google_Service_Walletobjects_Barcode();
$barcode->setType('upcA');
$barcode->setValue('123456789012');
$barcode->setAlternateText('12345');

// Define Seat Info
$gateDefault = new LocalizedStringDefaultValue()
$gateDefault->setlanguage("en-us")
$gateDefault->setValue("A");
$gate = new LocalizedString();
$gate->setDefaultValue($gateDefault);

$sectionDefault = new LocalizedStringDefaultValue()
$sectionDefault->setlanguage("en-us")
$sectionDefault->setValue("5");
$section = new LocalizedString();
$section->setDefaultValue($sectionDefault);

$rowDefault = new LocalizedStringDefaultValue()
$rowDefault->setlanguage("en-us")
$rowDefault->setValue("G3");
$row = new LocalizedString();
$row->setDefaultValue($rowDefault);

$seatDefault = new LocalizedStringDefaultValue()
$seatDefault->setlanguage("en-us")
$seatDefault->setValue("42");
$seat = new LocalizedString();
$seat->setDefaultValue($seatDefault);

$seatInfo = new SeatInfo();
$seatInfo->setGate(gate);
$seatInfo->setSection(section);
$seatInfo->setRow(row);
$seatInfo->setSeat(seat);

// Create wallet object.
$eventTicketObject = new Google_Service_Walletobjects_eventTicketObject();
$eventTicketObject->setClassId('2945482443380251551.eventTicketClass');
$eventTicketObject->setId('2945482443380251551.eventTicketObject');
$eventTicketObject->setState('active');
$eventTicketObject->setBarcode($barcode);
$eventTicketObject->setSeatInfo($seatInfo);
$eventTicketObject->setTicketHolderName("Sir Bacon IV");
$eventTicketObject->setTicketNumber("123abc");

Python

eventTicket_object = {
    'kind': 'walletobjects#eventTicketObject',
    'classId': '1234567.ExampleEventTicketClass',
    'id': '1234567.ExampleEventTicketObject',
    'state': 'active',
    'barcode': {
        'kind': 'walletobjects#barcode',
        'type': 'upcA',
        'value': '123456789012',
        'alternateText': '12345'
    },
    "seatInfo": {
        "kind": "walletobjects#eventSeat",
        "seat": {
            "kind": "walletobjects#localizedString",
            "defaultValue": {
                "kind": "walletobjects#translatedString",
                "language": 'en-us',
                "value": '42'
            }
        },
        "row": {
            "kind": "walletobjects#localizedString",
            "defaultValue": {
                "kind": "walletobjects#translatedString",
                "language": 'en-us',
                "value": 'G3'
            }
        },
        "section": {
            "kind": "walletobjects#localizedString",
            "defaultValue": {
                "kind": "walletobjects#translatedString",
                "language": 'en-us',
                "value": '5'
            }
        },
        "gate": {
            "kind": "walletobjects#localizedString",
            "defaultValue": {
                "kind": "walletobjects#translatedString",
                "language": 'en-us',
                "value": 'A'
            }
        }
    },
    "ticketHolderName": 'Sir Bacon IV',
    "ticketNumber": '123abc',

}

EventTicketObject를 삽입하는 방법에는 두 가지가 있습니다.

첫 번째 방법은 다음 REST URI에 대해 POST 요청을 실행하는 것입니다(본문에 정의된 객체 포함).

https://walletobjects.googleapis.com/walletobjects/v1/eventTicketObject

두 번째 방법은 EventTicketObject 정의에서 JSON 웹 토큰(JWT)을 만들고 이 JWT를 Google Pay에 저장 버튼에 넣는 것입니다. 자세한 내용은 웹 버튼 추가를 참조하세요.

Android API를 사용하여 EventTicketObject 추가

현재 Android API를 사용하여 EventTicketObject를 추가할 수 없습니다.

JWT 링크 및 인텐트 사용에 설명된 대로 ACTION_VIEW 인텐트에서 JWT 링크를 호출하여 앱에서 REST API를 사용할 수 있습니다.

여러 참석자 저장 버튼

Google Pay에 저장 버튼 또는 웹링크 하나로 여러 개의 패스를 저장할 수 있습니다. 한 사용자가 단일 이벤트의 티켓을 여러 장 구매할 때 유용합니다.

여러 참석자를 저장하려면 서명할 JSON 웹 토큰(JWT)의 배열에 패스를 여러 개 포함시킵니다. 다음 예시에서는 여러 패스를 저장하는 버튼 만들기에 나와 있듯이 패스를 여러 장 저장하는 변형된 두 방법을 보여줍니다.

  1. 이 예시에서는 동일 그룹으로 분류되고 사전에 삽입된 이벤트 티켓 클래스 및 객체를 사용하며 각 객체의 ID만을 전송합니다. classId 속성은 선택사항입니다. 이 예시에서는 시연을 목적으로 표시됩니다. 이 예시에는 다른 클래스 ID가 사용됩니다.

    {
        "aud": "google",
        "origins": [
            "http://localhost:8080"
        ],
        "iss": "your_iam_account@appspot.gserviceaccount.com",
        "iat": 1536970285,
        "typ": "savetoandroidpay",
        "payload": {
            "eventTicketObjects": [
                {
                    "classId": "<my_issuer_id>.EventTicketClass_A",
                    "id": "<my_issuer_id>.EventTicketObject_A"
                },
                {
    	      //this is a different class, but has same class.eventId
                    "classId": "<my_issuer_id>.EventTicketClass_B",
                    "id": "<my_issuer_id>.EventTicketObject_B"
                }
            ]
        }
    }
  2. 이 예시에서는 클래스는 물론 클래스를 참조하는 여러 객체를 정의합니다. 사용자가 패스를 저장하면 클래스와 객체가 모두 삽입됩니다.

    {
        "aud": "google",
        "origins": [
            "http://localhost:8080"
        ],
        "iss": "your_iam_account@appspot.gserviceaccount.com",
        "iat": 1536970285,
        "typ": "savetoandroidpay",
        "payload": {
            "eventTicketClasses": [
              {
               "id": "<my_issuer_id>.EventTicketClass",
               "issuerName": "Baconrista Events",
               "reviewStatus": "underReview",
               "eventName": {
                "defaultValue": {
                 "language": "en-US",
                 "value": "Bacon Coffee Fun Event"
                }
               },
               "venue": {
                "name": {
                 "defaultValue": {
                  "language": "En-US",
                  "value": "1600 Amphitheatre Pkwy, Mountain View, CA 94043"
                 }
                },
                "address": {
                 "defaultValue": {
                  "language": "En-US",
                  "value": "1600 Amphitheatre Pkwy, Mountain View, CA 94043"
                 }
                }
               },
               "dateTime": {
                "doorsOpenLabel": "doorsOpen",
                "doorsOpen": "2027-04-12T19:20",
                "start": "2027-04-12T20:00",
                "end": "2027-04-12T21:20"
               }
              }
          ],
          "eventTicketObjects": [ {
            "classId": "<my_issuer_id>.EventTicketClass",
            "id": "<my_issuer_id>.EventTicketObject_1",
            "state": "active",
            },
            {
              "classId": "<my_issuer_id>.EventTicketClass",
              "id": "<my_issuer_id>.EventTicketObject_1",
              "state": "active",
            }
          ]
        }
    }