Discussions

Ask a Question
Back to All

[ADAPTY] Error: #2009 (encodingFailed): Failed to find encoder for property "0"

try {
const id = 'hoxy_weekly_2';
const locale = 'en';

  const paywall = await adapty.getPaywall(id, locale);
  await adapty.logShowPaywall(paywall);
  const product = await adapty.getPaywallProducts(paywall);

  console.log(JSON.stringify(product));


  try {
    console.log('[ADAPTY] Purchasing product: ', product);
    await adapty.makePurchase(product);
    console.log('[ADAPTY] Purchase successful');
  } catch (error) {
    console.log('[ADAPTY] Error:', error.message);
    if (error instanceof AdaptyError) {
      Alert.alert(
        `Error purchasing product #${error.adaptyCode}`,
        error.localizedDescription,
      );
    }
  }