# Can't save card via source\_id

**URL:** <https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733>\
**Category:** Questions\
**Tags:** customers-api, payments-api\
**Created:** [September 27, 2021, 10:23pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733 "2021-09-27T22:23:17Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [September 27, 2021, 10:23pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/1 "2021-09-27T22:23:17Z")

</div>

I’m trying to use the following flow (the data is all converted to JSON):  
1 - submit a payment (success)  
2 - create a customer using the payment’s source\_id (success)  
3 - save a card related to the customer using the source\_id and customer\_id (FAIL)

I Send a payment with a response of:

```auto
Payment response:Array
(
    [payment] => Array
        (
            [id] => 73BQjUJutcF8LdmqHX0Twbom6R8YY
            [created_at] => 2021-09-27T22:03:07.481Z
            [updated_at] => 2021-09-27T22:03:07.671Z
            [amount_money] => Array
                (
                    [amount] => 33048
                    [currency] => GBP
                )

            [status] => COMPLETED
            [delay_duration] => PT168H
            [source_type] => CARD
            [card_details] => Array
                (
                    [status] => CAPTURED
                    [card] => Array
                        (
                            [card_brand] => VISA
                            [last_4] => 1019
                            [exp_month] => 11
                            [exp_year] => 2022
                            [fingerprint] => sq-1-oqGDocPJcaleGojsHKQx2qvtBIcTKJn7hbgPy70oPwF8iTvjkQA7xpV8BTR6AWen0w
                            [card_type] => CREDIT
                            [prepaid_type] => NOT_PREPAID
                            [bin] => 431000
                        )

                    [entry_method] => KEYED
                    [cvv_status] => CVV_ACCEPTED
                    [avs_status] => AVS_ACCEPTED
                    [statement_description] => SQ *DEFAULT TEST ACCOUNT
                    [card_payment_timeline] => Array
                        (
                            [authorized_at] => 2021-09-27T22:03:07.593Z
                            [captured_at] => 2021-09-27T22:03:07.671Z
                        )

                )

            [location_id] => L1C7FNP4HA3FJ
            [order_id] => OeuTJe74ZaVfzfFvr8mF5fXI6OIZY
            [reference_id] => 6416
            [risk_evaluation] => Array
                (
                    [created_at] => 2021-09-27T22:03:07.593Z
                    [risk_level] => NORMAL
                )

            [buyer_email_address] => support@ez-ms.com
            [shipping_address] => Array
                (
                    [address_line_1] => The Queens Walk
                    [locality] => London
                    [administrative_district_level_1] => LDN
                    [postal_code] => se1
                    [country] => GB
                )

            [note] => Order: 6416
            [total_money] => Array
                (
                    [amount] => 33048
                    [currency] => GBP
                )

            [approved_money] => Array
                (
                    [amount] => 33048
                    [currency] => GBP
                )

            [receipt_number] => 73BQ
            [receipt_url] => https://squareupsandbox.com/receipt/preview/73BQjUJutcF8LdmqHX0Twbom6R8YY
            [delay_action] => CANCEL
            [delayed_until] => 2021-10-04T22:03:07.481Z
            [version_token] => j0Lzr70WIGcrIN9n4MKyKZzJLP6l7xixDgLkklTUdQ45o
        )

)

```

I then create a customer using a source\_id of 73BQjUJutcF8LdmqHX0Twbom6R8YY which returns an ‘id’ of JAHTXJJNR0WDN0RD9NC2VMH94M

I attempt to create a card for that customer using:

```auto
squarepay::send_request(https://connect.squareupsandbox.com/v2/cards): request:Array
(
    [type] => post
    [url] => https://connect.squareupsandbox.com/v2/cards
    [send_data] => Array
        (
            [source_id] => 73BQjUJutcF8LdmqHX0Twbom6R8YY
            [card] => Array
                (
                    [card_brand] => VISA
                    [last_4] => 1019
                    [exp_month] => 11
                    [exp_year] => 2022
                    [fingerprint] => sq-1-oqGDocPJcaleGojsHKQx2qvtBIcTKJn7hbgPy70oPwF8iTvjkQA7xpV8BTR6AWen0w
                    [card_type] => CREDIT
                    [prepaid_type] => NOT_PREPAID
                    [bin] => 431000
                    [customer_id] => JAHTXJJNR0WDN0RD9NC2VMH94M
                    [cardholder_name] => Tony 1
                )

            [idempotency_key] => sq_card_uk-dev346761523f9bb2eb2
        )

    [headers] => Array
        (
            [0] => Authorization: Bearer EAAAEGp_Q7nYSFoymliCdDqkJOR4Y8KPhUjP7kOOcKDsee_VEICOJHnzFNQYP8p2
            [1] => Accept: application/json
        )

)

```

But it FAILS with:

```auto
squarepay::send_request(https://connect.squareupsandbox.com/v2/cards): response:Array
(
    [errors] => Array
        (
            [0] => Array
                (
                    [category] => INVALID_REQUEST_ERROR
                    [code] => INVALID_CARD_DATA
                    [detail] => Invalid card data.
                    [field] => source_id
                )

        )

)

```

---

<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 27, 2021, 11:17pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/2 "2021-09-27T23:17:36Z")

