How to correctly finish transaction for Apple subscription?
See original GitHub issueVersion of react-native-iap
4.6.3
Version of react-native
0.63.4
Platforms you faced the error (IOS or Android or both?)
iOS
Expected behavior
Transaction should be finished and appeared in My subscriptions
Actual behavior
No errors but subscription is not appeared
Tested environment (Emulator? Real Device?)
Real Device, production mode
Steps to reproduce the behavior
await RNIAP.initConnection()
RNIAP.clearProductsIOS()
const products = await RNIAP.getProducts([productId])
RNIAP.purchaseUpdatedListener(async (purchase) => {
// Checking for prod mode first
let result = await RNIAP.validateReceiptIos({
"receipt-data": purchase.transactionReceipt,
"password": env.IOS_IAP_SECRET,
}, false)
// Then for sandbox mode
if (result.status === 21007) {
result = await RNIAP.validateReceiptIos({
"receipt-data": purchase.transactionReceipt,
"password": env.IOS_IAP_SECRET,
}, true)
}
if (result.status !== 0) {
return
}
RNIAP.finishTransaction(purchase, true)
})
RNIAP.purchaseErrorListener(error => {
reject(error)
})
return RNIAP.requestSubscription(productId, false)
Issue Analytics
- State:
- Created 2 years ago
- Comments:8
Top Results From Across the Web
Handling Subscriptions Billing - Apple Developer
For this event, the App Store notifies your server with a notification of type RENEWAL and a new receipt will be generated for...
Read more >Auto-renewing subscription: app-store completes transaction ...
I think before you call recordSubscription method, you can call finish finishTransaction method to remove payment from payment queue because you have ...
Read more >9 fixes for if your iTunes or App Store purchase could not be ...
Seeing the message "{lease contact iTunes support to complete this transaction" or "Your purchase could not be completed"? How to fix it.
Read more >Apple Pay | Stripe Documentation
Using Stripe and Apple Pay versus in-app purchases · Accept Apple Pay · Set up Stripe. Server-side. Client-side · Register for an Apple...
Read more >I'm unable to make credit card purchases! - Wildlife Studios
In-app purchases (IAPs) are mediated by Google or Apple, depending on the ... This is because subscriptions will automatically renew at the end...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @Ulisses1478 Thanks for your answer, but my question was different. In real life backend checks receipt.
Use the latest version of the library and use
finishTransaction