Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Sku is not visible #2914

Open
Nitika2023 opened this issue Jan 20, 2025 · 2 comments
Open

Sku is not visible #2914

Nitika2023 opened this issue Jan 20, 2025 · 2 comments

Comments

@Nitika2023
Copy link

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description
The SKUs are not working after initializing the connection in React Native IAP, and I am not getting the products (SKUs) in my list.

Environment:

  • react-native-iap: "12.15.2",
  • react-native:"0.69.3",
  • Platforms (iOS, Android, emulator, simulator, device): IOS
@Nitika2023
Copy link
Author

This is my code
const initalizeIAP = async () => {

    await  initConnection();

    purchaseUpdateSubscription = purchaseUpdatedListener(purchase => {
        setLoading(true);
        const receiptValue = purchase.transactionReceipt;

        if (!isReceiptValidationRequestInProgress && !!receiptValue) {
            setIsReceiptValidationRequestInProgress(true);
            getUserSettings().then((userdata) => {
                validatePurchaseIOS(receiptValue, userdata.uid).then((resp: any) => {

                    if (resp.status === 'Success') {
                        getUserSettings().then((userSettings) => {

                            setUser(userSettings.user);

                            //Finish transaction once the grant is successful i.e. paymentPackage field is other than 'free'
                            finishTransaction({
                                purchase: purchase,
                                isConsumable: false,
                            })
                            setIsReceiptValidationRequestInProgress(false);
                        })
                    }
                    else {
                        Alert.alert('Purchase receipt could not be validated')
                    }
                }).catch((error) => {
                    console.log(error, 'error');
                    Alert.alert('Purchase receipt could not be validated')
                    setLoading(false);

                }
                )
            })
            setLoading(false);
        }

    });
    purchaseErrorSubscription = purchaseErrorListener(
        (error: PurchaseError) => {
            setLoading(false)
        },
    );
}

// get iOS in-app purchase product list
const _getProducts = () => {
    getProducts({
        skus: [
            'com.mmapp.smarteye.monthlyplan', 'com.mmapp.smarteye.yearlyplan'
        ],
    });
};

@felipegmg
Copy link

+1

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants