benjaminmayo / merchantkit

A modern In-App Purchases management framework for iOS.
MIT License
1.11k stars 74 forks source link

Support for Xcode StoreKit Configuration Generated Receipts #66

Closed jasonmedeiros closed 3 years ago

jasonmedeiros commented 3 years ago

Does MerchantKit support Xcode StoreKit Configurations?

That's where you define your In-App Purchases in a .storekit file and assign it in your Scheme's Options. It allows for quick local testing where Xcode handles transactions and generating receipts. You can even run in the simulator, see transaction states, and more.

When running with a StoreKit Configuration file, validating receipts fails early deep in the parser.

Maybe it's just not supported or there is something obvious that I'm missing.

Specifically, a PayloadValueConversionError.invalidLength error is thrown with this stack trace:

ASN1.consumeLength(from:)
ASN1.Parser._parse(subdata:)
ASN1.Parse()
PKCS7ReceiptDataContainer.content()
LocalReceiptDataDecoder.decode(_:)
LocalReceiptValidator.validate(...)
...

Thanks for making MerchantKit.

benjaminmayo commented 3 years ago

Can you send me the failing receipt (found in the app's bundle on disk) and I can take a look at it?

jasonmedeiros commented 3 years ago

Thanks for replying. I've emailed you a receipt file at the email in your profile as the receipt contains the bundle ID of an unreleased product.

benjaminmayo commented 3 years ago

I know this is belated but I think I have cracked the issue here.

benjaminmayo commented 3 years ago

If you have the chance, please try a StoreKit Configuration generated receipt against the master branch. The issue should be resolved.