-
- All Implemented Interfaces:
public class PaymentDataRequestJsonBuilder
This class provides methods to build com.google.android.gms.wallet.PaymentDataRequest in JSON format.
-
-
Field Summary
Fields Modifier and Type Field Description private JSONArray
allowedPaymentMethods
private JSONObject
transactionInfo
private Boolean
emailRequired
private Boolean
shippingAddressRequired
-
Method Summary
Modifier and Type Method Description PaymentDataRequestJsonBuilder
setAllowedPaymentMethods(@NonNull() JSONArray allowedPaymentMethods)
Required. PaymentDataRequestJsonBuilder
setTransactionInfo(@NonNull() JSONObject transactionInfo)
Required. PaymentDataRequestJsonBuilder
setEmailRequired(boolean emailRequired)
Optional. PaymentDataRequestJsonBuilder
setShippingAddressRequired(boolean shippingAddressRequired)
Optional. PaymentDataRequestJsonBuilder
setMerchantInfo(@NonNull() String merchantName)
Optional. PaymentDataRequestJsonBuilder
setShippingAddressParameters(@Nullable() JSONArray allowedCountryCodes, @Nullable() Boolean phoneNumberRequired)
Optional. JSONObject
toJson()
Returns the com.google.android.gms.wallet.PaymentDataRequest as JSONObject. -
-
Method Detail
-
setAllowedPaymentMethods
PaymentDataRequestJsonBuilder setAllowedPaymentMethods(@NonNull() JSONArray allowedPaymentMethods)
Required. Sets one or more payment methods supported by the Google Pay API and accepted by your app. See CardPaymentMethodJsonBuilder.
- Parameters:
allowedPaymentMethods
- The list of allowed payment methods.
-
setTransactionInfo
PaymentDataRequestJsonBuilder setTransactionInfo(@NonNull() JSONObject transactionInfo)
Required. Sets the details about the authorization of the transaction based upon whether the user agrees to the transaction or not. Includes total price and price status. See TransactionInfoJsonBuilder.
- Parameters:
transactionInfo
- The transaction info.
-
setEmailRequired
PaymentDataRequestJsonBuilder setEmailRequired(boolean emailRequired)
Optional. Sets if email is required.
- Parameters:
emailRequired
- Set totrue
to request an email address.
-
setShippingAddressRequired
PaymentDataRequestJsonBuilder setShippingAddressRequired(boolean shippingAddressRequired)
Optional. Sets if shipping address is required.
- Parameters:
shippingAddressRequired
- Set totrue
to request a full shipping address.
-
setMerchantInfo
PaymentDataRequestJsonBuilder setMerchantInfo(@NonNull() String merchantName)
Optional. Sets the information about the merchant that requests payment data.
- Parameters:
merchantName
- Merchant name encoded as UTF-8.
-
setShippingAddressParameters
PaymentDataRequestJsonBuilder setShippingAddressParameters(@Nullable() JSONArray allowedCountryCodes, @Nullable() Boolean phoneNumberRequired)
Optional. Sets shipping address restrictions.
- Parameters:
allowedCountryCodes
- ISO 3166-1 alpha-2 country code values of the countries where shipping is allowed.phoneNumberRequired
- Set totrue
if a phone number is required for the provided shipping address.
-
toJson
@NonNull() JSONObject toJson()
Returns the com.google.android.gms.wallet.PaymentDataRequest as JSONObject.
-
-
-
-