Sign in to follow this  

How to get working In-App Purchases (IAP) using Cordova on iOS?

Recommended Posts

After successful delivery In-App Purchases (IAPs) on Android using Apache Cordova and I can't get it working properly on iOS. The problem is that once the item is clicked the price shows its details etc., but if use clicks "Cancel" then the user can't purchase anything anymore. Unless restarting the game, as far as I'm aware I should handle rejection/cancellation events. Tried these, but so far no success.

This is how I was trying to handle these events (rejection/cancellation), including playing with store.refresh() in different locations of the code and without it as well:

// Handle rejection and cancel events.
store.when("com.XX.YY.gems5").rejected(function(order) {
store.when("com.XX.YY.gems5").cancelled(function(order) {

Code, which correctly works on Android (the handling wasn't required there in order to work properly):

'use strict';
var that = this;
// Prepare product.
  id:    "com.XX.YY.gems5",
  alias: "Gems 5",
  type:  store.CONSUMABLE
// Purchase product.
store.when("com.XX.YY.gems5").approved(function (order) {
  // Add extra gems.
  localStorage.gems = parseInt(localStorage.gems) + 5; // Add 5 gems.; // Play upgrade sound."GemsState");
  that.menu_items[1].select(); // Select second item.

I'm using Phaser 2 & ES5.

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.