Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PurchaseToken is always NULL in the iOS plugin #147

Closed
jahlen opened this issue May 2, 2018 · 4 comments
Closed

PurchaseToken is always NULL in the iOS plugin #147

jahlen opened this issue May 2, 2018 · 4 comments

Comments

@jahlen
Copy link

jahlen commented May 2, 2018

Hi,

I was trying to implement server side verification of iOS InApp purchases, and never was able to get anything but NULL in the PurchaseToken.

I checked the source code and noticed that the PurchaseToken is never set from either InAppBillingImplementation.PurchaseAsync or InAppBillingImplementation.ToIABPurchase.

Probably this is because there is nothing called PurchaseToken in iOS, but instead a TransactionReceipt (which can be validated server side against https://buy.itunes.apple.com/verifyReceipt or https://sandbox.itunes.apple.com/verifyReceipt).

I see that the IInAppBillingVerifyPurchase callback is passed a receipt, but that is the receipt for the app (NSBundle.MainBundle.AppStoreReceiptUrl) instead of the InAppPurchase receipt.

Suggestions

  • Pass the TransactionReceipt in the PurchaseToken field
  • In the IInAppBillingVerifyPurchase callback, make sure to pass the TransactionReceipt from the InAppPurchase, not the app

I can provide the code changes if that helps.

Kind Regards
Johan

@jahlen
Copy link
Author

jahlen commented May 2, 2018

Hi James,
Thanks for quickly changing this. However, the PurchaseAsync method also needs to be updated.
Kind Regards,
Johan

jamesmontemagno added a commit that referenced this issue May 2, 2018
@jamesmontemagno
Copy link
Owner

all done, thanks

@jahlen
Copy link
Author

jahlen commented May 16, 2018

Hi James,
Any chance you will update the package on NuGet soon? It's still version 1.2.5 (from before this change).
Thanks!

@erviem99
Copy link

Note that TransactionReceipt is deprecated!

Apple recommends using the mainBundle's appStoreReceiptURL instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants