Shadowman
Shadowman

Reputation: 12079

Use iTMSTransporter to update In-App Purchases?

I've been checking out Apple's iTMSTransporter and have found it will be a very valuable tool for us to use in our CI/CD pipeline. I looked at the lookupMetadata operation, and it provides a ton of valuable information for monitoring our apps, statuses, and defined in-app purchases. One thing we would love to be able to do, though, is take the output metadata XML of that operation, modify the in-app purchase details, and then update it using iTMSTransporter. Is that a supported option?

For more info, iTMSTransporter -m lookupMetadata <options> will spit out a file called metadata.xml containing detailed information about an app. A snippet of this XML looks like this...

<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://apple.com/itunes/importer" version="software5.11">
   
    <metadata_token>1592855553024-a491289f7f79e4f8dcbdae34cf41ef4485928389987f3b4cc3323111c85b37</metadata_token>
    <provider>MyCorp12345</provider>
    <team_id>CQQR623213B5</team_id>
    <software>
        <vendor_id>com.myapp.PurchaseTest</vendor_id>
        <read_only_info>
            <read_only_value key="apple-id">342453443</read_only_value>
        </read_only_info>
        <software_metadata app_platform="ios">
            <versions>
                <version string="1.0">
                    <locales>
                        <locale name="en-US">
                            <title>PurchaseTestSN</title>
                        </locale>
                    </locales>
                </version>
            </versions>
            <in_app_purchases>
                <in_app_purchase>
                    <product_id>com.myapp.PurchaseTest.Consumable2</product_id>
                    <reference_name>Consumable2</reference_name>
                    <type>consumable</type>
                    <products>
                        <product>
                            <cleared_for_sale>true</cleared_for_sale>
                            <intervals>
                                <!--The following <interval> element represents a snapshot of present and future pricing and availability information.
In other words, past data may not be reflected by this interval.-->
                                <interval>
                                    <start_date>2020-06-22</start_date>
                                    <wholesale_price_tier>2</wholesale_price_tier>
                                </interval>
                            </intervals>
                        </product>
                    </products>
                    <locales>
                        <locale name="en-US">
                            <title>Consumable2</title>
                            <description>Consumable2</description>
                        </locale>
                    </locales>
                    <read_only_info>
                        <read_only_value key="apple-id">435324234</read_only_value>
                        <read_only_value key="iap-status">Waiting for Screenshot</read_only_value>
                    </read_only_info>
                </in_app_purchase>
  ...
</package>

I would love to be able to edit the details for com.myapp.PurchaseTest.Consumable2 -- pricing or description, for example -- and upload those changes using iTMSTransporter in an automated fashion. Is this possible using iTMSTransporter? I also investigated the App Store Connect API, but didn't see that capability supported. Is there a different or better way to accomplish this?

Upvotes: 1

Views: 672

Answers (1)

k1th
k1th

Reputation: 1332

There is an article on Medium:

https://medium.com/@tonyspin/uploading-ios-in-app-purchase-downloadable-content-727e0d2c0531

that explains the process quite well. You use lookupMetadata to get the itmsp bundle. Inside there is the metadata.xml.

Some additional notes:

My process is as follows:

Download package

/usr/local/itms/bin/iTMSTransporter -m lookupMetadata -u your_user -p your_appspecific_pw  -vendor_id your_verndor -itc_provider your_provider -destination .

Then rename the downloaded package and modify the metadata.xml inside:

  • Remove <versions> completely

  • Remove <products> completely

  • Add a review image to the directory, like review.png

  • For each IAP, add the metadata and image data and a note:

       <in_app_purchase>
          …all the metadata…
          <review_screenshot>
              <size>724661</size>
              <file_name>review.png</file_name>
              <checksum type="md5">34c788f999e81349f9a05342c3ccf144</checksum>
          </review_screenshot>
          <review_notes>Additional discounts</review_notes>
      </in_app_purchase>
    

Verify with:

 /usr/local/itms/bin/iTMSTransporter -m verify -u your_user -p your_appspecific_pw  -vendor_id your_verndor -itc_provider your_provider -f your_modified_package.itmsp

Finally upload

 /usr/local/itms/bin/iTMSTransporter -m upload -u your_user -p your_appspecific_pw  -vendor_id your_verndor -itc_provider your_provider -f your_modified_package.itmsp

This will overwrite, what you already have in the IAPs, so be careful. The uploaded data won't appear right away, but after ~30 minutes or longer, be patient.

Upvotes: 2

Related Questions