-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add kmp + unity winback code samples
- Loading branch information
1 parent
5e6da88
commit af5347b
Showing
5 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...tion-guidance/subscription-offers/ios-winback-offers-fetch-eligible-winback-offers-kmp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Purchases.sharedInstance.getEligibleWinBackOffersForPackage( | ||
packageToCheck = packageToCheck, | ||
onError = { error: PurchasesError -> | ||
// TODO: handle the error in your UI | ||
}, | ||
onSuccess = { eligibleWinBackOffers: List<WinBackOffer> -> | ||
// TODO: display eligible win-back offers in your UI | ||
} | ||
) |
11 changes: 11 additions & 0 deletions
11
...on-guidance/subscription-offers/ios-winback-offers-fetch-eligible-winback-offers-unity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Purchases purchases = GetComponent<Purchases>(); | ||
purchases.GetEligibleWinBackOffersForPackage(package, (winBackOffers, error) => { | ||
if (error != null) | ||
{ | ||
// TODO: handle the error in your UI | ||
} | ||
else | ||
{ | ||
// TODO: display eligible win-back offers in your UI | ||
} | ||
}); |
10 changes: 10 additions & 0 deletions
10
...ubscription-guidance/subscription-offers/ios-winback-offers-purchase-winback-offer-kmp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Purchases.sharedInstance.purchase( | ||
packageToPurchase = packageToPurchase, | ||
winBackOffer = winBackOffer, | ||
onError = { error: PurchasesError, userCancelled: Boolean -> | ||
// TODO: handle failed purchase in your UI | ||
}, | ||
onSuccess = { transaction: StoreTransaction, customerInfo: CustomerInfo -> | ||
// TODO: handle successful purchase in your UI | ||
} | ||
) |
15 changes: 15 additions & 0 deletions
15
...scription-guidance/subscription-offers/ios-winback-offers-purchase-winback-offer-unity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Purchases purchases = GetComponent<Purchases>(); | ||
purchases.PurchasePackageWithWinBackOffer( | ||
package, | ||
winBackOffers[0], | ||
(productIdentifier, customerInfo, userCancelled, purchaseError) => | ||
{ | ||
if (purchaseError != null) | ||
{ | ||
// TODO: handle failed purchase in your UI | ||
return; | ||
} | ||
|
||
// TODO: handle successful purchase in your UI | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters