구매 오류가 발생했을 때 호출되는 콜백을 등록합니다
.remove()를 호출하여 업데이트 수신을 중지할 수 있는
React Native Emitter Subscription을 반환합니다.
purchaseErrorListener((error: PurchaseError) => {});
import React, {useEffect} from 'react';
import {View} from 'react-native';
import {purchaseErrorListener} from 'react-native-iap';
const App = () => {
  useEffect(() => {
    const subscription = purchaseErrorListener((error: PurchaseError) => {
      console.log(error);
    });
    return () => {
      subscription.remove();
    };
  }, []);
  return <View />;
};
스토어에 아직 완료되지 않았거나, 소비되었거나, 승인되지 않은 구매에 대한 업데이트가 있을 때 호출되는 콜백을 등록합니다.
.remove()를 호출하여 업데이트 수신을 중지할 수 있는 React Native Emitter Subscription을 반환합니다. 가능한 빨리 청취자를 등록하고 항상 업데이트에 응답하십시오.
purchaseUpdatedListener((purchase: Purchase) => {});
import React, {useEffect} from 'react';
import {View} from 'react-native';
import {purchaseUpdatedListener} from 'react-native-iap';
const App = () => {
  useEffect(() => {
    const subscription = purchaseUpdatedListener((purchase: Purchase) => {
      console.log(purchase);
    });
    return () => {
      subscription.remove();
    };
  }, []);
  return <View />;
};
profile
Add IAP promoted subscription event.
향상된 IAP 구독 이벤트 추가
promotedProductListener((productId?: string) => {});
import React, {useEffect} from 'react';
import {View} from 'react-native';
import {promotedProductListener} from 'react-native-iap';
const App = () => {
  useEffect(() => {
    const subscription = promotedProductListener((productId) => {
      console.log(productId);
    });
    return () => {
      subscription.remove();
    };
  }, []);
  return <View />;
};