You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. Will this patch/fix from react-native-iap need to be applied to expo-iap? I looked in the ExpoIAPModule.swift file and it appears it still uses the same signature as the RNI file does.
@jlafosse Hi there! Thanks for your enthusiasm about expo-iap—we’re thrilled to have you interested in the project!
Regarding your question about whether the patch from react-native-iap#2715 needs to be applied to expo-iap: you’ve spotted a key similarity! In that react-native-iap issue, the proposed fix changes the signature parsing from signature.data(using: .utf8) to Data(base64Encoded: signature) in RNIapIosSk2.swift to handle base64-encoded signatures correctly, aligning with Apple’s documentation (Generating a Signature for Promotional Offers).
Checking the current ExpoIapModule.swift in expo-iap (line 324), it still uses signature.data(using: .utf8), which assumes a UTF-8 string rather than a base64-encoded string. This could indeed cause the "Unable to Purchase" error you’re encountering when passing a base64-encoded signature, as it’s not being decoded properly before being passed to StoreKit.
Given that:
Apple’s documentation and sample code expect the signature to be base64-encoded.
The react-native-iap discussion identifies this as the fix (though it doesn’t seem to have a merged PR yet).
expo-iap uses the same outdated signature handling.
It looks like this patch should be applied to expo-iap to support promotional offer purchases correctly. The change would be:
// Current line
letsignature= signature.data(using:.utf8)
// Proposed fix
letsignature=Data(base64Encoded: signature)
Since you’ve pinpointed this, I’d encourage you to submit a Pull Request (PR) to the expo-iap repository with this fix! Here’s how:
Update ExpoIapModule.swift at line 324 with the base64 decoding.
Test it with your promotional offer setup (using a base64-encoded signature).
Submit a PR, referencing react-native-iap#2715 and your findings.
This would be a great contribution to ensure expo-iap handles Apple promotional offers properly. Bonus points: since react-native-iap hasn’t merged this fix yet, submitting a similar PR there (https://github.com/hyochan/react-native-iap) would benefit both projects and the wider community! If you’re not up for submitting PRs yourself, I’d be happy to draft them based on your feedback—just let me know!
Can’t wait to see this progress—thanks for diving into this!
Hi. Will this patch/fix from react-native-iap need to be applied to expo-iap? I looked in the ExpoIAPModule.swift file and it appears it still uses the same signature as the RNI file does.
hyochan/react-native-iap#2715 (comment)
https://github.com/hyochan/expo-iap/blob/main/ios/ExpoIapModule.swift#L324C29-L324C42
Excited about this project!
Thanks.
The text was updated successfully, but these errors were encountered: