Class PaymentDataRequestJsonBuilder
-
- All Implemented Interfaces:
public class PaymentDataRequestJsonBuilderThis class provides methods to build com.google.android.gms.wallet.PaymentDataRequest in JSON format.
-
-
Constructor Summary
Constructors Constructor Description PaymentDataRequestJsonBuilder()
-
Method Summary
Modifier and Type Method Description PaymentDataRequestJsonBuildersetMerchantInfo(@NonNull() String merchantName)Optional. PaymentDataRequestJsonBuildersetEmailRequired(boolean emailRequired)Optional. PaymentDataRequestJsonBuildersetShippingAddressRequired(boolean shippingAddressRequired)Optional. PaymentDataRequestJsonBuildersetShippingAddressParameters(@Nullable() JSONArray allowedCountryCodes, @Nullable() Boolean phoneNumberRequired)Optional. JSONObjecttoJson()Returns the com.google.android.gms.wallet.PaymentDataRequest as JSONObject. PaymentDataRequestJsonBuildersetAllowedPaymentMethods(@NonNull() JSONArray allowedPaymentMethods)Required. PaymentDataRequestJsonBuildersetTransactionInfo(@NonNull() JSONObject transactionInfo)Required. -
-
Method Detail
-
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.- Returns:
a reference to this object.
-
setEmailRequired
PaymentDataRequestJsonBuilder setEmailRequired(boolean emailRequired)
Optional. Sets if email is required.
- Parameters:
emailRequired- Set totrueto request an email address.- Returns:
a reference to this object.
-
setShippingAddressRequired
PaymentDataRequestJsonBuilder setShippingAddressRequired(boolean shippingAddressRequired)
Optional. Sets if shipping address is required.
- Parameters:
shippingAddressRequired- Set totrueto request a full shipping address.- Returns:
a reference to this object.
-
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 totrueif a phone number is required for the provided shipping address.- Returns:
a reference to this object.
-
toJson
@NonNull() JSONObject toJson()
Returns the com.google.android.gms.wallet.PaymentDataRequest as JSONObject.
- Returns:
the payment data request JSON.
-
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.- Returns:
a reference to this object.
-
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.- Returns:
a reference to this object.
-
-
-
-