Skip to content
Discussion options

You must be logged in to vote

@konson-git Thanks for the question! Please check below!

1. Where to implement useIAP

You can use useIAP on any screen where you need purchase functionality:

// Paywall.tsx
function PaywallScreen() {
  const {requestPurchase} = useIAP({
    onPurchaseSuccess: (purchase) => {
      // Handle subscription activation
      updateUserSubscriptionStatus(purchase);
    },
    onPurchaseError: (error) => {
      // Handle errors
    }
  });

  // Purchase logic here
}

Note: useIAP automatically cleans up listeners when the component unmounts, so you don't need to manage it manually.

You can also implement listeners globally in _layout.tsx if you prefer centralized handling.

2. Restoring purchase…

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
5 replies
@konson-git
Comment options

@hyochan
Comment options

@WillyReyno
Comment options

@hyochan
Comment options

@Navipro70
Comment options

Answer selected by konson-git
Comment options

You must be logged in to vote
3 replies
@Navipro70
Comment options

@hyochan
Comment options

@Navipro70
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants