Im trying to figure out a way to automate the creation of In App Purchases in a mobile app in app store connect, as I have a batch of 200+. Was trying to use fastlane and spaceship but the Tunes:: method was deprecated and couldnt find any other way to address this ops. In the updated list of fastlane the isnt any function calling In App Purchases. In my web search I found similiar problems. ChatGPT told my to try: Spaceship::ConnectAPI::InAppPurchase.create but this option isnt exist. This is the code I tried: (chatGPT code)
require "spaceship"
# 1. Login to App Store Connect with your Apple ID
Spaceship::ConnectAPI.login(
"YOUR_APPLE_ID",
"YOUR_APP_SPECIFIC_PASSWORD" # if 2FA is enabled
)
# 2. Find your app using the newer ConnectAPI
app = Spaceship::ConnectAPI::App.find("company.yourapp")
unless app
puts "App not found. Check your bundle ID or account/team."
exit
end
# 3. Create a consumable in-app purchase with a review screenshot
Spaceship::ConnectAPI::InAppPurchase.create(
app_id: app.id,
reference_name: "My New Consumable",
product_id: "company.yourapp.item1",
in_app_purchase_type: Spaceship::ConnectAPI::InAppPurchaseType::CONSUMABLE,
family_sharable: false, # Consumables typically aren't sharable
review_note: "Optional notes for Apple's reviewer, if desired",
# Provide a valid path to your screenshot here (Windows example):
# Use forward slashes or double backslashes
review_screenshot: "C:/path/to/your_screenshot.png",
# 4. Localizations (must have at least one locale)
in_app_purchase_localizations: [
{
locale: "en-US",
name: "New Consumable",
description: "Description of what this consumable does"
}
# You could add more localizations if needed, e.g. 'fr-FR', 'de-DE', etc.
],
# 5. Pricing (optional, but many want at least a base price)
prices: [
{
territory: "US", # ISO country code for the U.S.
value: 0.99 # Price in USD
}
]
)
puts "In-app purchase created successfully!"
Does anyone faced similar problem? what was your solution?
Use the Tunes:: Method but it got deprecated and doesnt work. Find a soulution online, some say you can use Rest API but im trying to face it with fastlane and spaceship.
Expecting a solution based on Fastlane and Spaceship