I have the same issue while implementing IAP in dev environment. I guest it's related to In-app purchases do not work on the simulator things.
Before doing receipt validation and encounter the problem bakedPotato mentioned, I got problem loading products, and have worked around - https://stackoverflow.com/questions/58020258/requesting-an-in-app-purchase-in-ios-13-fails.
Then I tested the receipt and always 21002. I tried sample receipts from internet (and my old pre-iOS 13 receipt data) with same curl script and succeeded. Then I decoded the base64 with online decoder and compared pre-iOS 13 receipts with new one. It seems the new one has different information from old one, for examples, it misses something like "ProductionSandbox0", "#Apple Worldwide Developer Relations"..., but it has "Xcode0", "StoreKit1" that are not in the pre-iOS 13 one.
Sample pre-iOS 13 receipts - https://stackoverflow.com/a/53286406/1627853
New receipt:
MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwGggCSABIIBOzGCATcwDwIBAAIBAQQHDAVYY29kZTALAgEBAgEBBAMCAQAwFwIBAgIBAQQPDA1jb20uYnVraS5idWtpMAwCAQMCAQEEBAwCNzkwEAIBBAIBAQQIse//TgcAAAAwHAIBBQIBAQQUjIZ+RiRb9aC7bpQ3J2LCtkv3vhMwCgIBCAIBAQQCFgAwIgIBDAIBAQQaFhgyMDIxLTAzLTA4VDE3OjQ4OjM0KzA4MDAwbAIBEQIBAQRkMWIwDAICBqUCAQEEAwIBATAjAgIGpgIBAQQaDBhjb20uYnVraS5idWtpLmNvaW5zLjMwMDAwDAICBqcCAQEEAwwBMDAfAgIGqAIBAQQWFhQyMDIxLTAzLTA4VDE3OjQ4OjM0WjAiAgEVAgEBBBoWGDQwMDEtMDEtMDFUMDg6MDA6MDArMDgwMAAAAAAAAKCCA3gwggN0MIICXKADAgECAgEBMA0GCSqGSIb3DQEBCwUAMF8xETAPBgNVBAMMCFN0b3JlS2l0MREwDwYDVQQKDAhTdG9yZUtpdDERMA8GA1UECwwIU3RvcmVLaXQxCzAJBgNVBAYTAlVTMRcwFQYJKoZIhvcNAQkBFghTdG9yZUtpdDAeFw0yMDA0MDExNzUyMzVaFw00M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