# INVALID\_CARD\_DATA when create authorized payment

**URL:** <https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767>\
**Category:** Questions\
**Tags:** payments-api, web-payments-sdk\
**Created:** [September 22, 2023, 7:16am UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767 "2023-09-22T07:16:53Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alfred](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alfred](https://developer.squareup.com/forums/u/Alfred)\
**Post date:** [September 22, 2023, 7:16am UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/1 "2023-09-22T07:16:53Z")

</div>

Dear Team,

in production env, we got below error while calling API to create an authorized payment,

> Error [category=INVALID\_REQUEST\_ERROR, code=INVALID\_CARD\_DATA, detail=Invalid card data., field=source\_id]

a few hour later, when we tried to repeat the API call with the same payment token for troubleshooting, the error became

```auto
{
  "errors": [
    {
      "code": "NOT_FOUND",
      "detail": "Card nonce not found",
      "category": "INVALID_REQUEST_ERROR"
    }
  ]
}

```

may i know what would be the case of the error INVALID\_CARD\_DATA and the later NOT\_FOUND?

Thanks.

---

<div class="post-metadata">

**Author:** ![Alfred](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alfred](https://developer.squareup.com/forums/u/Alfred)\
**Post date:** [September 22, 2023, 7:18am UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/2 "2023-09-22T07:18:44Z")

</div>

btw, i have tried inputting wrong card number / CVV / expire date through square web sdk, it looks all these cases will fail to generate payment token by square web sdk

---

<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:** [September 22, 2023, 3:46pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/3 "2023-09-22T15:46:08Z")

</div>

With Square the token that’s returned from the Web Payments SDK is a one time use token which is why you got the error when trying it for a second time. 🙂

---

<div class="post-metadata">

**Author:** ![Alfred](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alfred](https://developer.squareup.com/forums/u/Alfred)\
**Post date:** [September 22, 2023, 3:58pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/4 "2023-09-22T15:58:58Z")

</div>

may i know what would be the cause of INVALID\_CARD\_DATA for the first failure?

---

<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:** [September 22, 2023, 4:29pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/5 "2023-09-22T16:29:32Z")

</div>

Banks don’t always share with us the reason behind the decline. Whenever you get an error like this you’ll want to have the customer contact the bank. 🙂

---

<div class="post-metadata">

**Author:** ![Alfred](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alfred](https://developer.squareup.com/forums/u/Alfred)\
**Post date:** [September 22, 2023, 5:25pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/6 "2023-09-22T17:25:34Z")

</div>

I thought it’s GENERIC\_DECLINE that the customer needs to contact with bank … 🤔

as both GENERIC\_DECLINE and INVALID\_CARD\_DATA are caused in bank, may i know what is the difference between the two errors?  
such as, because the error is INVALID\_CARD\_DATA but not GENERIC\_DECLINE, can we know anything more than what GENERIC\_DECLINE means?

---

<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:** [September 22, 2023, 7:34pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/7 "2023-09-22T19:34:28Z")

</div>

Sorry, your right. The GENERIC\_DECLINE is returned from the bank for payments. If you get INVALID\_CARD\_DATA that means that the card information that was given to use was incorrect when trying to charge the card. If this is when your trying to save the card on file then this error is returned from the bank. When a customer gets these errors they should retry the payment and make sure they’re putting in all the information correctly. If they get this again then they should contact their bank. 🙂

---

<div class="post-metadata">

**Author:** ![Alfred](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alfred](https://developer.squareup.com/forums/u/Alfred)\
**Post date:** [September 23, 2023, 8:58am UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/8 "2023-09-23T08:58:24Z")

</div>

thanks for the details, we contacted with the customer, the error occurred when trying to save the card on file.  
however we are also told that the same card can be saved in apple pay successfully, but not card on file in square, may i know what would be the cause of this difference?

---

<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:** [September 25, 2023, 4:38pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/9 "2023-09-25T16:38:07Z")

</div>

At this time we currently don’t support storing Apple Pay cards on file. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. 🙂

---

<div class="post-metadata">

**Author:** ![Alfred](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alfred](https://developer.squareup.com/forums/u/Alfred)\
**Post date:** [September 25, 2023, 4:52pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/10 "2023-09-25T16:52:57Z")

</div>

no… i didn’t mean storing apple pay cards on file in Square.

for example, the customer can save his card in Apple pay, but he can’t save this same card on file in square,  
we would like to know what’s the cause of this difference.

---

<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:** [September 25, 2023, 5:44pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/11 "2023-09-25T17:44:31Z")

</div>

Sorry if that wasn’t clear. The Apple Pay card I was referring to is the customers card stored in the digital wallet. Storing this on file isn’t currently available with our APIs. 🙂

---

<div class="post-metadata">

**Author:** ![Alfred](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@Alfred](https://developer.squareup.com/forums/u/Alfred)\
**Post date:** [September 25, 2023, 6:14pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/12 "2023-09-25T18:14:09Z")

</div>

sorry i think i didn’t make it clear 😅, let me put it in this way:

- customer has a card, for example, the card number is VI 1234,
- customer can add this VI 1234 to his apple pay account on his iPhone successfully, **this apple pay account is not related to Square** , and he can buy things from any online shop, etc. with his apple pay account, although the money comes from his card VI 1234 originally. in this case, the customer’s operation is not related to square, it’s success.
- customer tried to add his card VI 1234 on file in square, but failed; **what he tried, is not to save his digital wallets (such like apple pay or google pay) on file, but to directly save his card VI 1234 on file**; which means, in this case, the customer’s operation is not related to apple pay, it’s failed.

---

<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:** [September 25, 2023, 7:18pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/13 "2023-09-25T19:18:52Z")

</div>

Was the `source_id` that was passed to `CreateCard` generated through the Web Payments SDK or was it generated through Apple Pays returned response? If it was generated through the Web Payments SDK and failed we recommend having the customer retry and make sure the information they provided was correct. If it continues to fail then we recommend that the customer contacts the bank for further assistance. 🙂

---

<div class="post-metadata">

**Author:** ![swapnil.chavan18](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@swapnil.chavan18](https://developer.squareup.com/forums/u/swapnil.chavan18)\
**Post date:** [July 6, 2024, 5:54pm UTC](https://developer.squareup.com/forums/t/invalid-card-data-when-create-authorized-payment/10767/14 "2024-07-06T17:54:02Z")

</div>

@Bryan-Square We are having the same issue.
