chirag04 / react-native-in-app-utils

A react-native wrapper for handling in-app payments
MIT License
892 stars 187 forks source link

Unable to validate receipt in ios Production. Sandbox and Testflight is fine #198

Open MeiyappanKannappa opened 5 years ago

MeiyappanKannappa commented 5 years ago

Hi,

I have a iap subscription which is autorenewable. I validate the receipt using sibelius/iap-receipt-validator based on availability of the latest_receipt_info field in validate data and expires_date in that. I tried to validate like

validationData['latest_receipt_info'][0].expires_date > today

This works absolutely fine in sandbox and in testflight app version.

But the same code fails in production. I really cannot understand why. In production i purchase auto renewable subscription, and when i try to validate using below, it throws unable to evaluate validationData['latest_receipt_info'][0].expires_date.

 if( !validationData['latest_receipt_info'] || 
                (!validationData['latest_receipt_info'].expires_date && 
                !validationData['latest_receipt_info'][0].expires_date) ){
               // DO PAYMENT
            }else{
                if(validationData['latest_receipt_info'][0] && validationData['latest_receipt_info'][0].expires_date && 
                validationData['latest_receipt_info'][0].expires_date < today ){
                    // DO PAYMENT
                }else if(validationData['latest_receipt_info'] && validationData['latest_receipt_info'].expires_date && 
                validationData['latest_receipt_info'].expires_date < today){
                    // DO PAYMENT
                }else{
                    // NAVIGATE TO PREMIUM SUBSCRIPTION PAGE
                }
            }

Could you please help.

clementinoux commented 5 years ago

Any news?

waheedakhter commented 4 years ago

@MeiyappanKannappa were you able to fix the issue? What was the fix?