만료된 포인트 카드
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
패스를 만료된 패스로 설정하면 Google 월렛 앱에서 만료된 모든 패스를 논리적으로 그룹화합니다.
'패스' 아래에 있는 모든 패스 탭 '만료된 패스'가 있습니다. 섹션의
보관처리된 패스 또는 비활성 패스가 모두 포함된 Google 월렛 앱
패스가 '만료된 패스'로 이동합니다. 섹션에 다음 중 하나 이상이 있는 경우
참입니다.
object.validTimeInterval.end.date
가 만료되면 패스가 다음으로 이동합니다.
'만료된 패스' 최대 24시간 후 언제든지 변경할 수 있습니다
- 객체
object.state
필드의 상태가 Expired
로 표시됩니다.
Inactive
또는 Completed
입니다.
다음 코드 샘플은 Google
월렛 API
자바
Java에서 통합을 시작하려면 전체
<ph type="x-smartling-placeholder"></ph>
코드 샘플을 확인하세요.
/**
* Expire an object.
*
* <p>Sets the object's state to Expired. If the valid time interval is already set, the pass will
* expire automatically up to 24 hours after.
*
* @param issuerId The issuer ID being used for this request.
* @param objectSuffix Developer-defined unique ID for this pass object.
* @return The pass object ID: "{issuerId}.{objectSuffix}"
*/
public String expireObject(String issuerId, String objectSuffix) throws IOException {
// Check if the object exists
try {
service.loyaltyobject().get(String.format("%s.%s", issuerId, objectSuffix)).execute();
} catch (GoogleJsonResponseException ex) {
if (ex.getStatusCode() == 404) {
// Object does not exist
System.out.printf("Object %s.%s not found!%n", issuerId, objectSuffix);
return String.format("%s.%s", issuerId, objectSuffix);
} else {
// Something else went wrong...
ex.printStackTrace();
return String.format("%s.%s", issuerId, objectSuffix);
}
}
// Patch the object, setting the pass as expired
LoyaltyObject patchBody = new LoyaltyObject().setState("EXPIRED");
LoyaltyObject response =
service
.loyaltyobject()
.patch(String.format("%s.%s", issuerId, objectSuffix), patchBody)
.execute();
System.out.println("Object expiration response");
System.out.println(response.toPrettyString());
return response.getId();
}
PHP
PHP에서 통합을 시작하려면 전체
<ph type="x-smartling-placeholder"></ph>
코드 샘플을 확인하세요.
/**
* Expire an object.
*
* Sets the object's state to Expired. If the valid time interval is
* already set, the pass will expire automatically up to 24 hours after.
*
* @param string $issuerId The issuer ID being used for this request.
* @param string $objectSuffix Developer-defined unique ID for this pass object.
*
* @return string The pass object ID: "{$issuerId}.{$objectSuffix}"
*/
public function expireObject(string $issuerId, string $objectSuffix)
{
// Check if the object exists
try {
$this->service->loyaltyobject->get("{$issuerId}.{$objectSuffix}");
} catch (Google\Service\Exception $ex) {
if (!empty($ex->getErrors()) && $ex->getErrors()[0]['reason'] == 'resourceNotFound') {
print("Object {$issuerId}.{$objectSuffix} not found!");
return "{$issuerId}.{$objectSuffix}";
} else {
// Something else went wrong...
print_r($ex);
return "{$issuerId}.{$objectSuffix}";
}
}
// Patch the object, setting the pass as expired
$patchBody = new LoyaltyObject([
'state' => 'EXPIRED'
]);
$response = $this->service->loyaltyobject->patch("{$issuerId}.{$objectSuffix}", $patchBody);
print "Object expiration response\n";
print_r($response);
return $response->id;
}
Python
Python에서 통합을 시작하려면 전체
<ph type="x-smartling-placeholder"></ph>
코드 샘플을 확인하세요.
def expire_object(self, issuer_id: str, object_suffix: str) -> str:
"""Expire an object.
Sets the object's state to Expired. If the valid time interval is
already set, the pass will expire automatically up to 24 hours after.
Args:
issuer_id (str): The issuer ID being used for this request.
object_suffix (str): Developer-defined unique ID for the pass object.
Returns:
The pass object ID: f"{issuer_id}.{object_suffix}"
"""
# Check if the object exists
try:
response = self.client.loyaltyobject().get(resourceId=f'{issuer_id}.{object_suffix}').execute()
except HttpError as e:
if e.status_code == 404:
print(f'Object {issuer_id}.{object_suffix} not found!')
return f'{issuer_id}.{object_suffix}'
else:
# Something else went wrong...
print(e.error_details)
return f'{issuer_id}.{object_suffix}'
# Patch the object, setting the pass as expired
patch_body = {'state': 'EXPIRED'}
response = self.client.loyaltyobject().patch(
resourceId=f'{issuer_id}.{object_suffix}',
body=patch_body).execute()
print('Object expiration response')
print(response)
return f'{issuer_id}.{object_suffix}'
C#
C#에서 통합을 시작하려면 전체
<ph type="x-smartling-placeholder"></ph>
코드 샘플을 확인하세요.
/// <summary>
/// Expire an object.
/// <para />
/// Sets the object's state to Expired. If the valid time interval is already
/// set, the pass will expire automatically up to 24 hours after.
/// </summary>
/// <param name="issuerId">The issuer ID being used for this request.</param>
/// <param name="objectSuffix">Developer-defined unique ID for this pass object.</param>
/// <returns>The pass object ID: "{issuerId}.{objectSuffix}"</returns>
public string ExpireObject(string issuerId, string objectSuffix)
{
// Check if the object exists
Stream responseStream = service.Loyaltyobject
.Get($"{issuerId}.{objectSuffix}")
.ExecuteAsStream();
StreamReader responseReader = new StreamReader(responseStream);
JObject jsonResponse = JObject.Parse(responseReader.ReadToEnd());
if (jsonResponse.ContainsKey("error"))
{
if (jsonResponse["error"].Value<int>("code") == 404)
{
// Object does not exist
Console.WriteLine($"Object {issuerId}.{objectSuffix} not found!");
return $"{issuerId}.{objectSuffix}";
}
else
{
// Something else went wrong...
Console.WriteLine(jsonResponse.ToString());
return $"{issuerId}.{objectSuffix}";
}
}
// Patch the object, setting the pass as expired
LoyaltyObject patchBody = new LoyaltyObject
{
State = "EXPIRED"
};
responseStream = service.Loyaltyobject
.Patch(patchBody, $"{issuerId}.{objectSuffix}")
.ExecuteAsStream();
responseReader = new StreamReader(responseStream);
jsonResponse = JObject.Parse(responseReader.ReadToEnd());
Console.WriteLine("Object expiration response");
Console.WriteLine(jsonResponse.ToString());
return $"{issuerId}.{objectSuffix}";
}
Node.js
노드에서 통합을 시작하려면 전체
<ph type="x-smartling-placeholder"></ph>
코드 샘플을 확인하세요.
/**
* Expire an object.
*
* Sets the object's state to Expired. If the valid time interval is
* already set, the pass will expire automatically up to 24 hours after.
*
* @param {string} issuerId The issuer ID being used for this request.
* @param {string} objectSuffix Developer-defined unique ID for the pass object.
*
* @returns {string} The pass object ID: `${issuerId}.${objectSuffix}`
*/
async expireObject(issuerId, objectSuffix) {
let response;
// Check if the object exists
try {
response = await this.client.loyaltyobject.get({
resourceId: `${issuerId}.${objectSuffix}`
});
} catch (err) {
if (err.response && err.response.status === 404) {
console.log(`Object ${issuerId}.${objectSuffix} not found!`);
return `${issuerId}.${objectSuffix}`;
} else {
// Something else went wrong...
console.log(err);
return `${issuerId}.${objectSuffix}`;
}
}
// Patch the object, setting the pass as expired
let patchBody = {
'state': 'EXPIRED'
};
response = await this.client.loyaltyobject.patch({
resourceId: `${issuerId}.${objectSuffix}`,
requestBody: patchBody
});
console.log('Object expiration response');
console.log(response);
return `${issuerId}.${objectSuffix}`;
}
Go
Go에서 통합을 시작하려면 GitHub의 전체 코드 샘플을 참고하세요.
<ph type="x-smartling-placeholder"></ph>
코드 샘플을 확인하세요.
// Expire an object.
//
// Sets the object's state to Expired. If the valid time interval is
// already set, the pass will expire automatically up to 24 hours after.
func (d *demoLoyalty) expireObject(issuerId, objectSuffix string) {
loyaltyObject := &walletobjects.LoyaltyObject{
State: "EXPIRED",
}
res, err := d.service.Loyaltyobject.Patch(fmt.Sprintf("%s.%s", issuerId, objectSuffix), loyaltyObject).Do()
if err != nil {
log.Fatalf("Unable to patch object: %v", err)
} else {
fmt.Printf("Object expiration id:\n%s\n", res.Id)
}
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-29(UTC)
[null,null,["최종 업데이트: 2025-08-29(UTC)"],[[["\u003cp\u003eExpired passes are grouped within the "Expired passes" section of the Google Wallet app, which can be found under the "Passes" tab.\u003c/p\u003e\n"],["\u003cp\u003eA pass is considered expired when its \u003ccode\u003eobject.validTimeInterval.end.date\u003c/code\u003e has passed or its \u003ccode\u003eobject.state\u003c/code\u003e is set to \u003ccode\u003eExpired\u003c/code\u003e, \u003ccode\u003eInactive\u003c/code\u003e, or \u003ccode\u003eCompleted\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis page provides code samples in various programming languages (Java, PHP, Python, C#, Node.js, and Go) to demonstrate how to expire a pass object using the Google Wallet API.\u003c/p\u003e\n"]]],["Expired passes are grouped under the \"Expired passes\" section in the Google Wallet app. A pass expires if its `validTimeInterval.end.date` expires (within 24 hours) or if its `object.state` is set to `Expired`, `Inactive`, or `Completed`. To expire a pass via the API, you patch the object, setting its `state` to `EXPIRED`, using the issuer ID and object suffix to locate it. If the object is not found, the corresponding message is printed.\n"],null,["# Expired Loyalty cards\n\nIf you set passes as expired, the Google Wallet app logically groups all expired\npasses under the \"Passes\" tab. There's an \"Expired passes\" section in the\nGoogle Wallet app that contains all archived or inactive passes.\n\nA pass is moved to the \"Expired passes\" section if at least one of the following\nconditions is true:\n\n- When the `object.validTimeInterval.end.date` expires the pass moves to \"Expired passes\" anytime up to 24 hours after.\n- The state of the object `object.state` field is marked as `Expired`, `Inactive`, or `Completed`.\n\nThe following code sample demonstrates expiring a pass object using the Google\nWallet API. \n\n### Java\n\n\nTo start your integration in Java, refer to our complete\n[code samples on GitHub](https://github.com/google-wallet/rest-samples/tree/main/java). \n\n```java\n/**\n * Expire an object.\n *\n * \u003cp\u003eSets the object's state to Expired. If the valid time interval is already set, the pass will\n * expire automatically up to 24 hours after.\n *\n * @param issuerId The issuer ID being used for this request.\n * @param objectSuffix Developer-defined unique ID for this pass object.\n * @return The pass object ID: \"{issuerId}.{objectSuffix}\"\n */\npublic String expireObject(String issuerId, String objectSuffix) throws IOException {\n // Check if the object exists\n try {\n service.loyaltyobject().get(String.format(\"%s.%s\", issuerId, objectSuffix)).execute();\n } catch (GoogleJsonResponseException ex) {\n if (ex.getStatusCode() == 404) {\n // Object does not exist\n System.out.printf(\"Object %s.%s not found!%n\", issuerId, objectSuffix);\n return String.format(\"%s.%s\", issuerId, objectSuffix);\n } else {\n // Something else went wrong...\n ex.printStackTrace();\n return String.format(\"%s.%s\", issuerId, objectSuffix);\n }\n }\n\n // Patch the object, setting the pass as expired\n LoyaltyObject patchBody = new LoyaltyObject().setState(\"EXPIRED\");\n\n LoyaltyObject response =\n service\n .loyaltyobject()\n .patch(String.format(\"%s.%s\", issuerId, objectSuffix), patchBody)\n .execute();\n\n System.out.println(\"Object expiration response\");\n System.out.println(response.toPrettyString());\n\n return response.getId();\n}\n```\n\n### PHP\n\n\nTo start your integration in PHP, refer to our complete\n[code samples on GitHub](https://github.com/google-wallet/rest-samples/tree/main/php). \n\n```php\n/**\n * Expire an object.\n *\n * Sets the object's state to Expired. If the valid time interval is\n * already set, the pass will expire automatically up to 24 hours after.\n *\n * @param string $issuerId The issuer ID being used for this request.\n * @param string $objectSuffix Developer-defined unique ID for this pass object.\n *\n * @return string The pass object ID: \"{$issuerId}.{$objectSuffix}\"\n */\npublic function expireObject(string $issuerId, string $objectSuffix)\n{\n // Check if the object exists\n try {\n $this-\u003eservice-\u003eloyaltyobject-\u003eget(\"{$issuerId}.{$objectSuffix}\");\n } catch (Google\\Service\\Exception $ex) {\n if (!empty($ex-\u003egetErrors()) && $ex-\u003egetErrors()[0]['reason'] == 'resourceNotFound') {\n print(\"Object {$issuerId}.{$objectSuffix} not found!\");\n return \"{$issuerId}.{$objectSuffix}\";\n } else {\n // Something else went wrong...\n print_r($ex);\n return \"{$issuerId}.{$objectSuffix}\";\n }\n }\n\n // Patch the object, setting the pass as expired\n $patchBody = new LoyaltyObject([\n 'state' =\u003e 'EXPIRED'\n ]);\n\n $response = $this-\u003eservice-\u003eloyaltyobject-\u003epatch(\"{$issuerId}.{$objectSuffix}\", $patchBody);\n\n print \"Object expiration response\\n\";\n print_r($response);\n\n return $response-\u003eid;\n}\n```\n\n### Python\n\n\nTo start your integration in Python, refer to our complete\n[code samples on GitHub](https://github.com/google-wallet/rest-samples/tree/main/python). \n\n```python\ndef expire_object(self, issuer_id: str, object_suffix: str) -\u003e str:\n \"\"\"Expire an object.\n\n Sets the object's state to Expired. If the valid time interval is\n already set, the pass will expire automatically up to 24 hours after.\n\n Args:\n issuer_id (str): The issuer ID being used for this request.\n object_suffix (str): Developer-defined unique ID for the pass object.\n\n Returns:\n The pass object ID: f\"{issuer_id}.{object_suffix}\"\n \"\"\"\n\n # Check if the object exists\n try:\n response = self.client.loyaltyobject().get(resourceId=f'{issuer_id}.{object_suffix}').execute()\n except HttpError as e:\n if e.status_code == 404:\n print(f'Object {issuer_id}.{object_suffix} not found!')\n return f'{issuer_id}.{object_suffix}'\n else:\n # Something else went wrong...\n print(e.error_details)\n return f'{issuer_id}.{object_suffix}'\n\n # Patch the object, setting the pass as expired\n patch_body = {'state': 'EXPIRED'}\n\n response = self.client.loyaltyobject().patch(\n resourceId=f'{issuer_id}.{object_suffix}',\n body=patch_body).execute()\n\n print('Object expiration response')\n print(response)\n\n return f'{issuer_id}.{object_suffix}'\n```\n\n### C#\n\n\nTo start your integration in C#, refer to our complete\n[code samples on GitHub](https://github.com/google-wallet/rest-samples/tree/main/dotnet). \n\n```c#\n/// \u003csummary\u003e\n/// Expire an object.\n/// \u003cpara /\u003e\n/// Sets the object's state to Expired. If the valid time interval is already\n/// set, the pass will expire automatically up to 24 hours after.\n/// \u003c/summary\u003e\n/// \u003cparam name=\"issuerId\"\u003eThe issuer ID being used for this request.\u003c/param\u003e\n/// \u003cparam name=\"objectSuffix\"\u003eDeveloper-defined unique ID for this pass object.\u003c/param\u003e\n/// \u003creturns\u003eThe pass object ID: \"{issuerId}.{objectSuffix}\"\u003c/returns\u003e\npublic string ExpireObject(string issuerId, string objectSuffix)\n{\n // Check if the object exists\n Stream responseStream = service.Loyaltyobject\n .Get($\"{issuerId}.{objectSuffix}\")\n .ExecuteAsStream();\n\n StreamReader responseReader = new StreamReader(responseStream);\n JObject jsonResponse = JObject.Parse(responseReader.ReadToEnd());\n\n if (jsonResponse.ContainsKey(\"error\"))\n {\n if (jsonResponse[\"error\"].Value\u003cint\u003e(\"code\") == 404)\n {\n // Object does not exist\n Console.WriteLine($\"Object {issuerId}.{objectSuffix} not found!\");\n return $\"{issuerId}.{objectSuffix}\";\n }\n else\n {\n // Something else went wrong...\n Console.WriteLine(jsonResponse.ToString());\n return $\"{issuerId}.{objectSuffix}\";\n }\n }\n\n // Patch the object, setting the pass as expired\n LoyaltyObject patchBody = new LoyaltyObject\n {\n State = \"EXPIRED\"\n };\n\n responseStream = service.Loyaltyobject\n .Patch(patchBody, $\"{issuerId}.{objectSuffix}\")\n .ExecuteAsStream();\n\n responseReader = new StreamReader(responseStream);\n jsonResponse = JObject.Parse(responseReader.ReadToEnd());\n\n Console.WriteLine(\"Object expiration response\");\n Console.WriteLine(jsonResponse.ToString());\n\n return $\"{issuerId}.{objectSuffix}\";\n}\n```\n\n### Node.js\n\n\nTo start your integration in Node, refer to our complete\n[code samples on GitHub](https://github.com/google-wallet/rest-samples/tree/main/nodejs). \n\n```javascript\n/**\n * Expire an object.\n *\n * Sets the object's state to Expired. If the valid time interval is\n * already set, the pass will expire automatically up to 24 hours after.\n *\n * @param {string} issuerId The issuer ID being used for this request.\n * @param {string} objectSuffix Developer-defined unique ID for the pass object.\n *\n * @returns {string} The pass object ID: `${issuerId}.${objectSuffix}`\n */\nasync expireObject(issuerId, objectSuffix) {\n let response;\n\n // Check if the object exists\n try {\n response = await this.client.loyaltyobject.get({\n resourceId: `${issuerId}.${objectSuffix}`\n });\n } catch (err) {\n if (err.response && err.response.status === 404) {\n console.log(`Object ${issuerId}.${objectSuffix} not found!`);\n return `${issuerId}.${objectSuffix}`;\n } else {\n // Something else went wrong...\n console.log(err);\n return `${issuerId}.${objectSuffix}`;\n }\n }\n\n // Patch the object, setting the pass as expired\n let patchBody = {\n 'state': 'EXPIRED'\n };\n\n response = await this.client.loyaltyobject.patch({\n resourceId: `${issuerId}.${objectSuffix}`,\n requestBody: patchBody\n });\n\n console.log('Object expiration response');\n console.log(response);\n\n return `${issuerId}.${objectSuffix}`;\n}\n```\n\n### Go\n\n\nTo start your integration in Go, refer to our complete code samples on GitHub\n[code samples on Github](https://github.com/google-wallet/rest-samples/tree/main/go). \n\n```go\n// Expire an object.\n//\n// Sets the object's state to Expired. If the valid time interval is\n// already set, the pass will expire automatically up to 24 hours after.\nfunc (d *demoLoyalty) expireObject(issuerId, objectSuffix string) {\n\tloyaltyObject := &walletobjects.LoyaltyObject{\n\t\tState: \"EXPIRED\",\n\t}\n\tres, err := d.service.Loyaltyobject.Patch(fmt.Sprintf(\"%s.%s\", issuerId, objectSuffix), loyaltyObject).Do()\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to patch object: %v\", err)\n\t} else {\n\t\tfmt.Printf(\"Object expiration id:\\n%s\\n\", res.Id)\n\t}\n}\n```"]]