This is the web component for the Save to Google Pay button. This component can be used in standard HTML websites as well as websites built with many popular JavaScript frameworks.
Note that React and Angular developers should use the @google-pay/save-button-react
and
@google-pay/save-button-angular
versions of this component.
npm install @google-pay/save-button-element
<save-to-google-pay-button jwt="eyJhbGci...7_eD2kT3_IuHxw" height="standard" textsize="large">
</save-to-google-pay-button>
An HTML example can be found in the examples folder of this repository.
The Vue example is very similar to the HTML version above. An example can be found in the examples folder of this repository.
Additional examples included:
Property | Type | Remarks |
---|---|---|
jwt |
|
Required. Google Pay API for Passes Json Web Token (JWT) used to save the loyalty pass to Google Pay. A JWT can be generated by following the instructions at the Save passes to Google Pay page. |
height |
|
Optional. Height of button to display. Possible values are: Default value |
size |
|
Optional. Width of button to display. You can set Default value |
textsize |
|
Optional. When Default value |
theme |
|
Optional. Theme of button to display. Possible values are: Default value |
Callback | Remarks |
---|---|
onSuccess |
A callback function that is invoked when the user successfully saves the pass to their account. Also raised as event |
onFailure |
A callback that is invoked when an error occurs in the process of saving the pass. The first paramemer is a Also raised as event |
onProvideJwt |
A callback function that can be used to intercept and potentially manipulate the JWT before the pass is saved to Google Pay. This function must return a |
Visit the Google Pay API for Passes for Web API Reference for more information about integrating the different button properties.
Note that this folder does not contain a package.json
file. The package.json
file is generated during the build
process using the package-template.json
where the version number is read from the package.json
file defined in the root of this repository.