question

loverisaliar avatar image
loverisaliar asked

Purchase Stackable Item with quantity?

Hello everyone. I'm new to Playfab services. I have a Legacy Catalog that holds an item - a Potion. It's stackable, and I'm making a purchase with Purchase Item API - purchase-item, but depending on what I see on the document, it only allows me to purchase a single item per call. I'll try it and yes, it's only make RemainingUses increase by one. And then I see this API - start-purchase, and I see Quantity in ItemPurchaseRequest, but it only allows the min value to be 1 and max value to be 25. How can I buy the Potion in quantity more than 25?

apisPlayer Inventory
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Neils Shi avatar image
Neils Shi answered

If you want to purchase multiple stackable items, you can use Azure Function to implement it. First, you can grant one instance of the item to player via API GrantItemsToUser, then use API ModifyItemUses to add player's inventory items. Finally, call SubtractUserVirtualCurrency for the payment. Be aware that non-stackable items won’t work by this method.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.