## Background


You can now update objects and classes to include value added opportunity modules. Modules will be
displayed in the bottom section of the pass and can link to issuer content. This document walks through the
key steps required to enable and use modules using the Google Wallet API.

> [!NOTE]
> **Note:** For gift cards, loyalty cards, and offers we also support an automatic integration with [Shopping Merchant Center](https://www.google.com/retail/).

### Feature example

|---|---|
| ![Value Opportunity Module Single Example](https://developers.google.com/static/wallet/images/value-opportunity-single_android_expressive_passes.png) | ![Value Opportunity Module List Example](https://developers.google.com/static/wallet/images/value-opportunity-list_android_expressive_passes.png) |
| Single view | List view |

**The following guide assumes you are familiar with the basic concepts of Google Wallet and have already
completed the recommended
[prerequisites](https://developers.google.com/wallet/tickets/boarding-passes/getting-started/onboarding-guide).
Send any questions or feedback to your Google Wallet POC.**

## Integration Steps


To add a new module you will need to update the object and/or class to include
[ValueAddedModuleData](https://developers.google.com/wallet/tickets/boarding-passes/rest/v1/ValueAddedModuleData).
ValueAddedModuleData has the following fields:

### **\[Required\] LocalizedString header**

The header displayed on the module. Character limit is 60 and longer strings will be truncated. ![Value Opportunity Header Example](https://developers.google.com/static/wallet/images/value-opportunity-header_android_expressive_passes.png)  

### **LocalizedString body**

The body displayed on the module. Character limit is 50 and longer strings will be truncated.  
![Value Opportunity Body Example](https://developers.google.com/static/wallet/images/value-opportunity-body_android_expressive_passes.png)  

### **Image image**

The image displayed on the module. The recommended image ratio is 1:1 and images will be resized to fit this ratio.  
![Value Opportunity Image Example](https://developers.google.com/static/wallet/images/value-opportunity-image_android_expressive_passes.png)  

### **\[Required\] string uri**

The URI that the module leads to when clicked. This can be a web link or a [deep link.](https://developer.android.com/training/app-links/deep-linking).  

### **ModuleViewConstraints viewConstraints**

Constraints that all must be met for the module to be shown. ModuleViewConstraints has the following field:  

### **TimeInterval displayInterval**

The period of time that the module will be displayed to users. Can define both a \`startTime\` and \`endTime\`. The module is displayed immediately after insertion unless a \`startTime\` is set. The module is displayed indefinitely if \`endTime\` is not set.  

### **int32 sortIndex**

The index for sorting the modules. Modules with a lower sort index are shown before modules with a higher sort index. If unspecified, the sort index is assumed to be INT_MAX. For two modules with the same index, the sorting behavior is undefined.  

### **Example ValueAddedModuleData:**

```
  {
    "valueAddedModuleData": [
      {
        "header": {
          "defaultValue": {
            "language": "en-US",
            "value": "10% off merch"
          }
        },
        "body": {
          "defaultValue": {
            "language": "en-US",
            "value": "Shirts, caps, mugs, and more"
          }
        },
        "image": {
          "sourceUri": {
            "uri": "http://www.images.google.com/opportunity"
          }
        },
        "uri": "http://www.google.com/opportunity",
        "viewConstraints": {
          "displayInterval": {
            "start": {
              "date": "2024-08-01T18:30:00"
            },
            "end": {
              "date": "2025-08-01T18:30:00"
            }
          }
        },
        "sortIndex": 0
      },
      {
        "header": {
          "defaultValue": {
            "language": "en-US",
            "value": "10% off concessions"
          }
        },
        "uri": "http://www.google.com/new_opportunity"
      }
    ]
  }
```

> [!IMPORTANT]
> **Note:** You can add up to fifteen modules to the object and up to fifteen modules in the class. However, a max of fifteen modules will be displayed on the pass. We will prioritize the modules from the object filtering out those that don't meet the view constraints.

## Expected Behavior


After successfully updating the object and/or class you will now see modules on the corresponding
pass. If you have added only one module you will see it on the front of the pass.  

## Guidelines on Value Added Opportunity Modules


Modules are opportunities for you to augment your user's pass experience with additional actions.
You should consider the following when creating and managing the modules:

- Modules should be defined with appropriate language to indicate that they are actionable to help users understand that these modules are clickable.
- Modules should have the appropriate imagery defined that is related to the specific module.
- You are in control of the modules and should proactively manage the prioritization of the module depending on the importance and relevance.
- You should only show users modules that are active. You can control this by setting the displayInterval on the module or proactively adding or removing it from the class or object.

## Exception handling

| **Message** | **Reason** |
|---|---|
| ValueAddedModuleData must contain a header. | ValueAddedModuleData does not have a header. |
| ValueAddedModuleData must contain a non-empty URI. | ValueAddedModuleData does not have a non-empty URI. |
| A maximum of 15 value added modules are allowed per class. | Need to reduce value added modules on the class. |
| A maximum of 15 value added modules are allowed per object. | Need to reduce value added modules on the object. |