tomroyal.com

How to bulk upload Apple In App Purchases (IAPs) via Transporter

It’s easy to create In App Purchases via iTunes Connect – and that’s all well and good if you’re adding two or three. But if you’re uploading, say, 52 weekly issues of a magazine, then not so much.

It’s possible to do this on a Mac using Transporter, but the documentation is both lengthy and unclear. So here’s a quick guide – the below works as of November 2020.

First, get the right version of transporter

You can get Transporter via direct download or the App Store. In my experience both will throw an error if you try to upload IAPs, as they are old and outdated versions (1.9.x) of the tool. Instead, download the latest version of Xcode, which contains version 2.1.x.

You should then find iTMSTransporter inside Xcode.app. For me, the path is:

/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/itms/bin

Before doing anything else, run:

./iTMSTransporter -version

.. in order to trigger the automatic updating of components and report the version number. This can take a while.

Next, pull the current config file

You will deliver the new IAPs to Apple inside an .itmsp bundle. This is a directory called n.itmsp, where n is the ID number of the app, and inside which there is, at a minimum, a file called metadata.xml. Rather than create this from scratch, it’s easiest to grab the current config.

To do that, use:

./iTMSTransporter -m lookupMetadata -u your@email/com -p yourpassword -destination ~/Documents/somepath/ -apple_id 12345678

Substituting your email and password, a valid destination path for the download, and the numeric ID of the app (you can get this from the URL when viewing the app in iTunes Connect, where it appears as apps/idhere/appstore/).

This should run, and return a result like “Saving configuration to local path..”. If you have 2FA enabled you may be prompted to generate an app password – follow the prompts to make one, then re-run the command with that.

Edit Metadata.xml

The next stage is to use the downloaded metadata.xml as a template to add your own new IAPs.

Open the file and remove the <versions> and <products> section from inside <software_metadata> – we don’t want to update these. Also cut all the contents of the <in_app_purchases> tag and paste them to a temporary file. This should leave you with a very brief stub of an XML file, 20 lines or so, containing a blank <in_app_purchases> section.

Now add your new IAPs. Each is an <in_app_purchase> block, and should be added inside <in_app_purchases>. The easiest way to start one is to copy one from your temporary file, and edit as necessary – remember to remove the <read_only_info> section. Of course, if you’re cranking out 200 of them, you’ll probably want to write a little script to create this XML from a template.

If you are supplying review screenshots, paste the files inside the .itmsp directory, and don’t forget to update the MD5 and filesize values in the metadata.xml accordingly.

Save the metadata.xml when done.

Upload the .itmsp to Apple

Once your .itmsp folder contains the updated metadata.xml and any relevant screenshots, you can use iTMSTransporter to push it all back to iTunes Connect. The command for that is:

./iTMSTransporter -m upload -u your@email/com -p yourpassword -f ~/Documents/somepath/yourfilename.itmsp

Substitute your email, password, and the path to your edited .itmsp folder.

If all goes well, you should see those magic words:

The package: /Documents/somepath/yourfilename.itmsp has been successfully uploaded.

Now all that remains is to go back to iTunes Connect, check that everything looks right, and if so, submit them for review.

All © 2020 Tom Royal