# Internal server error when Create loyalty reward

**URL:** <https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794>\
**Category:** Questions\
**Tags:** loyalty-api, sandbox\
**Created:** [May 20, 2024, 9:21pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794 "2024-05-20T21:21:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [May 20, 2024, 9:21pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/1 "2024-05-20T21:21:07Z")

</div>

We are getting this error when calling createLoyaltyReward:

```auto
{
  "errors": [
    {
      "code": "INTERNAL_SERVER_ERROR",
      "detail": "An internal error has occurred, and the API was unable to service your request.",
      "category": "API_ERROR"
    }
  ]
}

```

Request:

```auto
POST /v2/loyalty/rewards
 {
  "reward": {
    "loyalty_account_id": "527a8855-c4de-44f1-ac40-6eb7469503e3",
    "reward_tier_id": "e1705c33-c7a4-46fa-8786-14b87013b0fe",
    "order_id": "WRWI6Xke8w09mz3jwB7yVxm9g18YY"
  },
  "idempotency_key": "6dcbf5b2-0cc8-4d83-ab8e-2ecde703521d"
}

```

It seems the reward is attaching to the order success, but we are getting the above 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:** [May 20, 2024, 9:26pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/2 "2024-05-20T21:26:43Z")

</div>

What’s your application ID? 🙂

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [May 20, 2024, 9:39pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/3 "2024-05-20T21:39:04Z")

</div>

sq0idp-7zihwF\_PCBpkuMdTCS2jrw

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [May 22, 2024, 9:05am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/4 "2024-05-22T09:05:02Z")

</div>

@Bryan-Square any update on this?

---

<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:** [May 22, 2024, 6:36pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/5 "2024-05-22T18:36:03Z")

</div>

I’m still waiting on an update from the team. Once I have more information I’ll let you know. 🙂

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [May 29, 2024, 4:22am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/6 "2024-05-29T04:22:00Z")

</div>

@Bryan-Square any update on this?

---

<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:** [May 29, 2024, 3:54pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/7 "2024-05-29T15:54:25Z")

</div>

It appears your using the same `idempotency_key` for different request. If requests uses the same `idempotency_key`, then it is expected that the responses will be the same. The `500` is a bug on our part that we’ll need to fix. In the mean time, you can change to using a different `idempotency_key` so that the request will successfully go through. 🙂

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [June 3, 2024, 10:47am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/8 "2024-06-03T10:47:35Z")

</div>

We also tried using a unique UUID as `idempotency_key`, but the response is still the same. Check the request below. Also, we have verified that we are calling the `createLoyaltyReward` API only once.

```auto
{
  "reward": {
    "loyalty_account_id": "527a8855-c4de-44f1-ac40-6eb7469503e3",
    "reward_tier_id": "2d360a0d-462f-4b8b-8180-3e09638f2a59",
    "order_id": "MgyRaNipCfrCmcDJQ4x96RFIgvZZY"
  },
  "idempotency_key": "30913029-b5d2-4291-905a-e66a929d814e"
}

```

Response:

```auto
{
  "errors": [
    {
      "code": "INTERNAL_SERVER_ERROR",
      "detail": "An internal error has occurred, and the API was unable to service your request.",
      "category": "API_ERROR"
    }
  ]
}

```

Any insights or suggestions on fixing this issue would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [June 5, 2024, 8:49am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/9 "2024-06-05T08:49:43Z")

</div>

@Bryan-Square any update on this?

---

<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:** [June 6, 2024, 4:34pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/10 "2024-06-06T16:34:00Z")

</div>

Was this by chance the same UUID that was used to create the order? 🙂

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [June 6, 2024, 4:46pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/11 "2024-06-06T16:46:51Z")

</div>

No, this is a newly generated unique UUID

---

<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:** [June 6, 2024, 4:56pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/12 "2024-06-06T16:56:01Z")

</div>

Okay, thanks for confirming. I’m checking with the team. 🙂

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [June 11, 2024, 4:03am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/13 "2024-06-11T04:03:31Z")

</div>

@Bryan-Square any update on this?

---

<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:** [June 11, 2024, 4:09pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/14 "2024-06-11T16:09:06Z")

</div>

The team is still looking into this. Is this the only account that your getting this error with and are you getting it every time when you create the reward? 🙂

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [June 12, 2024, 7:12am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/15 "2024-06-12T07:12:01Z")

</div>

yeah we are getting this error for all the createLoyaltyReward calls

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [June 17, 2024, 4:28am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/16 "2024-06-17T04:28:35Z")

</div>

@Bryan-Square any update on this?

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [June 24, 2024, 5:40am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/17 "2024-06-24T05:40:14Z")

</div>

@Bryan-Square, Any update from the team on this?

We are stuck with our integration due to this issue. Appreciate if you can let us know an update on this.

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [July 1, 2024, 9:52am UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/18 "2024-07-01T09:52:15Z")

</div>

@Bryan-Square any update on this?

---

<div class="post-metadata">

**Author:** ![bhanuka](https://avatars.discourse-cdn.com/v4/letter/b/51bf81/32.png) [@bhanuka](https://developer.squareup.com/forums/u/bhanuka)\
**Post date:** [July 10, 2024, 2:09pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/19 "2024-07-10T14:09:34Z")

</div>

@Bryan-Square any update on this?

---

<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:** [July 10, 2024, 4:01pm UTC](https://developer.squareup.com/forums/t/internal-server-error-when-create-loyalty-reward/16794/20 "2024-07-10T16:01:04Z")

</div>

The team has been making incremental updates and we don’t see the error in your logs anymore with the app ID `sq0idp-7zihwF_PCBpkuMdTCS2jrw`. Are you still getting the error? 🙂
