How to validate a purchase receipt on Unity Distribution Portal?

I have a code which validates purchases on Android & iOS:

    bool validPurchase = true; // Presume valid

        // Unity IAP's validation logic is only included on these platforms.
        #if (UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX || UNITY_STANDALONE_OSX) && !UNITY_EDITOR

            // Prepare the validator with the secrets we prepared in the Editor
            // obfuscation window.
            var validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
                AppleTangle.Data(), Application.identifier);

            try {
                // On Google Play, result has a single product ID.
                // On Apple stores, receipts contain multiple products.
                var result = validator.Validate(args.purchasedProduct.receipt);
                // For informational purposes, we list the receipt(s)
                Debug.Log("Receipt is valid. Contents:");
               
                foreach (IPurchaseReceipt productReceipt in result) {
                   
                    Debug.Log(productReceipt.productID);
                    Debug.Log(productReceipt.purchaseDate);
                    Debug.Log(productReceipt.transactionID);
                }
            } catch (IAPSecurityException ex) {
                Debug.Log("Invalid receipt, not unlocking content: " + ex.Message);
                validPurchase = false;
            }
           
        #endif

But while testing on sandbox user on Distribution Portal, it throws an exception.
What to do?

What is the exception?

Hello. This is the exception message:

Invalid receipt, not unlocking content: Store not supported: UDP

The “Store not supported” is true, because the validator object takes only Google Play and Apple tangle data:

var validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
                AppleTangle.Data(), Application.identifier);

I was looking for a way to disable the validation on UDP, but I can’t find any option to determine, if Target UDP is selected (from code).

We are looking into this and will follow up here.

Any update on this?
We’re struggling with the exact same issue, using Unity IAP 1.22 on 2018.4.5f1.

Edit: worth mentioning that we intend to keep validation working for UDP, not bypassing it.

Any news about this?

The validator would not be expected to work on UDP, only Google and Apple. You might try catching all exceptions, you will likely be able to handle there:

catch (Exception e)

Otherwise you might want to ask on the UDP forum is there is a way to determine the UDP platform