Testing Android Market in-app billing with dummy credit card credentials
Asked Answered
U

4

25

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

It works fine when tested using the UK development team's accounts which have real credit cards associated with them. However, part of my development team is based in China, and as Google Billing does not operate in China, they are unable to test the billing functionality.

Understandably the team is uncomfortable sharing personal card details, or personal account information with others. Does anybody know a work around for this? While in testing, can dummy card numbers be associated with the account?

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.

Any help/guidance/support would be appreciated here. The China team is focused on a lot of the modules related to the post-purchase experience and this will be seriously compromised if we cannot find a workaround.

Thanks!

Unpolitic answered 20/7, 2011 at 14:14 Comment(6)
Perhaps put a couple of pounds on a Visa gift card (it works like a credit card) and send it to them?Contuse
I would be curious as to whether the proper testing procedures will even work in China. Maybe you should let them VPN, or something.Stilly
Going to assume you've seen this, developer.android.com/guide/market/billing/billing_testing.htmlStilly
Isn't 4111-1111-1111-1111 the universal (Visa) dummy credit card number?Buchanan
[TEK] - The idea of a VISA/Mastercard gift card is a good idea! I think I may give that a shot to see if it works. [Tom] - They do have to VPN through for testing, but all of their personal credit cards are China based and Google Billing uses the credit card home location when doing processing, and yes I did see the developer guides, but thanks for the link. [Citizen] - I haven't tried it, but can you associate that dummy card with your google account, try to transact, and not have the account blocked?Unpolitic
TEK - I've ordered a Mastercard Gift card as the other solutions haven't really done the trick as desired. Do you want to enter it as an answer below? I've got a feeling it's the option that will work!Unpolitic
U
2

In order to close this thread - the solution that I eventually wound up deploying was one provided by TEK. I procured some prepaid credit cards and attached them to test accounts. It mitigated risk and allowed for our developers to use the accounts.

I should point out that the developers in China also had to VPN out of China in order to pull the market billing dialog up.

iPhone developers/users do not have the VPN problem at all.

Thanks, Kaiesh

Unpolitic answered 30/8, 2011 at 3:57 Comment(1)
Don't used now.Alonzoaloof
T
8

Update:
Inappbilling library 1.0 just released to make this easier.


Kumar Bibek has already answerd above: Still I am giving an explanation:

Hardcode the following debug options in the launch purchase flow to get the desired output.

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

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

The above will give these screens:

enter image description here

On clicking Buy.

enter image description here

Towpath answered 15/10, 2013 at 12:22 Comment(1)
DANGER: if you do this you'll break IAB and end up on this question next. DON'T DO THIS. IT'S BROKEN.Pickel
T
5
  • android.test.purchased
  • android.test.canceled
  • android.test.refunded
  • android.test.item_unavailable

Use these product IDs and you should get a fake card prompt in the purchase screen.

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

Triform answered 20/7, 2011 at 20:21 Comment(2)
OK, so to understand properly, the guidance you're providing here is to not actually try to and purchase the products created as an in-app billing items - instead, to hardcode the product ID to be the test scenario. So the testing would need to be broken into two distinct phases, [1] to test the selection of the appropriate ID within the software and the pop-up of the prompt, and [2] to test the post-purchasing activity. The only thing this doesn't allow us to test is the actual delays experienced with card authorisation in the production environment.Unpolitic
Yep. With Google checkout, the cards would be pre-processed for authorisation in most of the cases. In most cases, the cards have been already authorised, but yes, there can be situations where it might take a little bit of more time to process the payment.Triform
U
2

In order to close this thread - the solution that I eventually wound up deploying was one provided by TEK. I procured some prepaid credit cards and attached them to test accounts. It mitigated risk and allowed for our developers to use the accounts.

I should point out that the developers in China also had to VPN out of China in order to pull the market billing dialog up.

iPhone developers/users do not have the VPN problem at all.

Thanks, Kaiesh

Unpolitic answered 30/8, 2011 at 3:57 Comment(1)
Don't used now.Alonzoaloof
S
1

As answered above by other fellows I was able to do testing of the application by launching this peace of code in my activity

 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: I have used this library for Implementation of In App purchases A lightweight implementation of Android In-app Billing Version 3

Satisfaction answered 28/12, 2016 at 8:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.