1.0.4 • Published 12 months ago

expo-external-purchase v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

expo-external-purchase

https://developer.apple.com/documentation/storekit/external_purchase#4327460

Installation in managed Expo projects

npx expo install expo-external-purchase

Settings

{
  "expo": {
    ...
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.your.bundleIdentifier",
      "entitlements": {
        "com.apple.developer.storekit.external-purchase": true,
        "aps-environment": "development"
      },
      "infoPlist": {
        "SKExternalPurchase": ["hu"]
      }
    }
    ...
  }
}

How to use

import { 
  StatusBar } from 'expo-status-bar';
import { 
  StyleSheet, 
  Text, 
  View,
  Button,
  Alert } from 'react-native';
import * as ExpoExternalPurchase from 'expo-external-purchase';
import { useEffect } from 'react';

export default function App() {
  const checkIfCanPresent = async () => {
    try {
      const canPresent = await ExpoExternalPurchase.canPresentAsync();
      if (canPresent) {
        try {
          const result = await ExpoExternalPurchase.presentNoticeSheetAsync();
          console.log('Notice sheet presented successfully:', result);
          Alert.alert('It is working');
          // Call your backend API with token
        } catch (error) {
          console.error('Failed to present notice sheet:', error);
          Alert.alert('Failed to present notice sheet:', error.message);
        }
      } else {
        Alert.alert('The notice sheet cannot be presented.');
      }
    } catch (error) {
      console.error('Failed to check if can present:', error);
      Alert.alert('Failed to check if can present:', error.message);
    }
  };

  return (
    <View style={styles.container}>
      <Text>Apple Expo External Purchase</Text>
      <StatusBar style="auto" />
      <Button
        onPress={checkIfCanPresent}
        title={'Present Apple Notice Sheet'}
      />
    </View>
  );
}
eas build --profile development --platform ios
1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

1 year ago

0.22.0

1 year ago

0.21.0

1 year ago

0.20.0

1 year ago

0.19.0

1 year ago

0.18.0

1 year ago

0.17.0

1 year ago

0.16.0

1 year ago

0.15.0

1 year ago

0.14.0

1 year ago

0.13.0

1 year ago

0.12.0

1 year ago

0.11.0

1 year ago

0.10.0

1 year ago

0.9.0

1 year ago

0.8.0

1 year ago

0.7.0

1 year ago

0.6.0

1 year ago

0.5.0

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago