-
Notifications
You must be signed in to change notification settings - Fork 338
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
Support Redeeming Win-Back Offers with Streamlined Purchasing Disabled #4370
Support Redeeming Win-Back Offers with Streamlined Purchasing Disabled #4370
Conversation
…ined_purchases_disabled
…ined_purchases_disabled
/** | ||
* Constructs an Error with the ``ErrorCode/invalidSubscriptionOffer`` code. | ||
*/ | ||
static func invalidSubscriptionOfferError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm probably missing something but I can't find where this error is used 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh. This was used in the purchase(sk2Product:winbackOffer:)
function that we removed earlier in the review process. Good catch! 😄
I've removed this in 08ebe4f. We might want to bring back something similar when implementing win-backs into the purchase params, but we can cross that bridge when we get there 😄
…ined_purchases_disabled
…ined_purchases_disabled
// stop the compiler from checking availability in the functions. | ||
// We also need to ensure that we're on Xcode >= 15.3, since that is when | ||
// PurchaseIntents were first made available on macOS. | ||
#if !os(tvOS) && !os(watchOS) && compiler(>=5.10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work if we add the availability to the function instead?
…ined_purchases_disabled
@RCGitBot please test |
@RCGitBot please test |
@RCGitBot please test |
@RCGitBot please test |
…ined_purchases_disabled
@RCGitBot please test |
…ined_purchases_disabled
@RCGitBot please test |
This PR adds support for redeeming win-back offers with Streamlined Purchasing disabled.
Feature Availability
This feature is available for developers under the following conditions:
Implementation Details
Observing the SK1 Payment Queue
Apple has a note in their PurchaseIntent docs that reads:
Of course, we can't perform conditional compilation based on the OS since version since that isn't known at compile time. Instead, this PR modifies the
PaymentQueueWrapper
class used when the SDK is running in SK2 mode so that it only observes the SK1 payment queue when thePurchaseIntents
API is available (iOS >=16.4, macOS >=14.4, compiled on Xcode >=16.0).API Changes
There are no breaking API changes with this PR. When we receive a Purchase Intent with a win-back offer attached to it, we call the
PurchaseDelegate
'sreadyForPromotedProduct()
function, and when the developer is ready for the user to complete the win-back offer redemption flow, they call its completion handler.OS/Feature Availability
PurchaseIntents were introduced in iOS 16.4, so we need to be careful about whether we use PurchaseIntents or SK1, depending on the runtime environment. Here's a full matrix of what features/technologies are available on each OS version:

Testing