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

Support Fetching and Redeeming Win-Back Offers on Custom Paywall #614

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

fire-at-will
Copy link
Contributor

@fire-at-will fire-at-will commented Dec 12, 2024

This PR exposes four new functions to allow developers to fetch & redeem win-back offers that a subscriber is eligible for in their custom paywalls. These functions only function on iOS 18.0+ and require StoreKit 2 to be used.

Fetching Eligible Win-Back Offers

 public static async getEligibleWinBackOffersForProduct(
    product: PurchasesStoreProduct,
    callback: (winBackOffers: PurchasesWinBackOffer[]) => void,
    errorCallback: (error: PurchasesError) => void
  )

public static async getEligibleWinBackOffersForPackage(
    aPackage: PurchasesPackage,
    callback: (winBackOffers: PurchasesWinBackOffer[]) => void,
    errorCallback: (error: PurchasesError) => void
  )

Redeeming Win-Back Offers

public static async purchaseProductWithWinBackOffer(
    product: PurchasesStoreProduct,
    winBackOffer: PurchasesWinBackOffer,
    callback: ({productIdentifier, customerInfo,}: { productIdentifier: string; customerInfo: CustomerInfo; }) => void,
    errorCallback: ({error, userCancelled,}: { error: PurchasesError; userCancelled: boolean; }) => void,
  )

public static async getEligibleWinBackOffersForPackage(
    aPackage: PurchasesPackage,
    callback: (winBackOffers: PurchasesWinBackOffer[]) => void,
    errorCallback: (error: PurchasesError) => void
  )

Other Changes

The PurchaseTester app was updated with a new screen to support testing these flows

Testing

All flows were tested manually through the new screen in the PurchaseTester app.

@fire-at-will fire-at-will changed the title Support fetching and redeeming winbacks on customer developer paywalls Support Fetching and Redeeming Win-Back Offers on Custom Paywall Dec 12, 2024
@fire-at-will fire-at-will marked this pull request as ready for review December 12, 2024 23:31
@fire-at-will fire-at-will requested review from MarkVillacampa and a team December 12, 2024 23:31
@fire-at-will fire-at-will requested review from MarkVillacampa and a team January 6, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants