cancel
Showing results for 
Search instead for 
Did you mean: 

v205 typescript updates

Shards632
Mentor
  • many doc comment updates that "Horizon Worlds" is now "Meta Horizon Worlds", as well as other minor doc comments
  • new WorldInventory static class to simplify IWP management w/o an IWPSellerGizmo
    • getPlayerEntitlements() - all the IWPs a player has purchased
    • getWorldPurchasableBySKUs() - look up IWP items by string name (Stock Keeping Unit aka SKU)
      doesPlayerHaveEntitlement() - see if a player owns a speciifc IWP, by SKU
  • new InWorldPurchasable type and PlayerEntitlement interface to work with new WorldInventory api
  • new InWorldPurchase.launchCheckoutFlow()
    • static method so that you can initiate IWP purchases without an IWPSellerGizmo, i.e. directly from Custom UI!
Upcoming Events:
Build-Along - Unlock the Power of Player Inventories Thursday, May 15th 11:00 AM PT
- Register
May Programming Calendar
3 REPLIES 3

Scratmx
Member

Is there any way to test the purchases when calling InWorldPurchase.launchCheckoutFlow() ?
I am calling  InWorldPurchase.launchCheckoutFlow(player, itemSKU);  from a UIGizmo which opens the checkout window (so I suppose it is working well)... BUT when I buy something it takes my money but nothing happens in my game. 

I have the this.connectCodeBlockEvent(this.entity, CodeBlockEvents.OnItemPurchaseComplete, (player, item, success) => { this.purchase(player, item, success); });  setup 

here's my purchase function:
purchase(player: Player, item: string, success: boolean) {
switch (item) {
case '1000_coins_e9a304be':
this.playerPurchaseEffects(player, item, success, 1000);
break;
case '5000_coins_e20db36f':
this.playerPurchaseEffects(player, item, success, 5000);
break;
case '10000_coins_eec1ff3b':
this.playerPurchaseEffects(player, item, success, 10000);
break;
case '50000_coins_01a3171f':
this.playerPurchaseEffects(player, item, success, 50000);
break;
default:
console.log('Case for item not found: ' + item);
break;
}
}

I need to be able to test it in the Desktop Editor if possible or in Mobile as my game is optimized for mobile. Also the function InWorldPurchase.launchCheckoutFlow() does nothing in VR (no checkout window opened)...

As I think this is crucial for any mobile game to sell products, to be at least able to test it. 

Thanks for your help!

I have found that, when you use the `InWorldPurchase.launchCheckoutFlow()`, you _must_ have an IWPSellerGizmo _somewhere_ in the world configured with the _same_ commerce item sku, or else you will _not_ get the `OnItemPurchaseComplete` message. It seems like a bug, but that's the workaround.

When using the typescript api to launch the purchase flow, I make sure to have a set of the yellow IWPSellerGizmos for each sku being sold tucked away out of view from the players.

Upcoming Events:
Build-Along - Unlock the Power of Player Inventories Thursday, May 15th 11:00 AM PT
- Register
May Programming Calendar

Awesome! thank you so much for the quick reply! I'll try that out!