Location ID Changes

I am trying to create a subscription via my website…
customer is created successfully, but subscption is haviing an issue.

See error below

Initial locationId: 3HDARSZ1GM585
Creating subscription with locationId: 3HDARSZ1GM585,
planId: FJ4FQMHYZQHURCR555MPQXIT,
customerId: Y6SNB20FJE0Q2GY4WTZFQTQB9C

Failed to create subscription: INVALID_REQUEST_ERROR - LOCATION_MISMATCH: The provided location ID 66d9003762cb5 cannot be accessed by the authorized merchant.

Why is the location id in the error different to the one i sent in?

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Locations API Overview
Subscription Plan Checkout
Square Developer

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

The error message indicates that the location ID provided in the request doesn’t match the location ID associated with the authorized merchant. This could happen if the location ID is incorrect or if the merchant doesn’t have access to the specified location.

The location ID in the error message seems to be different from the one you’re sending in the request. This could be due to some internal processing or routing issue.

Ensure that the location ID you’re using is correct and that the merchant has access to it. You can retrieve the list of locations for a merchant using the Locations API to verify this. If the issue persists, it might be a good idea to double-check your request and make sure the location ID is being sent correctly in the request.

This answer was reviewed by @Bryan-Square.

i did the check for all location id associated with my merchant and thats the one i am using. Still does not work.

Everytime i refresh the code the “provided location” changes. Its seems it is just being generated randomly

I took a look at your API Logs and it looks like your passing in the location_id as the customer_id.

 {
  "location_id": "66d94faf718db",
  "customer_id": "3HDARSZ1GM585",
  "start_date": "2024-09-05"
}

Also the customer_id doesn’t look like an ID that’s created with our Customers API. You’ll need to use customer_ids that are created with our Customers API. :slightly_smiling_face: