This is the code I'm using (utilising the app-store-server-library python library):
import time
import uuid
import requests
from typing import List, Optional
from appstoreserverlibrary.api_client import AppStoreServerAPIClient, APIException
from appstoreserverlibrary.models.Environment import Environment
from appstoreserverlibrary.models.ExtendReasonCode import ExtendReasonCode
from appstoreserverlibrary.models.MassExtendRenewalDateRequest import MassExtendRenewalDateRequest
from appstoreserverlibrary.models.MassExtendRenewalDateResponse import MassExtendRenewalDateResponse
def renew(key_path: str, key_id: str, bundle_id: str, issuer_id: str, request_identifier: str, product_id: str):
private_key: bytes = _load_key(key_path)
environment = Environment.PRODUCTION
client = AppStoreServerAPIClient(private_key, key_id, issuer_id, bundle_id, environment)
try:
renewal_request = MassExtendRenewalDateRequest(extendByDays=90,
extendReasonCode=ExtendReasonCode.UNDECLARED,
requestIdentifier=request_identifier,
productId=product_id,
storefrontCountryCodes=["GBR", "USA"])
response: MassExtendRenewalDateResponse = client.extend_renewal_date_for_all_active_subscribers(
mass_extend_renewal_date_request=renewal_request)
print(response)
except APIException as e:
print(e)