Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The completion block is not working when downgrade plan #3020

Closed
Abbott-Deng opened this issue Aug 16, 2023 · 5 comments · Fixed by #3028
Closed

The completion block is not working when downgrade plan #3020

Abbott-Deng opened this issue Aug 16, 2023 · 5 comments · Fixed by #3028
Labels
bug status: needs-additional-info Issues that are missing steps from bug template

Comments

@Abbott-Deng
Copy link

Abbott-Deng commented Aug 16, 2023

Describe the bug
A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

  1. Environment
    1. Platform: iOS
    2. SDK version:4.25.3
    3. OS version:iOS 17
  2. Steps to reproduce, I purchase / upgrade plan is working fine, But It's reproduced when I try to downgrade my plan.

Additional context

2023-08-15 10:40:29.153671+0800 Hobnob-Staging[1667:246401] [purchases] INFO: 💰 Purchasing Product 'staging_sub_premium_2_yearly'
2023-08-15 10:40:29.153911+0800 Hobnob-Staging[1667:246401] [purchases] DEBUG: ℹ️ Adding payment for product 'staging_sub_premium_2_yearly'. 0 transactions already in the queue.
2023-08-15 10:40:29.156959+0800 Hobnob-Staging[1667:247367] [purchases] DEBUG: ℹ️ StoreKit1Wrapper (0x00000002813a89c0) updatedTransaction: staging_sub_premium_2_yearly 0
2023-08-15 10:40:29.165165+0800 Hobnob-Staging[1667:247367] [purchases] VERBOSE: The SKPaymentTransaction has a nil value for transaction date - this is a bug in StoreKit.
2023-08-15 10:40:29.165220+0800 Hobnob-Staging[1667:247367] [purchases] VERBOSE: The SKPaymentTransaction has a nil value for transaction identifier - this is a bug in StoreKit.
2023-08-15 10:40:56.451599+0800 Hobnob-Staging[1667:247796] [purchases] DEBUG: ℹ️ StoreKit1Wrapper (0x00000002813a89c0) updatedTransaction: staging_sub_premium_2_yearly 2000000390174047 2000000390162515 1
2023-08-15 10:40:56.464335+0800 Hobnob-Staging[1667:247796] [purchases] DEBUG: ℹ️ TransactionPoster: handling transaction for product 'staging_sub_premium_2_yearly'
2023-08-15 10:40:58.494275+0800 Hobnob-Staging[1667:246401] [purchases] INFO: 💰 Finishing transaction '2000000390174047' for product 'staging_sub_premium_2_yearly'
2023-08-15 10:40:59.494227+0800 Hobnob-Staging[1667:247800] [purchases] DEBUG: ℹ️ StoreKit1Wrapper (0x00000002813a89c0) removedTransaction: staging_sub_premium_2_yearly 2000000390174047 2000000390162515 1
2023-08-15 10:40:59.502499+0800 Hobnob-Staging[1667:246401] [purchases] INFO: 😻💰 Purchased product - 'staging_sub_premium_2_yearly'
2023-08-15 10:41:07.178494+0800 Hobnob-Staging[1667:247800] [purchases] DEBUG: ℹ️ StoreKit.Transaction.updates: received transaction for product 'staging_sub_premium_2_yearly'
2023-08-15 10:41:07.178770+0800 Hobnob-Staging[1667:247800] [purchases] DEBUG: ℹ️ TransactionPoster: handling transaction for product 'staging_sub_premium_2_yearly'
2023-08-15 10:41:08.140567+0800 Hobnob-Staging[1667:246401] [purchases] INFO: 💰 Finishing transaction '2000000390174047' for product 'staging_sub_premium_2_yearly'
2023-08-15 10:43:54.146842+0800 Hobnob-Staging[1667:246401] [purchases] INFO: 💰 Purchasing Product 'staging_sub_new_essentials_1_month'
2023-08-15 10:43:54.146997+0800 Hobnob-Staging[1667:246401] [purchases] DEBUG: ℹ️ Adding payment for product 'staging_sub_new_essentials_1_month'. 0 transactions already in the queue.
2023-08-15 10:43:54.150384+0800 Hobnob-Staging[1667:248745] [purchases] DEBUG: ℹ️ StoreKit1Wrapper (0x00000002813a89c0) updatedTransaction: staging_sub_new_essentials_1_month 0
2023-08-15 10:43:54.150488+0800 Hobnob-Staging[1667:248745] [purchases] VERBOSE: The SKPaymentTransaction has a nil value for transaction date - this is a bug in StoreKit.
2023-08-15 10:43:54.150517+0800 Hobnob-Staging[1667:248745] [purchases] VERBOSE: The SKPaymentTransaction has a nil value for transaction identifier - this is a bug in StoreKit.
2023-08-15 10:44:17.738108+0800 Hobnob-Staging[1667:249090] [purchases] DEBUG: ℹ️ StoreKit1Wrapper (0x00000002813a89c0) updatedTransaction: staging_sub_new_essentials_1_month 2000000390174047 2000000390162515 1
2023-08-15 10:44:17.755479+0800 Hobnob-Staging[1667:249090] [purchases] DEBUG: ℹ️ TransactionPoster: handling transaction for product 'staging_sub_new_essentials_1_month'
2023-08-15 10:44:19.659670+0800 Hobnob-Staging[1667:246401] [purchases] INFO: 💰 Finishing transaction '2000000390174047' for product 'staging_sub_new_essentials_1_month'
2023-08-15 10:44:19.673546+0800 Hobnob-Staging[1667:249092] [purchases] DEBUG: ℹ️ StoreKit1Wrapper (0x00000002813a89c0) removedTransaction: staging_sub_new_essentials_1_month 2000000390174047 2000000390162515 1
2023-08-15 10:44:19.677143+0800 Hobnob-Staging[1667:246401] [purchases] VERBOSE: PurchasesOrchestrator (0x00000001083f17f0): will not notify callback for transaction '2000000390174047'. Transaction date '2023-08-15 2:40:52 AM +0000' - callback date
@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@NachoSoto
Copy link
Contributor

NachoSoto commented Aug 16, 2023

Thanks for the report! I'm looking into this right now.

Do not remove any of the steps from the template below.

There's a few things missing in your report, please provide these plus a few follow-up questions:

  • Are you able to reproduce this in iOS 16?
  • What version of Xcode are you using? iOS 17 is currently in beta.
  • Is this happening on device or simulator? Sandbox, TestFlight, or production?
  • Can you confirm that staging_sub_premium_2_yearly and staging_sub_new_essentials_1_month are both in the same subscription group?

@NachoSoto
Copy link
Contributor

Also any chance you removed some logs? Looks like you have .verbose level enabled which is great, but there's several logs missing?

@NachoSoto NachoSoto added the status: needs-additional-info Issues that are missing steps from bug template label Aug 16, 2023
NachoSoto added a commit that referenced this issue Aug 16, 2023
I was looking into #3020, and saw that we already have this test to cover downgrades. I added an extra assertion to verify entitlements.
I also ran this test on iOS 17 and it passes.
NachoSoto added a commit that referenced this issue Aug 16, 2023
Looking into #3020, it would have been helpful to see these.
NachoSoto added a commit that referenced this issue Aug 16, 2023
… downgrades

Fixes #3020.
This essentially reverts #2890.

As shown in #3020, downgrades are reported with the same transaction identifier as the original transaction. Therefore our approach in #2890 is invalid.
We considered checking whether the `SKPayment` in the `SKPaymentTransaction` matches the one added to the queue as a way to disambiguate these transactions, but it doesn't. So we have no way of telling the difference between queue transactions and purchases.

I've left the original tests as a way to at least document this behavior.
@NachoSoto
Copy link
Contributor

Thanks again for the report. We've identified the issue thanks to your logs, and are preparing a new release with the fix.

NachoSoto added a commit that referenced this issue Aug 16, 2023
Looking into #3020, it would have been helpful to see these.
NachoSoto added a commit that referenced this issue Aug 16, 2023
…3025)

I was looking into #3020, and saw that we already have this test to
cover downgrades. I added an extra assertion to verify entitlements.
I also ran this test on iOS 17 and it passes.
NachoSoto added a commit that referenced this issue Aug 16, 2023
… downgrades (#3028)

Fixes #3020.
This essentially reverts #2890.

As shown in #3020, downgrades are reported with the same transaction
identifier as the original transaction. Therefore our approach in #2890
is invalid.
We considered checking whether the `SKPayment` in the
`SKPaymentTransaction` matches the one added to the queue as a way to
disambiguate these transactions, but it doesn't. So we have no way of
telling the difference between queue transactions and purchases.

I've left the original tests as a way to at least document this
behavior.
@github-actions
Copy link

This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 24, 2023
MarkVillacampa pushed a commit that referenced this issue Sep 6, 2023
… downgrades (#3028)

Fixes #3020.
This essentially reverts #2890.

As shown in #3020, downgrades are reported with the same transaction
identifier as the original transaction. Therefore our approach in #2890
is invalid.
We considered checking whether the `SKPayment` in the
`SKPaymentTransaction` matches the one added to the queue as a way to
disambiguate these transactions, but it doesn't. So we have no way of
telling the difference between queue transactions and purchases.

I've left the original tests as a way to at least document this
behavior.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug status: needs-additional-info Issues that are missing steps from bug template
Projects
None yet
3 participants