• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Steven-Walker · Oct 04, 2011 at 11:35 PM · macin-app purchasemac app storereceipt

How to implement Mac App Store in-app purchase and receipt verfication?

I'm trying to build a Mac desktop version of our iPad app, but I'm running into issues implementing in-app purchase and receipt verification. Is this possible with Unity and has anybody done it? To clarify, I'm not just trying to submit my app to the Mac App Store, but I need IAP and receipt verification.

I've built a plugin for Unity to handle the IAP and receipts (in Xcode), but because the app is not being built and run from Xcode, it does not appear to be entering sandbox mode. The only information on this that I can find in the docs is "Test During the Development Process":

http://developer.apple.com/library/mac/#releasenotes/General/ValidateAppStoreReceipt/_index.html

It suggest that the app should exit with code 173 when the receipt file isn't found and that the sandbox receipt will automatically be downloaded. It should be in the app in "Contents/_MASReceipt/receipt". I'm doing exactly this with my bundle using exit(173). The app exits, but no receipt is downloaded.

Since I've been unable to get my app to connect to the sandbox, I thought I'd try using a sample receipt, but the little instruction I've found doesn't work. In any case, I think I need a real receipt to work with.

Also, in case anybody asks I have done the usual required steps for submitting the app to the Mac App Store, updating the Info.plist, icons and running codesign and productbuild.

TL;DR - How do you retrieve the app receipt for a Unity mac desktop app during development?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Mar 22, 2016 at 04:28 PM 0
Share

these days, the best technology by far is http://receigen.etiemble.com

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Steven-Walker · Oct 05, 2011 at 08:03 PM

After quite a bit of work I've found a solution. For anyone else trying to do this, here are the general steps...

1) Build a default Xcode Cocoa app and implement all your in-app purchase and receipt verification code. The app doesn't need to do anything when run, just test that transactions and verification are working in sandbox mode.

2) Build a bundle as a plugin for Unity with the same code from your test app. Add the bundle to Assets/Plugins with your binding code, then build the app (Mac OS X Intel Only).

3) Open the package contents of the app and update the Info.plist, and other files as needed. Follow the usual steps for app store submission up to the codesign step. http://forum.unity3d.com/threads/71340-Submit-Unity-games-to-the-Mac-App-Store!

4) Open the contents of your Xcode app build (from step 1) and copy the _MASReceipt folder over to the contents of your Unity build. This is necessary because insofar as I've seen, running the app built from Unity doesn't trigger the sandbox mode and thus does not receive a receipt. As long as your Unity app has the right bundle ID and code signature, it validates the receipt correctly.

All of this is pretty time consuming, since you have to repeat steps 3 and 4 every time you do a new build. So it's best to save this as the last development phase.

I also found this post... though since I implemented my own I haven't tried it: http://forum.unity3d.com/threads/76764-Mac-App-Store-Receipt-Validation-Plugin-Enjoy-%29

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Steven-Walker · Oct 19, 2011 at 01:34 AM 1
Share

It turns out I may have been wrong about this. For some reason the app has started pulling the receipt by itself, even when I rebuild it from Unity. I might have overlooked a setting in the Info.plist initially.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Mac App Sandbox Adding Capabilities 0 Answers

In-app purchase "Invalid product" on Mac Store build 0 Answers

Submit to Mac App Store? Unitys guide is outdated 0 Answers

Stuck: Can't publish game in app Store (unity games don't meet platform requirements?) 2 Answers

Visual Studio alternatives for Mac 3 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges