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

**URL:** <https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328>\
**Category:** Questions\
**Tags:** orders-api, payments-api\
**Created:** [November 24, 2021, 5:56pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328 "2021-11-24T17:56:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kandha](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Kandha](https://developer.squareup.com/forums/u/Kandha)\
**Post date:** [November 24, 2021, 5:56pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/1 "2021-11-24T17:56:25Z")

</div>

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.”,  
“category”: “INVALID\_REQUEST\_ERROR”

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 24, 2021, 6:00pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/2 "2021-11-24T18:00:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kandha](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Kandha](https://developer.squareup.com/forums/u/Kandha)\
**Post date:** [November 24, 2021, 6:03pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/3 "2021-11-24T18:03:33Z")

</div>

Request  
{  
“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  
}

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 24, 2021, 6:16pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/4 "2021-11-24T18:16:18Z")

</div>

What endpoint are you calling with this request?

---

<div class="post-metadata">

**Author:** ![Kandha](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Kandha](https://developer.squareup.com/forums/u/Kandha)\
**Post date:** [November 24, 2021, 6:40pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/5 "2021-11-24T18:40:19Z")

</div>

Hello Bryan,

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

[https://connect.squareup.com/v2/gift-cards](https://connect.squareup.com/v2/gift-cards)   
-X POST   
-H ‘Square-Version: 2021-11-17’   
-H ‘Authorization: Bearer ACCESS\_TOKEN’ \

Thanks,  
Kandha

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 24, 2021, 6:57pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/6 "2021-11-24T18:57:11Z")

</div>

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

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

```

Have you checked out our [API Explorer](https://developer.squareup.com/explorer/square) to help build requests?

---

<div class="post-metadata">

**Author:** ![Kandha](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Kandha](https://developer.squareup.com/forums/u/Kandha)\
**Post date:** [November 25, 2021, 6:13am UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/7 "2021-11-25T06:13:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 25, 2021, 4:25pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/8 "2021-11-25T16:25:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kandha](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Kandha](https://developer.squareup.com/forums/u/Kandha)\
**Post date:** [November 25, 2021, 5:03pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/9 "2021-11-25T17:03:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 29, 2021, 4:38pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/10 "2021-11-29T16:38:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Kandha](https://avatars.discourse-cdn.com/v4/letter/k/46a35a/32.png) [@Kandha](https://developer.squareup.com/forums/u/Kandha)\
**Post date:** [November 29, 2021, 4:41pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/11 "2021-11-29T16:41:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [November 29, 2021, 7:21pm UTC](https://developer.squareup.com/forums/t/square-payment-picks-main-location-instead-of-the-location-sent-to-the-api-for-payments/4328/12 "2021-11-29T19:21:10Z")

</div>

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