Google Pay Button
Convenience view that wraps Google's PayButton
This view provides all styling and customization options provided by Google's PayButton but also adds the following extra functionality:
Styling via XML attributes
Use of android:onClick attribute in XML files
Ability to update button options after view creation
Important:
It is possible to use Google's PayButton directly. However, when doing so it is important to ensure that your app uses the same version of com.google.android.gms:play-services-wallet
as the Olo Pay SDK. Version mismatches could cause unexpected behavior.
Styling
This view provides all styling options provided by Google's PayButton. Styling can be done via XML attributes, or by calling updateButton.
XML attributes can be set directly on the view or they can be defined in a style that gets applied to the view. THe following examples each produce the same result:
Customizations applied directly to the view:
// NOTE: This example assumes a namespace definition of `app`. Replace
// this with your own namespace qualifier if using something different
<com.olo.olopay.googlepay.GooglePayButton
app:googlePayButtonTheme="dark"
app:googlePayButtonType="checkout"
app:googlePayCornerRadius="4dp"
/>
Customizations applied in a style:
// Style definition
<style name="GooglePayButtonStyle">
<item name="googlePayButtonTheme">dark</item>
<item name="googlePayButtonType">checkout</item>
<item name="googlePayCornerRadius">4dp</item>
</style>
//Layout file
<com.olo.olopay.googlepay.GooglePayButton
style="@style/GooglePayButtonStyle"
/>
Constructors
Creates a new instance of GooglePayButton. Default styling uses ButtonConstants.ButtonTheme.DARK, ButtonConstants.ButtonType.CHECKOUT, and a corner radius of 8dp