iOS : inAppPurchase : how to purchase more than 1 (consumable) product at a time.?

StackOverflow https://stackoverflow.com/questions/23127420

  •  05-07-2023
  •  | 
  •  

문제

How can i configure storekit to purchase more than 1 product in a single transaction.

Requirement: 1 credit = 1 product.

In my application i want to give option to user to buy 5 credits.

Thanks in Advance

도움이 되었습니까?

해결책

Found an answer from iOS documentation!

We can make use of SKMutablePayment and we can configure its property quantity The number of items the user wants to purchase.

@property(nonatomic, readwrite) NSInteger quantity

Discussion The quantity property must be greater than 0. Available in iOS 3.0 and later. Declared In SKPayment.h

다른 팁

Create an InApp purchase object that gives the user 5 credits.... So:

Buy 1 credit

Buy 5 credits

Buy 10 credits


Three separate consumable product IDs.

One inApp product is one transaction.

As each transaction is stored on the server and can be validated, you cannot purchase 5 products in single transaction. It has to be 5 transactions.

you have to add 5 SKProducts into a queue. and in your completed transactions. keep count of how many products purchased and in the end show updated value.

The solution is as mentioned above getting a mutableCopy of the SKPayment and setting the quantity property to the desired value. However note that the maximum value is 10, this is not mentioned in the docs of SKMutablePayment but only in SKPayment.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top