def create_offer_on_existing_asin(sku, asin, price, quantity, fulfillment_channel): # API endpoint and URL endpoint = "https://sellingpartnerapi-eu.amazon.com" request_url = f"{endpoint}/listings/2021-08-01/items/{seller_id}/{sku}" # Headers headers = { "x-amz-access-token": access_token, "Content-Type": "application/json" } # Query parameters (marketplace ID in query string) params = { "marketplaceIds": marketplace_id, "includedData": "issues" # Optional, can include other sets } # Payload for creating/updating an offer on an existing ASIN payload = { "productType": "PRODUCT", "requirements": "LISTING_OFFER_ONLY", "attributes": { "merchant_suggested_asin": [ { "value": asin, "marketplace_id": marketplace_id } ], "condition_type": [ { "value": "new_new", "marketplace_id": marketplace_id } ], "fulfillment_availability": [ { "fulfillment_channel_code": fulfillment_channel, # Use the correct fulfillment channel "quantity": quantity } ], "purchasable_offer": [ { "currency": "GBP", "marketplace_id": marketplace_id, "our_price": [ { "schedule": [ { "value_with_tax": price } ] } ] } ] } } # Send the PUT request to create/update the offer response = requests.put(request_url, headers=headers, params=params, data=json.dumps(payload)) return response