Reputation: 8144
I'm trying to implement in app purchases in my app. You can buy access to view a teams extra data. The amount of teams are dynamic so I cannot create a product id for all the teams. What I did now was create 1 consumable with a generic product id. When the user buys access I will save it on my server which one it is, but here is the problem. How do I know when I get called back that a purchase was successful which team it was again. Can I for example add extra data to the payment or something
Upvotes: 2
Views: 279
Reputation: 11173
This does not seem to be feasible currently, neither on App Store or Play Store. (for App Store, you might want to keep an eye on the future of SKPayment's requestData - but I would not be too optimistic)
Since a user cannot make 2 parallel purchase on the same product id, you could store metadata (such as teamId) associated to the productId
The issue with this workaround is that a purchase can complete after your app has been killed/uninstalled
A possible way to solve your issue is to invert your UX flow:
You could ask for the "payment metadata" after the purchase is actually made
I would ideally implement both approach: use the 1st one for most use case, and keep the 2nd as a fallback (as the 1st solution has a smoother UX)
Upvotes: 1
Reputation: 2625
I suppose you have to use non-consumables In-App Purchases for each team.
When you're adding a new team the flow is next:
Now you are able to make purchase.
Upvotes: 0