How to convert data from inapppurchase to the format needed for Fabric responses

Twitter has launched a new feature for Fabric that allows you to track events . In particular, you can track the payment using the following API:

[Answers logPurchaseWithPrice:[NSDecimalNumber decimalNumberWithString:@"13.50"]
                 currency:@"USD"
                  success:@YES
                 itemName:@"Answers Shirt"
                 itemType:@"Apparel"
                   itemId:@"sku-350"
         customAttributes:@{}];

I want to track payments through in-app purchases.

When the purchase completes inside - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions, then it is obvious how to get some of these options. For instance.

[Answers logPurchaseWithPrice:skProduct.price
                 currency:???
                  success:@YES
                 itemName:skProduct.localizedDescription
                 itemType:@"in app purchase"
                   itemId:aTransaction.payment.productIdentifier
         customAttributes:@{}];

What is the best way to get the currency string, which should be the ISO4217 currency code?

+4
source share
1 answer

Currency code can be obtained from:

[skProduct.priceLocale objectForKey:NSLocaleCurrencyCode]
+5
source

Source: https://habr.com/ru/post/1599224/


All Articles