User is being asked to enter Apple ID twice during the purchase
Platform
- [x] iOS
In app purchase type
- [x] Non-consumable
- [x] Auto-Renewable Subscription
Environment
- [x] Sandbox
Version
0.13.3
Report
Issue summary
I'm using the following snippet for the subscription purchases:
SwiftyStoreKit.purchaseProduct("my-product", quantity: 1, atomically: true) { result in
switch result {
case .success(let product):
if product.needsFinishTransaction {
SwiftyStoreKit.finishTransaction(product.transaction)
}
let appleValidator = AppleReceiptValidator(service: .production, sharedSecret: secret)
SwiftyStoreKit.verifyReceipt(using: appleValidator) { result in
switch result {
case .success(let receipt):
let purchaseResults = SwiftyStoreKit.verifySubscriptions(ofType: .autoRenewable, productIds: Set(subscriptionService.productIDs), inReceipt: receipt)
switch purchaseResults {
case .purchased(let expiryDate, let items):
...
Here I'm being asked for iTunes Store login twice. First when the purchase is being performed using purchaseProduct and second when I'm retrieving subscriptions from the receipts using verifyReceipt and verifySubscriptions. It's going to be confusing for users to enter Apple ID twice. Has anyone else seen this behavior?
Hi @natacodes,
I have played a bit with this library these last days so I might be able to help.
While on the Sandbox environment, a popup is prompted when you try to download the receipt from Apple. This happens when there is no receipt saved locally in the device and/or when you have the forceRefresh option on.
You also need to log in when making purchases on the sandbox environment. That explains the two login prompts. Now, before your SwiftyStoreKit.verifyReceipt.. line, could you add this debug print before it?
print("Receipt file exists? \(FileManager.default.fileExists(atPath:
Bundle.main.appStoreReceiptURL!.path))")
Once the purchase result is success, I am not sure whether the receipt has already been saved locally or not at that specific moment. If it isn't, then verifyReceipt will need to download it from apple, which will trigger the popup.
Note
-
I don't know whether you should
finishTrasactiononsuccess. I'd expect theSwiftyStoreKit.completeTransactionsblock to take care of it and not having to do duplicate it here. -
Make sure that the Apple ID you are using to test this is a
Sandboxuser for your In-App Purchase.
hi please I have been unable to get this project to work kind view my issue and contribute to it please thanks. https://github.com/bizz84/SwiftyStoreKit/issues/412
I've commented on issue (https://github.com/bizz84/SwiftyStoreKit/issues/307) about this, I think it is not related to this library since it also happens on my other app with native StoreKit implementation.
try to replace SwiftyStoreKit.verifyReceipt(using: appleValidator) with SwiftyStoreKit.verifyReceipt(using: appleValidator, forceRefresh: false) this helps me)
I have a similar issue, but it seems to only happen the first time a purchase is made with a brand new tester account.. The purchase looks like it goes thru, then it starts the billing flow payment sheet over again. The second time, it finished properly..
try to replace SwiftyStoreKit.verifyReceipt(using: appleValidator) with SwiftyStoreKit.verifyReceipt(using: appleValidator, forceRefresh: false) this helps me)
still not working, could be reproduced using only a brand new tester account for first time. Is this expected behavior?
This is an apple bug. It happens on new tester account with plain StoreKit, no swifty involved.. there is a similar ticket explaining such.
On Jan 5, 2022, at 10:10 AM, Jornathan Thorne @.***> wrote:
try to replace SwiftyStoreKit.verifyReceipt(using: appleValidator) with SwiftyStoreKit.verifyReceipt(using: appleValidator, forceRefresh: false) this helps me)
still not working, could be reproduced using only a brand new tester account for first time. Is this expected behavior?
— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you commented.