Skip to content

[Bug]: create_checkout_session sends a destination's locality and region as locality/region, not address_locality/address_region #116

Open

Description

@vicentewolde

Where. integration_test_utils.py, in the create helper (lines 901-902 at commit 016ecbc):

locality=dest_data.get("locality", dest_data.get("city")),
region=dest_data.get("region", dest_data.get("state")),

What goes wrong. ShippingDestinationCreateRequest extends PostalAddressCreateRequest, whose fields are address_locality and address_region (as in schemas/shopping/types/postal_address.json of UCP 2026-04-08). Because the model has extra="allow", the keyword arguments locality= and region= are kept as extra fields, so the request carries

{"id": "dest_1", "street_address": "...", "postal_code": "...", "address_country": "...", "locality": "...", "region": "..."}

A business that reads the standard field names sees a destination with no locality and no region. If it requires them to ship (ours requires address_locality), the session stays incomplete and every test that completes a checkout through create_checkout_session fails, which hides the real results of most of the suite.

Suggested fix. Pass the standard names:

address_locality=dest_data.get("address_locality", dest_data.get("locality", dest_data.get("city"))),
address_region=dest_data.get("address_region", dest_data.get("region", dest_data.get("state"))),

How we found it. Running the suite (016ecbc, python-sdk v2026-04-08-6) against a business that validates its requests against the official 2026-04-08 schemas. We work around it locally by renaming the two fields before our server sees them.

Activity

  1. added a commit that references this issue on Oct 5, 2026
    4ca6f93
  2. FanouZeng-TT commented on Oct 5, 2026

    @FanouZeng-TT
    Contributor

    Thanks for the report. #97 fixes this at the source: get_test_destination() now normalizes the fixture destination so the standard UCP field names (address_locality/address_region) are honored, keeping locality/city and region/state as fallbacks. With #97 applied, the destination created by create_checkout_session carries your configured locality/region even when test_destination uses the schema's field names.

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