I have an app that has been available in the AppStore for a while now.
I can see from the iTunes reports that it's been purchased using Apple's volume purchase program, which is great, however - I would like to know if a certain device is running a volume purchased app or a standard AppStore app.
I tried prying inside the receipt ([[NSBundle mainBundle] appStoreReceiptURL]
) but I couldn't find anything informative.
Creating a different bundle ID for this purpose is not an option, and kind of misses the idea of the VPP so, please - don't offer it.
Is there a programatic way to tell if the app was purchased using the VPP?
Asked
Active
Viewed 720 times
3

Moshe Gottlieb
- 3,963
- 25
- 41
1 Answers
5
You were right to look inside the app receipt for VPP information, but you need to refresh it with the SKReceiptPropertyIsVolumePurchase
flag set first:
self.refresh = [[SKReceiptRefreshRequest alloc] initWithReceiptProperties:@{SKReceiptPropertyIsVolumePurchase : @YES}];
self.refresh.delegate = self;
[self.refresh start];
You then get your receipt data in requestDidFinish:
- (void)requestDidFinish:(SKRequest *)request {
NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
// decode receipt and examine vpp fields here
}
There are many ways to decode an apple receipt, I find the easiest way is to use Apple's receipt verifier, so I moved the receipt data to a file (receipt-data.der
) on my computer:
curl -d "{ \"receipt-data\" : \"$(base64 receipt-data.der)\" }" https://sandbox.itunes.apple.com/verifyReceipt
This showed some interesting new fields:
"organization_display_name": "ACME Bad VPPReceipt Inc."
"receipt_type": "ProductionVPPSandbox"
"expiration_date": "2015-12-10 00:44:22 Etc/GMT"
This is in the sandbox, so results will change when you move to production, but this should be enough to figure out if a given device is vpp or not. If you use Apple's receipt verifier, make sure to change the URL to https://buy.itunes.apple.com/verifyReceipt
.

Rhythmic Fistman
- 34,352
- 5
- 87
- 159
-
Thanks! this is exactly what I was looking for. – Moshe Gottlieb Nov 10 '15 at 06:38
-
1According to Apple's documentation, setting the VPP property is only for testing. https://developer.apple.com/documentation/storekit/skreceiptrefreshrequest/1506038-init – Jonathan Chandler Feb 23 '22 at 19:34
-
I don't see anything about vpp in that link – Rhythmic Fistman Feb 27 '22 at 06:52
-
@RhythmicFistman The documentation does say that you need to set properties to nil in production environment. – Deepak Sharma Jul 15 '23 at 15:08