You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please use the Discussion board if you want to get some help. Please use issues to report bugs.
Description
I want that on Successful payment , i should be able to make a post request to an api called createPayment (in function checkCurrentPurchase that is being triggered by update listener)
to store data in backend, but somehow it is not happening, not getting called
Expected Behavior
Screenshots
import React, { useEffect, useState } from "react";
import {
ScrollView,
StyleSheet,
Text,
View,
Platform,
TouchableOpacity,
SafeAreaView,
ActivityIndicator,
Alert,
} from "react-native";
import { createPayment, createUserSubscription } from '../../apis';
// import { ITUNES_SHARED_SECRET } from "@env";
import {
PurchaseError,
} from "react-native-iap";
import Constants from 'expo-constants';
import { logReadable } from "utils/utils";
import BillingCycleTile from "components/BillingCycleTile";
import { addDays, format } from "date-fns";
import { Icon } from "@ui-kitten/components";
import { updateSubscription } from "store/slices/userSlice";
import { useAppDispatch } from "store/store";
const getITunesSharedSecret = () => {
if (Constants.expoConfig && Constants.expoConfig.extra) {
return Constants.expoConfig.extra.itunesSharedSecret;
}
throw new Error('iTunes shared secret is not defined in the configuration.');
};
I also got undefined initially, but after a few minutes, currentPurchase updated and had the correct value.
I'm using sandbox email for testing the purchase subscription.
Description
I want that on Successful payment , i should be able to make a post request to an api called createPayment (in function checkCurrentPurchase that is being triggered by update listener)
to store data in backend, but somehow it is not happening, not getting called
Expected Behavior
Screenshots
import React, { useEffect, useState } from "react";
import {
ScrollView,
StyleSheet,
Text,
View,
Platform,
TouchableOpacity,
SafeAreaView,
ActivityIndicator,
Alert,
} from "react-native";
import { createPayment, createUserSubscription } from '../../apis';
// import { ITUNES_SHARED_SECRET } from "@env";
import {
PurchaseError,
} from "react-native-iap";
import Constants from 'expo-constants';
import { logReadable } from "utils/utils";
import BillingCycleTile from "components/BillingCycleTile";
import { addDays, format } from "date-fns";
import { Icon } from "@ui-kitten/components";
import { updateSubscription } from "store/slices/userSlice";
import { useAppDispatch } from "store/store";
const getITunesSharedSecret = () => {
if (Constants.expoConfig && Constants.expoConfig.extra) {
return Constants.expoConfig.extra.itunesSharedSecret;
}
throw new Error('iTunes shared secret is not defined in the configuration.');
};
const errorLog = ({ message, error }) => {
console.error("An error happened", message, error);
};
const ITUNES_SHARED_SECRET = getITunesSharedSecret();
console.log(ITUNES_SHARED_SECRET)
const isIos = Platform.OS === "ios";
const allSkus = ["gs_vijay_1m", "gs_udaan_1m", "gs_tarakki_1m"];
function getLastDateIn30DayInterval(numMonths) {
const currentDate = new Date();
const lastDate = addDays(currentDate, numMonths * 30);
}
export const Subscriptions = ({ navigation, route }) => {
};
const styles = StyleSheet.create({
container: {
marginBottom: 20,
},
listItem: {
fontSize: 16,
paddingLeft: 8,
paddingBottom: 3,
textAlign: "center",
color: "black",
},
box: {
margin: 10,
marginBottom: 5,
padding: 10,
backgroundColor: "white",
borderRadius: 7,
shadowColor: "rgba(0, 0, 0, 0.45)",
shadowOffset: { height: 16, width: 0 },
shadowOpacity: 0.1,
shadowRadius: 12,
},
button: {
alignItems: "center",
justifyContent: 'center',
backgroundColor: '#6C5BCD',
borderRadius: 8,
flexDirection: 'row',
padding: 12,
},
buttonText: {
fontSize: 16,
fontWeight: "bold",
color: "white",
textTransform: "uppercase",
},
specialTag: {
color: "white",
backgroundColor: "crimson",
width: 125,
padding: 4,
fontWeight: "bold",
fontSize: 12,
borderRadius: 7,
marginBottom: 2,
},
});
Environment:
To Reproduce
Steps to reproduce the behavior:
[Optional] Additional Context
The text was updated successfully, but these errors were encountered: