You might have received an email from Apple about the new european legislation starting on December 31, 2020 (https://developer.apple.com/support/psd2/).
Basically some users in the EU purchasing your in-app products will have to be redirected to a webpage of their bank to complete the payment.
We were thinking StoreKit would work exactly like ApplePay which already meets SCA requirements and doesn't need any redirection to complete the payment but surprisingly it doesn't!
On the other side Google did not communicate at all about how SCA will affect the in-app purchases on Android.
We contacted Apple and Google to get more information and we'll share with you anything interesting we learn 🙂.
In the meantime here is what we know.
How does it work exactly on iOS?
Apple said it's gonna be the same as:
- When a kid use the Ask to buy feature to ask the permission of the parents to buy an in-app product.
- When a user need to agree to updated App Store terms and conditions before completing a purchase.
We are still waiting to get more information from Apple about that subject because these two features work a little bit differently:
- The 'Ask to buy' feature will trigger a deferred transaction state followed by a purchased transaction state if the purchase is successful.
- The 'Agreement requirement' will trigger a failed transaction state followed by a purchased transaction state if the purchase is successful.
You can test your implementation pretty easily by emulating an interrupted purchase (Agreement requirement) on the App Store Connect:
- Go to Users and Access
- Click on Sandbox -> Testers in the left menu
- Click on your sandbox user
- Enable the checkbox
Interrupt Purchases for This Tester
How does it work exactly on Android?
We are still waiting to get more information from Google (surprising they did not communicate about it) but we assume it'll work just like a Pending transaction.
It may also just work like a regular transaction which would be very smart from Google to avoid any potential issue on existing apps.
A pending transaction will trigger a purchase with the state
PENDING followed by the state
PURCHASED if the transaction is a success.
You can test your implementation by using the 'Slow test card' option when purchasing a product in sandbox.
For some reason the option is only available for products, not subscriptions.
I'm using IAPHUB, what should I do?
You should update react-native-iaphub to the latest version (v6.0.3), otherwise the purchase will still be processed but the buy method might throw an unexpected error.
You should double check you're handling the case the buy method throw a
deferred_paymenterror, example here.
If you're migrating from v4 or v5, the only breaking change you should check is the
getActiveProducts()method that introduce the new
subscriptionStateproperty and doesn't return subscriptions on a paused or retry period by default, more informations here.