expo-iap 2.4.5 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -49
- package/package.json +1 -1
- package/docs/README.md +0 -30
package/README.md
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
# Expo IAP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
| In app purchase module in [Expo](https://expo.dev)
|
|
4
|
+
|
|
5
|
+
<div>
|
|
6
|
+
<img src="https://private-user-images.githubusercontent.com/27461460/460432423-3257a1e0-800b-441b-8522-94c35ce751d2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTEyNjQ4NjEsIm5iZiI6MTc1MTI2NDU2MSwicGF0aCI6Ii8yNzQ2MTQ2MC80NjA0MzI0MjMtMzI1N2ExZTAtODAwYi00NDFiLTg1MjItOTRjMzVjZTc1MWQyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNjMwVDA2MjI0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlMjFkNmViZmM5NzZmNzZlMmE2OWZjODU4NjczMTM2N2ZkYWVhY2MzMjc5YmIyMDlhNjRkNmEzNWNhMmI3MjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.BdhwkYigGHbjYLJblwUnHYNkX1-jDAWry0MqeLpfKrA" width="400" />
|
|
7
|
+
</div>
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
[](https://npmjs.org/package/expo-iap) [](https://npmjs.org/package/expo-iap) [](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap?ref=badge_shield&issueType=license)
|
|
6
10
|
|
|
7
11
|
# Notice
|
|
8
12
|
|
|
@@ -13,55 +17,13 @@ The `expo-iap` module has been migrated from [react-native-iap](https://github.c
|
|
|
13
17
|
- [Documentation](./docs/IAP.md)
|
|
14
18
|
- [Error Code Management](./docs/ERROR_CODES.md)
|
|
15
19
|
|
|
16
|
-
##
|
|
17
|
-
|
|
18
|
-
expo-iap now provides a centralized error code system that works consistently across iOS and Android platforms. This system maps platform-specific error codes to standardized TypeScript enums.
|
|
19
|
-
|
|
20
|
-
### Error Codes
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
import {ErrorCode} from 'expo-iap';
|
|
20
|
+
## Installation
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
ErrorCode.E_NETWORK_ERROR; // Network connectivity issue
|
|
28
|
-
ErrorCode.E_ITEM_UNAVAILABLE; // Product not available
|
|
29
|
-
ErrorCode.E_SERVICE_ERROR; // Store service error
|
|
30
|
-
// ... and more
|
|
22
|
+
```bash
|
|
23
|
+
npx expo install expo-iap
|
|
31
24
|
```
|
|
32
25
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
import {
|
|
37
|
-
mapPlatformError,
|
|
38
|
-
isUserCancelledError,
|
|
39
|
-
getUserFriendlyErrorMessage,
|
|
40
|
-
} from 'expo-iap';
|
|
41
|
-
|
|
42
|
-
// Handle purchase errors
|
|
43
|
-
try {
|
|
44
|
-
await requestPurchase({sku: 'product_id'});
|
|
45
|
-
} catch (error) {
|
|
46
|
-
if (isUserCancelledError(error)) {
|
|
47
|
-
// User cancelled - don't show error
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Show user-friendly message
|
|
52
|
-
const message = getUserFriendlyErrorMessage(error);
|
|
53
|
-
Alert.alert('Purchase Failed', message);
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Platform-Specific Error Mapping
|
|
58
|
-
|
|
59
|
-
The system automatically maps platform codes:
|
|
60
|
-
|
|
61
|
-
- **iOS**: Integer codes (0, 1, 2, etc.) → ErrorCode enum
|
|
62
|
-
- **Android**: String codes ("E_USER_CANCELLED", etc.) → ErrorCode enum
|
|
63
|
-
|
|
64
|
-
This ensures consistent error handling regardless of platform.
|
|
26
|
+
For detailed usage examples and error handling, see the [documentation](./docs/IAP.md).
|
|
65
27
|
|
|
66
28
|
> Sharing your thoughts—any feedback would be greatly appreciated!
|
|
67
29
|
|
package/package.json
CHANGED
package/docs/README.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# Documentation
|
|
2
|
-
|
|
3
|
-
This directory contains detailed documentation for expo-iap.
|
|
4
|
-
|
|
5
|
-
## Available Documents
|
|
6
|
-
|
|
7
|
-
- **[API Documentation](./IAP.md)** - Complete API reference and usage examples
|
|
8
|
-
- **[Error Code Management](./ERROR_CODES.md)** - Centralized error handling system documentation
|
|
9
|
-
|
|
10
|
-
## Quick Links
|
|
11
|
-
|
|
12
|
-
- [Main README](../README.md) - Project overview and quick start
|
|
13
|
-
- [Example App](../example/) - Sample implementation
|
|
14
|
-
- [GitHub Issues](https://github.com/hyochan/expo-iap/issues) - Bug reports and feature requests
|
|
15
|
-
|
|
16
|
-
## Contributing
|
|
17
|
-
|
|
18
|
-
If you find any documentation errors or have suggestions for improvements, please:
|
|
19
|
-
|
|
20
|
-
1. Check existing [issues](https://github.com/hyochan/expo-iap/issues)
|
|
21
|
-
2. Create a new issue with the `documentation` label
|
|
22
|
-
3. Submit a pull request with your improvements
|
|
23
|
-
|
|
24
|
-
## Support
|
|
25
|
-
|
|
26
|
-
For questions and support:
|
|
27
|
-
|
|
28
|
-
- 📚 Read the documentation in this folder
|
|
29
|
-
- 🐛 Report bugs via [GitHub Issues](https://github.com/hyochan/expo-iap/issues)
|
|
30
|
-
- 💬 Join discussions in [GitHub Discussions](https://github.com/hyochan/expo-iap/discussions)
|