Android "loadMaskedWallet" 支付错误
Android Pay Error in "loadMaskedWallet"
我正在尝试使用 Android Pay 进行测试付款。到目前为止,我已经根据这个 answer 配置了我的设备进行测试,我已经在我设备的 Android 应用程序中配置了一张卡,并基于此代码:
Wallet.Payments.isReadyToPay(mGoogleApiClient, IsReadyToPayRequest.newBuilder()
.addAllowedCardNetwork(WalletConstants.CardNetwork.VISA)
.addAllowedCardNetwork(WalletConstants.CardNetwork.MASTERCARD)
.build())
.setResultCallback(
booleanResult -> {
if (booleanResult.getStatus().isSuccess()) { // says true
...
我已经根据 google code lab
中的这些指南构建了我的示例
private void initGoogleApi() {
mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
.addOnConnectionFailedListener(this)
.enableAutoManage(getActivity(),0, this)
.addApi(Wallet.API, new Wallet.WalletOptions.Builder()
.setEnvironment(WalletConstants.ENVIRONMENT_TEST)
.setTheme(WalletConstants.THEME_LIGHT)
.build())
.build();
}
然后:
private void initAndroidPayView() {
mWalletFragment = (SupportWalletFragment) getActivity().getSupportFragmentManager()
.findFragmentByTag(WALLET_FRAGMENT_ID);
if (mWalletFragment == null) {
// Wallet fragment style
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(WalletFragmentStyle.BuyButtonText.BUY_WITH)
.setBuyButtonWidth(WalletFragmentStyle.Dimension.MATCH_PARENT);
// Wallet fragment options
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(WalletConstants.ENVIRONMENT_TEST)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_DARK)
.setMode(WalletFragmentMode.BUY_BUTTON)
.build();
// Initialize the WalletFragment
WalletFragmentInitParams.Builder startParamsBuilder =
WalletFragmentInitParams.newBuilder()
.setMaskedWalletRequest(generateMaskedWalletRequest())
.setMaskedWalletRequestCode(MASKED_WALLET_REQUEST_CODE);
//.setAccountName("Google I/O Codelab");//https://developers.google.com/android/reference/com/google/android/gms/wallet/fragment/WalletFragmentInitParams.Builder
mWalletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
mWalletFragment.initialize(startParamsBuilder.build());
// Add the WalletFragment to the UI
getActivity().getSupportFragmentManager().beginTransaction()
.replace(R.id.androidPayContainer, mWalletFragment, WALLET_FRAGMENT_ID)
.commit();
}
}
我正在使用
PaymentMethodTokenizationType.NETWORK_TOKEN
并且我生成了 github 存储库
中所写的公钥
现在,当我付款时,我在 onActivityResult 中收到此错误代码:10
在设备中我只看到这条错误消息:
Request Failed An unexpected error has occurred. Please try again later.
当我在错误对话框中按确定时,我得到了这个日志:
06-01 12:18:05.739 11386 11386 W WalletMerchantError: Error in
loadMaskedWallet: Did you forget the set Android Pay testing
environment to PROD?
我也尝试将变量更改为 Production,但仍然出现相同的错误。
有没有人有任何解决方案或者我真的必须稍后再试?
如果您尝试使用 ENVIRONMENT_TEST
,请确保您已按照 Setup Android Pay 中概述的步骤进行操作。具体来说,请确保您的 AndroidManifest.xml 包含以下位:
<application
...
<!-- Enables the Android Pay API -->
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>
如果您觉得您的应用已准备就绪并正在尝试使用 ENVIRONMENT_PRODUCTION
,那么还有一些步骤 outlined here。
根据 Github
上发布的这个问题
https://github.com/android-pay/androidpay-quickstart/issues/31
和其他联系人有沙盒模式异常,测试卡至少在欧洲不起作用。
问题的答案还包含一个替代解决方案。
Issue: test cards (even the one provided by Google) don't work anymore
(at least not outside of US);
Solution: you need real card to make it
work. You won't be charged with ENVIRONMENT_TEST.
我正在尝试使用 Android Pay 进行测试付款。到目前为止,我已经根据这个 answer 配置了我的设备进行测试,我已经在我设备的 Android 应用程序中配置了一张卡,并基于此代码:
Wallet.Payments.isReadyToPay(mGoogleApiClient, IsReadyToPayRequest.newBuilder()
.addAllowedCardNetwork(WalletConstants.CardNetwork.VISA)
.addAllowedCardNetwork(WalletConstants.CardNetwork.MASTERCARD)
.build())
.setResultCallback(
booleanResult -> {
if (booleanResult.getStatus().isSuccess()) { // says true
...
我已经根据 google code lab
中的这些指南构建了我的示例private void initGoogleApi() {
mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
.addOnConnectionFailedListener(this)
.enableAutoManage(getActivity(),0, this)
.addApi(Wallet.API, new Wallet.WalletOptions.Builder()
.setEnvironment(WalletConstants.ENVIRONMENT_TEST)
.setTheme(WalletConstants.THEME_LIGHT)
.build())
.build();
}
然后:
private void initAndroidPayView() {
mWalletFragment = (SupportWalletFragment) getActivity().getSupportFragmentManager()
.findFragmentByTag(WALLET_FRAGMENT_ID);
if (mWalletFragment == null) {
// Wallet fragment style
WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
.setBuyButtonText(WalletFragmentStyle.BuyButtonText.BUY_WITH)
.setBuyButtonWidth(WalletFragmentStyle.Dimension.MATCH_PARENT);
// Wallet fragment options
WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
.setEnvironment(WalletConstants.ENVIRONMENT_TEST)
.setFragmentStyle(walletFragmentStyle)
.setTheme(WalletConstants.THEME_DARK)
.setMode(WalletFragmentMode.BUY_BUTTON)
.build();
// Initialize the WalletFragment
WalletFragmentInitParams.Builder startParamsBuilder =
WalletFragmentInitParams.newBuilder()
.setMaskedWalletRequest(generateMaskedWalletRequest())
.setMaskedWalletRequestCode(MASKED_WALLET_REQUEST_CODE);
//.setAccountName("Google I/O Codelab");//https://developers.google.com/android/reference/com/google/android/gms/wallet/fragment/WalletFragmentInitParams.Builder
mWalletFragment = SupportWalletFragment.newInstance(walletFragmentOptions);
mWalletFragment.initialize(startParamsBuilder.build());
// Add the WalletFragment to the UI
getActivity().getSupportFragmentManager().beginTransaction()
.replace(R.id.androidPayContainer, mWalletFragment, WALLET_FRAGMENT_ID)
.commit();
}
}
我正在使用
PaymentMethodTokenizationType.NETWORK_TOKEN
并且我生成了 github 存储库
中所写的公钥现在,当我付款时,我在 onActivityResult 中收到此错误代码:10
在设备中我只看到这条错误消息:
Request Failed An unexpected error has occurred. Please try again later.
当我在错误对话框中按确定时,我得到了这个日志:
06-01 12:18:05.739 11386 11386 W WalletMerchantError: Error in loadMaskedWallet: Did you forget the set Android Pay testing environment to PROD?
我也尝试将变量更改为 Production,但仍然出现相同的错误。 有没有人有任何解决方案或者我真的必须稍后再试?
如果您尝试使用 ENVIRONMENT_TEST
,请确保您已按照 Setup Android Pay 中概述的步骤进行操作。具体来说,请确保您的 AndroidManifest.xml 包含以下位:
<application
...
<!-- Enables the Android Pay API -->
<meta-data
android:name="com.google.android.gms.wallet.api.enabled"
android:value="true" />
</application>
如果您觉得您的应用已准备就绪并正在尝试使用 ENVIRONMENT_PRODUCTION
,那么还有一些步骤 outlined here。
根据 Github
上发布的这个问题https://github.com/android-pay/androidpay-quickstart/issues/31
和其他联系人有沙盒模式异常,测试卡至少在欧洲不起作用。
问题的答案还包含一个替代解决方案。
Issue: test cards (even the one provided by Google) don't work anymore (at least not outside of US);
Solution: you need real card to make it work. You won't be charged with ENVIRONMENT_TEST.