Skip to content

Commit

Permalink
Merge pull request #307 from stevewinn74/master
Browse files Browse the repository at this point in the history
Trying to get purchase Token on GetPurchase
  • Loading branch information
jamesmontemagno committed Sep 1, 2020
2 parents 2543e51 + fb19094 commit ddfd2ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Plugin.InAppBilling/InAppBilling.apple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -471,14 +471,17 @@ public static InAppBillingPurchase ToIABPurchase(this SKPaymentTransaction trans
if (p == null)
return null;

var finalToken = p.TransactionReceipt?.GetBase64EncodedString(NSDataBase64EncodingOptions.None);
if (string.IsNullOrEmpty(finalToken))
finalToken = transaction.TransactionReceipt?.GetBase64EncodedString(NSDataBase64EncodingOptions.None);

return new InAppBillingPurchase
return new InAppBillingPurchase
{
TransactionDateUtc = NSDateToDateTimeUtc(transaction.TransactionDate),
Id = p.TransactionIdentifier,
ProductId = p.Payment?.ProductIdentifier ?? string.Empty,
State = p.GetPurchaseState(),
PurchaseToken = p.TransactionReceipt?.GetBase64EncodedString(NSDataBase64EncodingOptions.None) ?? string.Empty
PurchaseToken = finalToken
};
}

Expand Down

0 comments on commit ddfd2ce

Please sign in to comment.