繁体   English   中英

使用虚拟信用卡凭证测试 Android 市场应用内计费

[英]Testing Android Market in-app billing with dummy credit card credentials

I have configured an Android application to use the in-app billing module as documented at: http://developer.android.com/guide/market/billing/index.html

当使用英国开发团队的账户进行测试时,它工作正常,这些账户与他们关联的真实信用卡。 但是,我的部分开发团队位于中国,由于 Google Billing 不在中国运营,他们无法测试计费功能。

可以理解的是,团队不愿意与他人分享个人卡详细信息或个人帐户信息。 有人知道解决这个问题吗? 在测试时,虚拟卡号可以与帐户关联吗?

I know this works in the merchant sandbox ( http://code.google.com/apis/checkout/developer/Google_Checkout_Basic_HTML_Sandbox.html ) but I can't seem to find an equivalent for Android billing testing.

任何帮助/指导/支持将在这里不胜感激。 中国团队专注于很多与售后体验相关的模块,如果我们找不到解决方法,这将受到严重影响。

谢谢!


更新:
刚刚发布的Inappbilling 库 1.0使这更容易。


Kumar Bibek 已经在上面回答了:我仍然在给出解释:

在启动购买流程中硬编码以下调试选项以获得所需的 output。

  • android.test.purchased
  • android.test.canceled
  • android.test.refunded
  • android.test.item_unavailable*

    mHelper.launchPurchaseFlow(Activity.this, "android.test.purchased", 1000, mPurchaseFinishedListener, payload);

以上将给出这些屏幕:

在此处输入图像描述

点击购买。

在此处输入图像描述

  • android.test.purchased
  • android.test.canceled
  • android.test.refunded
  • android.test.item_unavailable

使用这些产品 ID,您应该会在购买屏幕上看到假卡提示。

参考:
https://developer.android.com/google/play/billing/billing_testing.html#billing-testing-static

为了关闭这个线程——我最终部署的解决方案是由 TEK 提供的。 我购买了一些预付信用卡并将它们附加到测试帐户。 它降低了风险并允许我们的开发人员使用这些帐户。

我应该指出,中国的开发人员也不得不将 VPN 移出中国,以拉动市场计费对话。

iPhone 开发者/用户根本没有 VPN 问题。

谢谢,凯什

正如上面其他研究员所回答的那样,我能够通过在我的活动中启动这种和平的代码来测试应用程序

 public class PurchaseTestingActivity extends AppCompatActivtiy implements BillingProcessor.IBillingHandler {

    ........
  purchaseButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            boolean isAvailable = BillingProcessor.isIabServiceAvailable(PrivateAndPublicCardHoldScreen.this);
            if (isAvailable) {
                       BillingProcessor bp = new BillingProcessor(this, "YOUR LICENSE KEY FOR THIS APPLICATION", this);
             /// this is the actually product 
//                    bp.purchase(PrivateAndPublicCardHoldScreen.this, "upgrade_to_premium");

      //// for testing purposes  
                bp.purchase(PrivateAndPublicCardHoldScreen.this, "android.test.purchased");
            }else{
                Toast.makeText(PrivateAndPublicCardHoldScreen.this, "Your device is not supported, please contact us.", Toast.LENGTH_LONG).show();
            }
        }
    });

  ..........

   @Override
public void onProductPurchased(String productId, TransactionDetails details) {
    /// handle your app after purchases done

}

@Override
public void onPurchaseHistoryRestored() {

}

@Override
public void onBillingError(int errorCode, Throwable error) {

}

@Override
public void onBillingInitialized() {

}


 }

PS:我已经使用这个库来实现应用内购买Android 应用内计费版本 3 的轻量级实现

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM