Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any example on how to implement the new VerificationController and the KNOWN_TRANSACTIONS_KEY constant?

I've been looking at implementing the new VerificationController to verify in-App-Purchases: http://developer.apple.com/library/ios/#releasenotes/StoreKit/IAP_ReceiptValidation/_index.html

And I wonder if there is some example anywhere en how to validate a transaction, since it seems that the - (BOOL)verifyPurchase:(SKPaymentTransaction *)transaction; is not enough and it has to be implemented internally to verify the purchase when the data form the server is received.

Another question is if anyone has a clue on what the KNOWN_TRANSACTIONS_KEY is and how to fill it, is it just the product id of the purchase?

like image 389
Carles Estevadeordal Avatar asked Jul 21 '12 10:07

Carles Estevadeordal


2 Answers

In the file "VerificationController.m", check this function:

- (void)saveTransactionId:(NSString *)transactionId

we can see, KNOWN_TRANSACTIONS_KEY is a key to be wrote to NSUserDefaults. So we don't need to touch it.

login iTunes Connect > Manage Your Apps > (click your app) > Manage In-App Purchases > click the link View or generate a shared secret (at bottom-left of the page) it'll show us:

A shared secret is a unique code that you should use when you make the call to our servers for your In-App Purchase receipts.

Just click Generate.

like image 149
Nianliang Avatar answered Sep 28 '22 06:09

Nianliang


You can find a complete implementation over here: https://github.com/evands/iap_validation

like image 36
robodo Avatar answered Sep 28 '22 05:09

robodo