简体   繁体   中英

is application must be published for in-app purchase in android?

i have uploaded one application to Googleplay store with billing permission. i want to buy that application using in app purchase. so i want to know whether that application should be published on GooglePlay store?

No, It is not necessary to publish your application for testing in-app billing.

There are following two ways :

1: Test your in-app without uploading your apk on google play store :

There are four reserved product IDs for testing static In-app Billing responses:

android.test.purchased

When you make an In-app Billing request with this product ID, Google Play responds as though you successfully purchased an item. The response includes a JSON string, which contains fake purchase information (for example, a fake order ID). In some cases, the JSON string is signed and the response includes the signature so you can test your signature verification implementation using these responses.

android.test.canceled

When you make an In-app Billing request with this product ID Google Play responds as though the purchase was canceled. This can occur when an error is encountered in the order process, such as an invalid credit card, or when you cancel a user's order before it is charged.

android.test.refunded

When you make an In-app Billing request with this product ID, Google Play responds as though the purchase was refunded. Refunds cannot be initiated through Google Play's in-app billing service. Refunds must be initiated by you (the merchant). After you process a refund request through your Google Wallet merchant account, a refund message is sent to your application by Google Play. This occurs only when Google Play gets notification from Google Wallet that a refund has been made. For more information about refunds, see Handling IN_APP_NOTIFY messages and In-app Billing Pricing.

android.test.item_unavailable

When you make an In-app Billing request with this product ID, Google Play responds as though the item being purchased was not listed in your application's product list.

Source : http://developer.android.com/google/play/billing/billing_testing.html

2: Test your in-app after uploading your apk on developer console in draft :

Again you have to follow some steps :

a) Upload your signed apk and save it as draft (or send it for alpha testing).

b) Find Base64-encoded RSA public key in Services and APIs tab (use it in your in-app implemtation).

c) Create In-app product and you will get a SKU (use it in your in-app implementation).

d) Actually step 'b' and 'c' are on higher priority than 'a' because you have to use all these keys in your application before creating your signed apk.

e) Activate this in-app product.

f) Now install same apk in your device and try to use in-app billing.

Please find more elaborated and updated solution from here .

Thanks

PS : It worked for me few days ago but it keeps on updating. Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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