Square payment picks Main location instead of the Location sent to the API for Payments

I am trying to purchase Square Gift cards and load amount to it during purchase. I have multiple locations configured and to call the Square Payment APIs I need to pass a location id. When I pass Location A’s location id to the Payment and Order APIs, I get the below error message and the Location B’s location id is returned in the response, which is configured as Main location in Square account. I do not send Location B’s location id in the API. Should the main location be used for all orders and payments? If so, would it be a problem if we try to redeem the gift card in any other location?
This is the same behavior for both Physical and Digital Gift cards.

“code”: “BAD_REQUEST”,
“detail”: “The payment is for a different location than the order.”,

:wave: Would you mind providing the request body for the order and the payment?

“recipients”: [
“email”: “”,
“message”: “Hey! find the gift card”,
“first_name”: “”,
“last_name”: “”,
“phone”: “”,
“delivery_date”: 1637087725000,
“cost”: 1,
“type”: “PHYSICAL”,
“physical_card_id”: “”
“agreements”: {
“sms”: false,
“news_letters”: false
“purchaser”: {
“first_name”: “”,
“last_name”: “K”,
“email”: “”,
“phone”: “”
“payment_source_id”: “cnon:CBASEHi2n5087DP1_40VHiI”,
“total_cost”: 1

What endpoint are you calling with this request?

Hello Bryan,

I am using Create Gift Card /v2/gift-cards

-H ‘Square-Version: 2021-11-17’
-H ‘Authorization: Bearer ACCESS_TOKEN’ \


CreateGiftCard doesn’t take a payment_source_id nor the customer information. That endpoint takes:

    "gift_card": {
      "type": "PHYSICAL",
      "gan": "1234567890"
    "idempotency_key": "312f0bcb-c42a-4ca5-b62f-3488815643d3",
    "location_id": "{{location_id}}"

Have you checked out our API Explorer to help build requests?

Hello Bryan, Creating an order takes this parameter. That is one of the steps in purchasing a gift card

Creating an order doesn’t take a payment_source_id. Where in our documentation did you see that the order takes the parameter?

Sorry, I meant creating a payment to fulfill the order.

Okay, but your request still doesn’t look like a valid Square payment request. Were you able to edit your request to make a successful payment?

I was able to get the payment processed by having the same location in the config. But my question is if I will be able to redeem in a different location

Yes, you can redeem in different locations if the location is included in the Loyalty program. :slightly_smiling_face: