java.lang.Object | |
↳ | com.google.android.gms.wallet.PaymentDataRequest.Builder |
Builder to create a PaymentDataRequest
.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Adds an allowed payment method.
| |||||||||||
Adds a collection of allowed payment methods.
| |||||||||||
Sets the card requirements.
| |||||||||||
Sets whether buyer's email is required.
| |||||||||||
Sets payment method tokenization parameters which will be used to tokenize the payment method
returned within
getPaymentMethodToken() . | |||||||||||
Sets whether a phone number is additionally required from the buyer in both shipping and
billing addresses (the phone number will only be returned if an address is required,
otherwise this is a no-op).
| |||||||||||
Sets whether a shipping address is required from the buyer.
| |||||||||||
Sets the shipping address requirements.
| |||||||||||
Sets detailed transaction info.
| |||||||||||
Sets whether the UI to show the payment method or shipping address selection is required to
be shown in the purchase flow.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Adds an allowed payment method. See WalletConstants.PaymentMethod
for available
options.
Note that at least one allowed payment method must be explicitly set using either this
method or addAllowedPaymentMethods(Collection)
.
Parameters | |
---|---|
allowedPaymentMethod |
int |
Returns | |
---|---|
PaymentDataRequest.Builder |
Adds a collection of allowed payment methods. See WalletConstants.PaymentMethod
for
available options.
Note that at least one allowed payment method must be explicitly set using either this
method or addAllowedPaymentMethod(int)
.
Parameters | |
---|---|
allowedPaymentMethods |
Collection |
Returns | |
---|---|
PaymentDataRequest.Builder |
Returns | |
---|---|
PaymentDataRequest |
the actual PaymentDataRequest created using the data passed to the Builder
object.
|
Sets the card requirements.
This is a required field.
Parameters | |
---|---|
cardRequirements |
CardRequirements |
Returns | |
---|---|
PaymentDataRequest.Builder |
Sets whether buyer's email is required. If omitted, defaults to false.
Parameters | |
---|---|
emailRequired |
boolean |
Returns | |
---|---|
PaymentDataRequest.Builder |
Sets payment method tokenization parameters which will be used to tokenize the payment method
returned within getPaymentMethodToken()
.
This is an optional field. It should be set if the getPaymentMethodToken()
is required. Otherwise, it can be left unset and the
getPaymentMethodToken()
won't be returned.
When the getPaymentMethodToken()
is not required, this field should be
left unset to minimize latency. This will be the case for example if you only want to provide
a way for the buyer to change their payment selection when the UI is skipped during the
purchase flow (see setUiRequired(boolean)
).
Parameters | |
---|---|
paymentMethodTokenizationParameters |
PaymentMethodTokenizationParameters |
Returns | |
---|---|
PaymentDataRequest.Builder |
Sets whether a phone number is additionally required from the buyer in both shipping and billing addresses (the phone number will only be returned if an address is required, otherwise this is a no-op). If omitted, defaults to false.
Note that you should only request the phone number when it's required to process the order since it can increase friction during the checkout process and can lead to a lower conversion rate.
Parameters | |
---|---|
phoneNumberRequired |
boolean |
Returns | |
---|---|
PaymentDataRequest.Builder |
Sets whether a shipping address is required from the buyer. The returned shipping address
could be retrieved from getShippingAddress()
. If omitted, defaults to
false.
Optionally, when shipping address is required, extra requirements of the returned shipping
address could be set through setShippingAddressRequirements(ShippingAddressRequirements)
. If no requirements are set,
shipping addresses from all supported countries may be returned.
Parameters | |
---|---|
shippingAddressRequired |
boolean |
Returns | |
---|---|
PaymentDataRequest.Builder |
Sets the shipping address requirements. If omitted, shipping addresses from all supported countries may be returned.
Parameters | |
---|---|
shippingAddressRequirements |
ShippingAddressRequirements |
Returns | |
---|---|
PaymentDataRequest.Builder |
Sets detailed transaction info.
This field is required if getPaymentMethodToken()
is required. See
setPaymentMethodTokenizationParameters(PaymentMethodTokenizationParameters)
.
Parameters | |
---|---|
transactionInfo |
TransactionInfo |
Returns | |
---|---|
PaymentDataRequest.Builder |
Sets whether the UI to show the payment method or shipping address selection is required to be shown in the purchase flow. If omitted, defaults to true and the UI will always be shown.
When this is set to false, loadPaymentData(PaymentDataRequest)
will attempt to skip the
UI and directly return the data from the buyer's previous selection, if the following
conditions are met:
Note that even if all of the conditions above are met, UI may still be shown to the buyer (e.g. if an update to their selections is required or if further user authentication is needed).
When this is set to false, you should ensure the buyer can still change their selections within your app (e.g. providing an option on a confirmation page or on a settings page where this API can be called again with this field set to true).
Parameters | |
---|---|
uiRequired |
boolean |
Returns | |
---|---|
PaymentDataRequest.Builder |