There is a github issue that describes the problem.
opened 02:26AM - 28 Jun 21 UTC
closed 04:10PM - 28 Mar 22 UTC
stale
needs review
### Summary
It appears that the "Ask to buy" or "Deferred" workflow is not supp… orted in iOS. When using a StoreKit configuration with _askToBuyEnabled = true
```
"settings" : {
"_askToBuyEnabled" : true,
"_billingIssuesEnabled" : false,
"_failTransactionsEnabled" : false,
"_storeKitError" : 0
}
```
The application crashes in node_modules/expo-in-app-purchases/ios/EXInAppPurchases/EXInAppPurchasesModule.m in the getTransactionData method, on the line
```
return @{
@"acknowledged": @(acknowledged),
@"productId": transaction.payment.productIdentifier,
@"orderId": transaction.transactionIdentifier,
@"purchaseState": @(transaction.transactionState),
@"purchaseTime": @(transaction.transactionDate.timeIntervalSince1970 * 1000),
@"transactionReceipt": [receiptData base64EncodedStringWithOptions:0],
@"originalPurchaseTime": originalTransactionTime,
@"originalOrderId": originalTransactionId
};
```
The crash occurs because transaction.transactionIdentifier is nil. However, this appears to be "by design" per [Apple's documentation for this property](https://developer.apple.com/documentation/storekit/skpaymenttransaction/1411288-transactionidentifier).
### Managed or bare workflow? If you have `ios/` or `android/` directories in your project, the answer is bare!
bare
### What platform(s) does this occur on?
iOS
### SDK Version (managed workflow only)
_No response_
### Environment
```
Expo CLI 4.7.2 environment info:
System:
OS: macOS 11.2.1
Shell: 5.8 - /bin/zsh
Binaries:
Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node
npm: 6.14.4 - ~/.nvm/versions/node/v12.18.0/bin/npm
Watchman: 2021.06.07.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.7199119
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
expo: ^41.0.0 => 41.0.1
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: 0.63.4 => 0.63.4
react-native-web: ~0.13.12 => 0.13.18
npmGlobalPackages:
expo-cli: 4.7.2
Expo Workflow: bare
```
### Reproducible demo or steps to reproduce from a blank project
Attempt an in-app-purchase with _askToBuyEnabled = true in the StoreKit config as shown above.
Basically, I can’t seem to get Deferred purchases to work with expo-in-app-pirchases. The scenario is typically when a kid asks their parent for permission to purchase an iap. Am I alone? Is anyone else having problems with this use case?
Thanks!
Hey, were you able to get this to work?