In-App purchases not working in chrome extension

I-Parliament

The In-App purchases screen is returning:

Screenshot of In-App screen

The error is:

An unexpected error has occurred. Please try again later. Dismiss

And as you can see, half of it is also black.

Buy.js:

  /*GOOGLE's CODE
...
*/



 /*CODE FOR IN-APP PURCHASES*/


var prodButPrefix = "btnProdID-";
var statusDiv;

function init() {
  console.log("App Init");
  statusDiv = $("#status");
  //  getProductList();

}

$("#div1").click(function() {
  checkIfBought("package2016");
});


/*****************************************************************************
* Get the list of purchased products from the Chrome Web Store
*****************************************************************************/
var purchased = false;
function getLicenses() {
  console.log("google.payments.inapp.getPurchases");
  console.log("Retreiving list of purchased products...");
  google.payments.inapp.getPurchases({
    'parameters': {env: "prod"},
    'success': onLicenseUpdate,
    'failure': onLicenseUpdateFailed
  });
}

function checkIfBought(sku_init){
  getLicenses();
  function getLicenses() {
    console.log("google.payments.inapp.getPurchases");
    console.log("Retreiving list of purchased products...");
    google.payments.inapp.getPurchases({
      'parameters': {env: "prod"},
      'success': onLicenseUpdate,
      'failure': onLicenseUpdateFailed
    });
  }

  function onLicenseUpdate(response) {
    console.log("onLicenseUpdate", response);
    var licenses = response.response.details;
    var count = licenses.length;
    for (var i = 0; i < count; i++) {
      var license = licenses[i];
      if(sku_init == licenses[i].response.details.sku){ //if purchased
        purchased = true;
      }
      addLicenseDataToProduct(license);
    }
    console.log("");
  }

  function onLicenseUpdateFailed(response) {
    console.log("onLicenseUpdateFailed", response);
    console.log("Error retreiving list of purchased products.");
  }

  if(purchased == false){
    buyProduct("package2016");
  }
}



/*****************************************************************************
* Purchase an item
*****************************************************************************/


function buyProduct(sku) {
  console.log("google.payments.inapp.buy", sku);
  //var sku = "";
  google.payments.inapp.buy({
    'parameters': {'env': 'prod'},
    'sku': sku,
    'success': onPurchase,
    'failure': onPurchaseFailed
  });
}


function onPurchase(purchase) {
  console.log("onPurchase", purchase);
  var jwt = purchase.jwt;
  var cartId = purchase.request.cardId;
  var orderId = purchase.response.orderId;
  console.log("Purchase completed. Order ID: " + orderId);
  getLicenses();
}

function onPurchaseFailed(purchase) {
  console.log("onPurchaseFailed", purchase);
  var reason = purchase.response.errorType;
  console.log("Purchase failed. " + reason);
}

This is what is being printed in the console:

google.payments.inapp.buy package2016

When I close the In-App payment screen this is printed:

onPurchaseFailed Object {request: Object, response: Object} Purchase failed. PURCHASE_CANCELED

I-Parliament

I emailed Chrome Dev support, they said:

In the Chrome Web Store, You are not allowed to purchase your own Apps/Extensions. In order to test your item, you need to access it from different account you have. (Not from your developer account).

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Chrome extension setTimeout not working properly

分類Dev

reactjs chrome extension message passing not working

分類Dev

How to pass a blob from a Chrome extension to a Chrome app

分類Dev

Chrome extension message passing between content and background not working

分類Dev

Restore already bought in-app-purchases on iPhone?

分類Dev

How to implement In-App Purchases Subscription in Flutter?

分類Dev

Should I use in-app purchases in this case?

分類Dev

Automatically canceled android in app purchases, reason "other"

分類Dev

Chrome extension message passing not working (background.js to content.js)

分類Dev

chrome extension - restriction on Chrome version

分類Dev

chrome extension - restriction on Chrome version

分類Dev

Chrome Extension : Issue with SendMessage

分類Dev

Chrome Extension captureStream

分類Dev

Chrome Extension Shortcuts

分類Dev

Chrome extension options

分類Dev

How to create a promotion code for iOS in-app purchases

分類Dev

In app purchases using SwifyStoreKit unable to get info about product

分類Dev

In-App Purchase: "Restore Purchases" button on user-bound purchase

分類Dev

When can I add In app purchases ? Google Android Play Store

分類Dev

In app purchases using SwifyStoreKit unable to get info about product

分類Dev

In-app purchases (IAP) in android with BOTH Google and Facebook authentication?

分類Dev

(Swift/iOS) Is it possible to get user purchased items from In app purchases?

分類Dev

Notificaton Service Extension Not working

分類Dev

Chrome Extension - Find out if extension tab is open

分類Dev

Chrome Extension detect button inside extension

分類Dev

chrome object properties undefined for Chrome Extension

分類Dev

Chrome Extension causes Chrome to become unusably slow

分類Dev

Using Chrome text-to-speech in a chrome extension

分類Dev

Chrome Extension example of oAuth 2.0

Related 関連記事

  1. 1

    Chrome extension setTimeout not working properly

  2. 2

    reactjs chrome extension message passing not working

  3. 3

    How to pass a blob from a Chrome extension to a Chrome app

  4. 4

    Chrome extension message passing between content and background not working

  5. 5

    Restore already bought in-app-purchases on iPhone?

  6. 6

    How to implement In-App Purchases Subscription in Flutter?

  7. 7

    Should I use in-app purchases in this case?

  8. 8

    Automatically canceled android in app purchases, reason "other"

  9. 9

    Chrome extension message passing not working (background.js to content.js)

  10. 10

    chrome extension - restriction on Chrome version

  11. 11

    chrome extension - restriction on Chrome version

  12. 12

    Chrome Extension : Issue with SendMessage

  13. 13

    Chrome Extension captureStream

  14. 14

    Chrome Extension Shortcuts

  15. 15

    Chrome extension options

  16. 16

    How to create a promotion code for iOS in-app purchases

  17. 17

    In app purchases using SwifyStoreKit unable to get info about product

  18. 18

    In-App Purchase: "Restore Purchases" button on user-bound purchase

  19. 19

    When can I add In app purchases ? Google Android Play Store

  20. 20

    In app purchases using SwifyStoreKit unable to get info about product

  21. 21

    In-app purchases (IAP) in android with BOTH Google and Facebook authentication?

  22. 22

    (Swift/iOS) Is it possible to get user purchased items from In app purchases?

  23. 23

    Notificaton Service Extension Not working

  24. 24

    Chrome Extension - Find out if extension tab is open

  25. 25

    Chrome Extension detect button inside extension

  26. 26

    chrome object properties undefined for Chrome Extension

  27. 27

    Chrome Extension causes Chrome to become unusably slow

  28. 28

    Using Chrome text-to-speech in a chrome extension

  29. 29

    Chrome Extension example of oAuth 2.0

ホットタグ

アーカイブ