# How to test gift card scenarios in sandbox

**URL:** <https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564>\
**Category:** Questions\
**Tags:** web-payments-sdk\
**Created:** [November 13, 2022, 12:48am UTC](https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564 "2022-11-13T00:48:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![humanclock](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@humanclock](https://developer.squareup.com/forums/u/humanclock)\
**Post date:** [November 13, 2022, 12:48am UTC](https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564/1 "2022-11-13T00:48:00Z")

</div>

From reading the forum on here, Square is a bit limited in what it can do with test gift cards in the sandbox.

I can create test gift cards via the API and charge against them in the sandbox just fine.

However, it looks like when using the sandbox WebPaymentsSDK, I can only use the test gift card number “7783 3200 0000 0000”.

I need to be able to test the scenarios as to where there are insufficient funds and only a partial payment. Is the following the only workaround possible?

1. Enter “7783 3200 0000 0000” into the Gift Card Input box on the webpage
2. Have Javascript send the token to the backend
3. Have the backend ignore the token, but swap in a (previously created) hardcoded gift card ID that was created in the sandbox and load it
4. Continue on based on the status of the 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 14, 2022, 5:54pm UTC](https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564/2 "2022-11-14T17:54:47Z")

</div>

With gift cards and partial payments you’ll use the Payments API [autocomplete](https://developer.squareup.com/reference/square/payments-api/create-payment#request__property-autocomplete) and set that to `false`. Also you’ll set [accept\_partial\_authorization](https://developer.squareup.com/reference/square/payments-api/create-payment#request__property-accept_partial_authorization) to `true`. This will allow you to accept whatever remaining balance is on the card and allow you to create another payment for the remaining amount. Here’s the link to the walkthrough of [Partial Payments with Gift Cards](https://developer.squareup.com/docs/web-payments/gift-card-walkthrough). 🙂

---

<div class="post-metadata">

**Author:** ![humanclock](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@humanclock](https://developer.squareup.com/forums/u/humanclock)\
**Post date:** [November 16, 2022, 8:59pm UTC](https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564/3 "2022-11-16T20:59:46Z")

</div>

Thanks. I have it working, but I want to be able to have my client be able to just enter in test gift cards that have insufficent/full/no balance so they can see how the UI behaves based upon the status of the gift card (eg, if a customer pays with a gift card, I need to first check the balance and then display the Square Credit Card input box also, or not show it at all if the balance is sufficient).

As a workaround, I have a dropdown on the page that has a list of test gift cards in it plus their balance, on the backend instead of using the GiftCardToken, I’m just swapping in the gift card ID that my test dropdown is sending. It’s a hack but at least the client can test things.

It would just be more helpful if you could use actual test gift card GANs in the WebPaymentsSDK box for giftcards.

---

<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 16, 2022, 9:46pm UTC](https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564/4 "2022-11-16T21:46:10Z")

</div>

You can avoid checking the balance all together since you have `accept_partial_authorization` set to `true`. The amount authorized for the gift card payment will either cover the entire sale or it will tell you how much if any was authorized. The difference is the amount still owed to cover the order. 🙂

---

<div class="post-metadata">

**Author:** ![humanclock](https://avatars.discourse-cdn.com/v4/letter/h/c5a1d2/32.png) [@humanclock](https://developer.squareup.com/forums/u/humanclock)\
**Post date:** [November 16, 2022, 10:18pm UTC](https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564/5 "2022-11-16T22:18:49Z")

</div>

Yeah, that is what I was more or less saying in a badly worded way, heh. Just hit the gift card first and if it doesn’t cover it at all, show the remaining balance and ask for a credit card.

Oh, from my understanding, I only should put a 1 - 2 minute authorization on the Gift Card and then have it cancel the authorization? Eg, like if the customer makes a mistake and has to redo the order again (or one of the 852 other APIs I have to deal without outside of Square fails), I want them to be able to reuse the gift card again.

---

<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 16, 2022, 10:23pm UTC](https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564/6 "2022-11-16T22:23:42Z")

</div>

If they abandon the payment page altogether I’d say at that point it’s a good sign to call `CancelPayment` for the gift card. Unless they went back to shopping on the site. 🙂

---

<div class="post-metadata">

**Author:** ![DanielWilson](https://avatars.discourse-cdn.com/v4/letter/d/e9bcb4/32.png) [@DanielWilson](https://developer.squareup.com/forums/u/DanielWilson)\
**Post date:** [October 12, 2026, 3:36pm UTC](https://developer.squareup.com/forums/t/how-to-test-gift-card-scenarios-in-sandbox/7564/7 "2026-10-12T15:36:12Z")

</div>

Square’s sandbox gift card testing can be tricky, especially for partial payments and insufficient balances. For basic card number format checks, this[ferramenta de teste](https://gerador-br.com/gerador-de-cartao-de-credito/) may be useful, but gift card scenarios still need to be tested with Square’s own sandbox data.
