Updating an Item
The PUT
method allows you to make updates to a current wallet item, including updating points balances and sending notifications. To do so, you’ll need the wallet_id
of the campaign the item belongs to and the specific wallet_item_id
.
When will the end user see the update?
For any person records with Apple Wallet items, the update to the person’s device will occur automatically if the application is configured to support server-pushed updates (this is controlled by the person via the Passbook Mobile Application). The person is also able to manually request an update via the Passbook Mobile Application. For Persons with Google Pay items, the update to the Person’s device will occur automatically via Google Wallet web services.
Request Body
In the body of the request, you can redefine any values except for the wallet_item_id
, campaign_ref
, url
, provider
, created_at
, and updated_at
fields. If you’d like to remove a value from a field altogether, you can do so by setting the value to NULL. Any fields omitted in the body will be left as-is.
In the example below, we will demonstrate how to:
- Change the value in the end user’s wallet pass to 952
- Send an Apple Wallet notification
- Update the copy on a relevant location notification
Google Pay restrictions
Notifications for Google Pay are not currently supported. This can only be done on Apple Wallet.
{
"tokens": {
"loyalty_balance": "952",
"barcode_value": "494dd709-8cd1-4dfc-8886-04c8bb5aad12"
},
"locations": [
{
"latitude": 43.6867,
"longitude": -85.0102,
"relevant_text": "Redeem your points @ Sub Shop on Adams St!"
}
],
"passbook": {
"notification": "Your updated balance = 952!"
}
}
Update Dynamic Strip Image
The strip image is the main image for your wallet item. Just like other parts of the wallet, it can also be updated via an API PUT
call, which allows you to change what a user sees as their card. For example, you can use this call to upgrade an individual’s reward status or during seasonal promotions.
Before making this call, please reach out to your Vibes account representative to enable dynamic strip images for your wallet campaign.
Request Body
The field type specified in the body is IMAGE_CODE
(this must be in all caps). The value should be the IMAGE_CODE
field that you set when you adding the strip images to the template. To add additional images, you can use the update existing wallet template methods for both Android and iOS templates.
In the example below, we are changing the IMAGE_CODE
field value to insert a new holiday themed rewards image. This will only update the image for this particular pass holder, not for other passholders in this campaign.
{
"tokens": {
"IMAGE_CODE": "medium_tier_rewards_holiday",
"loyalty_balance": "952"
},
"locations": [
{
"latitude": 43.6867,
"longitude": -85.0102,
"relevant_text": "Redeem your points @ Sub Shop on Adams St!"
}
],
"passbook": {
"notification": "Your updated balance = 952!"
}
}
Mark Pass Passes as Redeemed or Expired
Although you can set static expiration dates in the Vibes platform or generate rolling expiration dates, you may want to remove pass scan functionality when a pass is redeemed in real time. To do so, simply use the PUT
method to set the expiration date to a date into the past.
On iOS, the barcode image will grey out, and text will appear beneath it that reads "this pass has expired". On Android, the pass will be moved into the expired pass section.
Request Body
In the request body, be sure to include the expiration_date
token and set the value to a date in the past, preferably the specific date or date/time the pass was utilized.
Please use ISO8601 format:: YYYY-MM-DD for date or YYYY-MM-DDTHH:MM:SS+0:00 for date/ and time.
Response
If the update was successful, a wallet item entity reflecting the new state of the item will be returned. You will also get an HTTP 200
status code.
If the wallet campaign or the wallet item cannot be found, an HTTP 404 - NOT FOUND
error will be returned.
iOS Expired Pass Example:
Android Expired Pass Example