Skip to content

Commit 715db32

Browse files
committed
refac: treat AdjustAppStorePurchase receipt as UnityIAP base64 encoded one
1 parent eaf5503 commit 715db32

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Assets/Adjust/Test/CommandExecutor.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,10 +993,14 @@ private void VerifyPurchase()
993993
string productId = _command.GetFirstParameterValue("productId");
994994
string receipt = _command.GetFirstParameterValue("receipt");
995995

996+
// recreate UnityIAP base64 encoding of the receipt
997+
var receiptBytes = System.Text.Encoding.UTF8.GetBytes(receipt);
998+
string receiptBase64 = System.Convert.ToBase64String(receiptBytes);
999+
9961000
AdjustAppStorePurchase purchase = new AdjustAppStorePurchase(
9971001
transactionId,
9981002
productId,
999-
receipt);
1003+
receiptBase64);
10001004

10011005
Adjust.verifyAppStorePurchase(purchase, VerificationInfoCallback);
10021006
#elif UNITY_ANDROID

Assets/Adjust/iOS/AdjustUnity.mm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,8 @@ void _AdjustVerifyAppStorePurchase(const char* transactionId,
863863

864864
// Receipt.
865865
if (receipt != NULL) {
866-
dataReceipt = [[NSString stringWithUTF8String:receipt] dataUsingEncoding:NSUTF8StringEncoding];
866+
NSString *stringReceiptBase64 = [NSString stringWithUTF8String:receipt];
867+
dataReceipt = [[NSData alloc] initWithBase64EncodedString:stringReceiptBase64 options:0];
867868
}
868869

869870
// Scene name.

0 commit comments

Comments
 (0)