Hi Jeff, Team,
Firstly thank you for all your hard work with the unity IAP. Much appreciated.
Reference:
Having read this Unity - Manual: Receipt validation
I am modifying the Samples\In App Purchasing\4.0.3\In App Purchasing Sample\script\IAPDemo.cs
Specifically:
public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs e)
{
var result = validator.Validate(e.purchasedProduct.receipt);
foreach (IPurchaseReceipt productReceipt in result) {
GooglePlayReceipt google = productReceipt as GooglePlayReceipt;
if (null != google) {
SendReceiptToServerForValidation(googleReceipt);
How do I get the Google Play actual receipt googleReceipt?
The “google” variable doesn’t seem to have this specifically where can I get this information:
Google Play: A Google Play’s receipt consists of two components.
- Signed Data: A JSON data of what the end user purchased.
- Signature: A base64 encoded string.
}
AppleInAppPurchaseReceipt apple = productReceipt as AppleInAppPurchaseReceipt;
if (null != apple) {
Is this the right way to get the raw apple receipt?
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
// Get a reference to IAppleConfiguration during IAP initialization.
var appleConfig = builder.Configure();
var receiptData = System.Convert.FromBase64String(appleConfig.appReceipt);
AppleReceipt appleReceipt = new AppleValidator(AppleTangle.Data()).Validate(receiptData);
>> so I can call this:
SendReceiptToServerForValidation(appleReceipt);
Note: appleReceipt: An Apple’s receipt is a base64 encoded string.
}
}
}
I hope this is clear enough, essentially, I want to validate on the server. I need to pass the receipt to the server to validate. I had a look at this: GitHub - voltrue2/in-app-purchase: A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows. which seems to be the recommended way of doing it using NodeJS. I just dont see where I can get the raw Receipts needed to pass to this script.
The raw classes seem to be
\com.unity.purchasing@4.0.3\Runtime\SecurityStub\GooglePlayReceipt.cs
\com.unity.purchasing@4.0.3\Runtime\SecurityCore\AppleReceipt.cs
Please can you help?
Thanks!