03-11-2025 09:17 AM
05-08-2025 08:44 AM
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!
05-08-2025 09:11 AM
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.
05-08-2025 10:17 AM
Awesome! thank you so much for the quick reply! I'll try that out!