Skip to content

Merchant API: CarrierService is never accepted #2675

Description

@jonaaix

Environment details

  • OS: macOS Sequoia
  • PHP version: 8.3
  • Package name and version: "google/apiclient": "^2.15",

Objective

  1. Target is to sync shipping rates together with "warehouseBasedDeliveryTimes" to the Merchant Center.
$shoppingContentService = new ShoppingContent($client);
$shoppingContentService->shippingsettings->update(
    merchantId: $merchantId,
    accountId: $merchantId,
    postBody: $payload
 );

Example Payload

{
    "accountId": null,
    "services": [
        {
            "active": true,
            "currency": "EUR",
            "deliveryCountry": "DE",
            "eligibility": null,
            "name": "Express Shipping DE",
            "shipmentType": null,
            "rateGroups": [
                {
                    "applicableShippingLabels": null,
                    "name": null,
                    "mainTable": {
                        "name": null,
                        "rowHeaders": {
                            "numberOfItems": null,
                            "postalCodeGroupNames": null,
                            "weights": [
                                { "unit": "kg", "value": "1" },
                                { "unit": "kg", "value": "infinity" }
                            ]
                        },
                        "rows": [
                            {
                                "cells": [
                                    {
                                        "flatRate": {
                                            "currency": "EUR",
                                            "value": "12.4"
                                        }
                                    }
                                ]
                            },
                            {
                                "cells": [
                                    {
                                        "flatRate": {
                                            "currency": "EUR",
                                            "value": "12.4"
                                        }
                                    }
                                ]
                            }
                        ]
                    }
                }
            ],
            "deliveryTime": {
                "maxHandlingTimeInDays": null,
                "maxTransitTimeInDays": null,
                "minHandlingTimeInDays": null,
                "minTransitTimeInDays": null,
                "warehouseBasedDeliveryTimes": [
                    {
                        "carrier": "DHL",
                        "carrierService": "ExpressEasy",
                        "originAdministrativeArea": "Berlin",
                        "originCity": "Berlin",
                        "originCountry": "DE",
                        "originPostalCode": "12345",
                        "originStreetAddress": "Street 1",
                        "warehouseName": "Warehouse 1"
                    }
                ]
            }
        }
    ]
}

Issue

No matter what you insert as deliveryTime.warehouseBasedDeliveryTimes.carrierService, it will always be rejected. Setting the value via Merchant Center UI works.

❌ An error occurred:
   Message: {
  "error": {
    "code": 400,
    "message": "[services[0].deliveryTime.warehouseBasedDeliveryTimes[0].carrierService] Unknown carrier service: ExpressEasy for carrier: DHL",
    "errors": [
      {
        "message": "[services[0].deliveryTime.warehouseBasedDeliveryTimes[0].carrierService] Unknown carrier service: ExpressEasy for carrier: DHL",
        "domain": "global",
        "reason": "invalid"
      }
    ]
  }
}

   File: /app/vendor/google/apiclient/src/Http/REST.php on line 134

How to find valid options?

$shoppingContentService = new ShoppingContent($client);
$response = $shoppingContentService->shippingsettings->getsupportedcarriers($merchantId);
$carriers = $response->getCarriers();

Output:

...

{
    "country": "DE",
    "eddServices": [
        "Paket Domestic",
        "P\u00e4ckchen Domestic",
        "ExpressEasy",
        "Express 9am",
        "Express Domestic",
        "Express Envelope",
        "Express 12pm"
    ],
    "name": "DHL",
    "services": [
        "Paket",
        "P\u00e4ckchen"
    ]
}

...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions