Skip to content

Commit

Permalink
Merge pull request #136 from tenjin/release-1.13.0
Browse files Browse the repository at this point in the history
Release 1.13.0
  • Loading branch information
giraldogdiego authored Oct 18, 2023
2 parents 6942b3b + be2c3cf commit 5364368
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 13 deletions.
53 changes: 40 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,24 @@ instance.Connect();

## <a id="ios-iap-validation"></a>iOS IAP Validation

iOS receipt validation requires `transactionId` and `receipt` (`signature` will be set to `null`). For `receipt`, be sure to send the receipt `Payload`(the base64 encoded ASN.1 receipt) from Unity.
iOS receipt validation requires `transactionId` and `receipt`. For `receipt`, be sure to send the receipt `Payload` (the base64 encoded ASN.1 receipt) from Unity.

**IMPORTANT:** If you have subscription IAP, you will need to add your app's shared secret in the <a href="https://www.tenjin.io/dashboard/apps" target="_new">Tenjin dashboard</a>. You can retrieve your iOS App-Specific Shared Secret from the <a href="https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/887212194/addons" target="_new">iTunes Connect Console</a> \> Select your app \> Features \> In-App Purchases \> App-Specific Shared Secret.
**IMPORTANT:** If you have subscription IAP, you will need to add your app's shared secret in the <a href="https://www.tenjin.io/dashboard/apps" target="_new">Tenjin dashboard</a>. You can retrieve your iOS App-Specific Shared Secret from the <a href="https://appstoreconnect.apple.com/" target="_new">App Store Connect</a> \> Select your app \> General \> App Information \> App-Specific Shared Secret.

## <a id="android-iap-validation"></a>Android IAP Validation

Android receipt validation requires `receipt` and `signature` are required (`transactionId` is set to `null`).
### <a id="android-iap-validation-google"></a>Google Play App Store

Google Play receipt validation requires `receipt` and `signature` parameters.

**IMPORTANT:** You will need to add your app's public key in the <a href="https://www.tenjin.io/dashboard/apps" target="_new">Tenjin dashboard</a>. You can retrieve your Base64-encoded RSA public key from the <a href="https://play.google.com/apps/publish/" target="_new"> Google Play Developer Console</a> \> Select your app \> Monetization setup.

### <a id="android-iap-validation-amazon"></a>Amazon AppStore

Amazon AppStore receipt validation requires `receiptId` and `userId` parameters.

**IMPORTANT:** You will need to add your Amazon app's Shared Key in the <a href="https://www.tenjin.io/dashboard/apps" target="_new">Tenjin dashboard</a>. The shared secret can be found on the Shared Key in your developer account with the <a href="https://developer.amazon.com/settings/console/sdk/shared-key/" target="_new">Amazon Appstore account</a>

**IMPORTANT:** You will need to add your app's public key in the <a href="https://www.tenjin.io/dashboard/apps" target="_new">Tenjin dashboard</a>. You can retrieve your Base64-encoded RSA public key from the <a href="https://play.google.com/apps/publish/" target="_new"> Google Play Developer Console</a> \> Select your app \> Monetization setup. Please note that for Android, we currently only support IAP transactions from Google Play.

### iOS and Android IAP Example:

Expand All @@ -489,16 +498,27 @@ In the example below, we are using the widely used <a href="https://gist.github.
return;
}

var payload = (string)wrapper["Payload"]; // For Apple this will be the base64 encoded ASN.1 receipt
var store = (string)wrapper["Store"]; // GooglePlay, AmazonAppStore, AppleAppStore, etc.
var payload = (string)wrapper["Payload"]; // For Apple this will be the base64 encoded ASN.1 receipt. For Android, it is the raw JSON receipt.
var productId = purchaseEventArgs.purchasedProduct.definition.id;

#if UNITY_ANDROID

var gpDetails = Json.Deserialize(payload) as Dictionary<string, object>;
var gpJson = (string)gpDetails["json"];
var gpSig = (string)gpDetails["signature"];
if (store.Equals("GooglePlay")) {
var googleDetails = Json.Deserialize(payload) as Dictionary<string, object>;
var googleJson = (string)googleDetails["json"];
var googleSig = (string)googleDetails["signature"];

CompletedAndroidPurchase(productId, currencyCode, 1, lPrice, googleJson, googleSig);
}

if (store.Equals("AmazonApps")) {
var amazonDetails = Json.Deserialize(payload) as Dictionary<string, object>;
var amazonReceiptId = (string)amazonDetails["receiptId"];
var amazonUserId = (string)amazonDetails["userId"];

CompletedAndroidPurchase(productId, currencyCode, 1, lPrice, gpJson, gpSig);
CompletedAmazonPurchase(productId, currencyCode, 1, lPrice, amazonReceiptId, amazonUserId);
}

#elif UNITY_IOS

Expand All @@ -512,14 +532,20 @@ In the example below, we are using the widely used <a href="https://gist.github.

private static void CompletedAndroidPurchase(string ProductId, string CurrencyCode, int Quantity, double UnitPrice, string Receipt, string Signature)
{
BaseTenjin instance = Tenjin.getInstance("SDK_KEY");
instance.Transaction(ProductId, CurrencyCode, Quantity, UnitPrice, null, Receipt, Signature);
BaseTenjin instance = Tenjin.getInstance("SDK_KEY");
instance.Transaction(ProductId, CurrencyCode, Quantity, UnitPrice, null, Receipt, Signature);
}

private static void CompletedIosPurchase(string ProductId, string CurrencyCode, int Quantity, double UnitPrice, string TransactionId, string Receipt)
{
BaseTenjin instance = Tenjin.getInstance("SDK_KEY");
instance.Transaction(ProductId, CurrencyCode, Quantity, UnitPrice, TransactionId, Receipt, null);
BaseTenjin instance = Tenjin.getInstance("SDK_KEY");
instance.Transaction(ProductId, CurrencyCode, Quantity, UnitPrice, TransactionId, Receipt, null);
}

private static void CompletedAmazonPurchase(string ProductId, string CurrencyCode, int Quantity, double UnitPrice, string ReceiptId, string UserId)
{
BaseTenjin instance = Tenjin.getInstance("SDK_KEY");
instance.TransactionAndroid(ProductId, CurrencyCode, Quantity, UnitPrice, ReceiptId, UserId);
}
```

Expand Down Expand Up @@ -619,6 +645,7 @@ Tenjin supports the ability to integrate with the Impression Level Ad Revenue (I
- AdMob
- Topon
- CAS
- TradPlus

This feature allows you to receive events which correspond to your ad revenue which is affected by each advertisement shown to a user. To enable this feature, follow the below instructions.

Expand Down
8 changes: 8 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,11 @@ v1.12.35

- Android v1.12.24
- iOS v1.12.26

v1.13.0
----
* Added TradPlus ILRD
* Android - Added Amazon IAP transactions

- Android v1.13.0
- iOS v1.12.28
Binary file modified TenjinUnityPackage.unitypackage
Binary file not shown.

0 comments on commit 5364368

Please sign in to comment.