简体   繁体   中英

Android in-app purchases are coming back cancelled

I've been working on implementing in-app billing, basing it off of blundell's tutorial here: http://www.anddev.org/advanced-tutorials-f21/simple-inapp-billing-payment-t52060.html

When I go to make a purchase, everything seems to check out fine, however after a few minutes I get a notification that the purchase failed and is cancelled. The message I get back looks like this:

We could not complete your order in a timely fashion. Please verify your payment information in Google Checkout and try again later.

So I took a look using LogCat, and it looks like when I get the IN_APP_NOTIFY action, it's simply coming back cancelled. I am totally stumped, and I've had other people try on their devices with the same issue.

It's not listed below, but in the JSON string I get back, purchaseState is set to 1 (cancelled).

Log dump!

    06-05 17:39:03.175: INFO/BillingService(7694): Received action: com.android.vending.billing.IN_APP_NOTIFY
    06-05 17:39:03.175: INFO/BillingService(7694): getPurchaseInformation()
    06-05 17:39:03.183: INFO/BillingService(7694): current request is:1874091953267766809
    06-05 17:39:03.183: INFO/BillingService(7694): GET_PURCHASE_INFORMATION Sync Response code: RESULT_OK
    06-05 17:39:03.714: INFO/BillingService(7694): Received action: com.android.vending.billing.PURCHASE_STATE_CHANGED
    06-05 17:39:03.714: INFO/BillingService(7694): got signedData
    06-05 17:39:03.757: INFO/BillingService(7694): confirmTransaction()
    06-05 17:39:03.765: INFO/BillingService(7694): CONFIRM_NOTIFICATIONS Sync Response code: RESULT_OK
    06-05 17:39:03.768: INFO/ConcertView(7694): Transaction complete
    06-05 17:39:03.768: INFO/ConcertView(7694): Transaction status: CANCELED

Figured out my own issue - it looks like the tutorial mentioned uses the android 1.6 version of sending the PendingIntent from a purchase request. I had to switch it to the 2.0 version.

It of course says this in the comments, but apparently I blew right past it. Facepalm.

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