Verify the transactionReceipt of SKPaymentTransaction

The transactionReceipt property of the SKPaymentTransaction class in StoreKit framework in iOS SDK is of type NSData and Apple isn’t very eager to tell us what it contains and what format of data it is in. However, Apple provides a service through which you can verify if this data is valid or not.

The process is explained in In-App Purchase’s Verifying Store Receipts page. But to make things easy, I have created an iOS SDK 5.0 compatible class which will do this for you. All you have to do is to pass the NSData transactionReceipt of an instance of SKPaymentTransaction to this class and wait for the response to come back.

I’ve named this class “SKTransactionReceiptVerifier” and you are free to use it in your projects or modify it to suit your needs.

You can download “SKTransactionReceiptVerifier” by clicking on this link. I hope this will help save your time.


4 thoughts on “Verify the transactionReceipt of SKPaymentTransaction

  1. For the sake of code and cycle improvement, you might want to consider changing:

    __block BOOL statusKeyExists = NO;
    [responseDictionary enumerateKeysAndObjectsUsingBlock:^(NSString *paramKey, id paramObject, BOOL *paramStop) {
    if ([paramKey isEqualToString:@”status”]){
    statusKeyExists = YES;
    *paramStop = YES;

    if (statusKeyExists){

    to simply:

    if ([responseDictionary objectForKey:@”status”]) {

    There’s little point in scanning through an NSDictionary just to verify a value exists. Especially since you don’t know how far into the NSDictionary you’ll have to travel to find it (wasting CPU along the way).

    Just checking objectForKey for nil is more efficient (it performs a single hash lookup) and easier from a coding perspective.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s