</div>

👋 With Square the `source_id` is a one time use token. If you are going to first take a payment with the `source_id` and still want to save the card on file you’ll need to [Create a Card on File from a Payment ID](https://developer.squareup.com/docs/cards-api/walkthrough/card-from-payment-id) so your customer won’t have to enter their information in twice. 🙂

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [September 27, 2021, 11:46pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/3 "2021-09-27T23:46:16Z")

</div>

I’m using the payment\_id as the source\_id in both creating the customer and saving the card from the same payment.

Are you saying that I can’t both create a customer and save a card to that customer from that same payment? I’m not understanding what you’re trying to tell me.

---

<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 27, 2021, 11:51pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/4 "2021-09-27T23:51:15Z")

</div>

That should work. What test value are you using to create the initial payment?

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [September 28, 2021, 7:27pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/5 "2021-09-28T19:27:41Z")

</div>

I’m using a NONCE, then using the payment\_id.  
See the detail above.

---

<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 28, 2021, 9:28pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/6 "2021-09-28T21:28:56Z")

</div>

I was able to replicate this and escalated to the team. I’ll be sure to post any updates.

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [September 28, 2021, 9:44pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/7 "2021-09-28T21:44:54Z")

</div>

So what am I supposed to do? You have an SCA deadline approaching which requires me to convert to your new api’s. But there are now 2 bugs I’ve found which should be basic QA tests during development.

How long do you anticipate the wait to be? I can live with the bug in verifyBuyer() but I can’t live with not being able to create a customer AND save a card from the same payment.

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [September 30, 2021, 9:23pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/8 "2021-09-30T21:23:54Z")

</div>

Note that further testing reveals that the issue is not that there are multiple uses of the payment\_id as the source\_id, Trying to create a card using a payment\_id as the source\_id fails even through the customer exists (created in a previous transaction).

This is a much more serious problem essentially making saving a card without a verificationToken impossible.

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [October 4, 2021, 8:22pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/9 "2021-10-04T20:22:36Z")

</div>

Is there any update from “The Team” on when this will be fixed? The deadline for SCA is rapidly approaching and the ability to save a card from a payment\_id is critical in our application.

---

<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:** [October 4, 2021, 8:57pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/10 "2021-10-04T20:57:27Z")

</div>

At this time there isn’t any additional update from the team.

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [October 4, 2021, 9:47pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/11 "2021-10-04T21:47:41Z")

</div>

Possibly you could share the status/priority of the defect so one might be able to plan some work around this? My testing has come to a grinding halt.

---

<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:** [October 5, 2021, 3:40pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/12 "2021-10-05T15:40:14Z")

</div>

This is a high priority for the team and they are working on a fix. The SCA flow of first saving the card on file with the intent to `STORE` to get the `card_id` to then call `verifyBuyer()` again with the `card_id` and the intent to `CHARGE` is working as expected as a workaround.

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [October 5, 2021, 8:33pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/13 "2021-10-05T20:33:55Z")

</div>

Seriously? You expect a customer to sit around during a checkout process while they wait for 2 emails to be sent to separately verify the added card; once for purchase and once to save? In the front-end, I don’t even know whether the merchant wants to save cards. I don’t know that until the process gets to the backend.

That solution is not a workaround for any non-trivial environment. Merchant conversions will fall through the floor.

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [October 14, 2021, 9:28pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/14 "2021-10-14T21:28:18Z")

</div>

Any updates? We’re running out of time for SCA in the UK.

---

<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:** [October 14, 2021, 10:02pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/15 "2021-10-14T22:02:22Z")

</div>

At this time there isn’t an update. The team is currently working on this.

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [October 24, 2021, 11:44pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/17 "2021-10-24T23:44:28Z")

</div>

Is there any update on this issue? It should be a relatively simple fix to validate the payment\_id in the save card functionality…

---

<div class="post-metadata">

**Author:** ![tbirnseth](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@tbirnseth](https://developer.squareup.com/forums/u/tbirnseth)\
**Post date:** [November 4, 2021, 6:58pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/18 "2021-11-04T18:58:25Z")

</div>

Still waiting… Any update on the status?

---

<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 4, 2021, 9:16pm UTC](https://developer.squareup.com/forums/t/cant-save-card-via-source-id/3733/19 "2021-11-04T21:16:11Z")

</div>

👋 A fix has now been deployed. You can now call `verifyBuyer` with the `payment_id`. 🙂
