# Get the Card ID of the Card on File from invoice payment

**URL:** <https://developer.squareup.com/forums/t/get-the-card-id-of-the-card-on-file-from-invoice-payment/17511>\
**Category:** Questions\
**Tags:** invoices-api\
**Created:** [July 1, 2024, 4:31pm UTC](https://developer.squareup.com/forums/t/get-the-card-id-of-the-card-on-file-from-invoice-payment/17511 "2024-07-01T16:31:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr.Qinu](https://avatars.discourse-cdn.com/v4/letter/m/df705f/32.png) [@Mr.Qinu](https://developer.squareup.com/forums/u/Mr.Qinu)\
**Post date:** [July 1, 2024, 4:31pm UTC](https://developer.squareup.com/forums/t/get-the-card-id-of-the-card-on-file-from-invoice-payment/17511/1 "2024-07-01T16:31:50Z")

</div>

When an invoice is paid, is it possible to get the card ID used for that invoice payment? Specifically, when a recurring invoice is being paid, and a new card on file has been stored to the customer.

The docs mention this in some capacity in invoices.payment\_requests.card\_id:

**card\_id** string

The ID of the credit or debit card on file to charge for the payment request. To get the cards on file for a customer, call [ListCards](https://developer.squareup.com/reference/square/cards-api/list-cards) and include the `customer_id` of the invoice recipient.

Must I cycle through all cards on file thru Cards API? If so, how will I know which card is linked to this invoice?

The docs make it seem that the card ID is a parameter within payment\_requests, however the payload does not include the card\_id in practice.

It is important in our use case that we keep track of which card on file is being used for recurring invoices/subscription payments, so any help on this would be appreciated.

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [July 1, 2024, 4:32pm UTC](https://developer.squareup.com/forums/t/get-the-card-id-of-the-card-on-file-from-invoice-payment/17511/2 "2024-07-01T16:32:14Z")

</div>

👋 I’m Square Dev AI, here to help answer your question!  
Based on the information you’ve provided, the following documentation will help answer your question:

> **[Cards API](https://developer.squareup.com/docs/cards-api)**
>
> Use the Cards API to save a credit or debit card for a customer.

> **[Cards API](https://developer.squareup.com/docs/cards-api/overview)**
>
> Use the Cards API to save a credit or debit card for a customer.

> **Additional Documentation**
>
> [Create a Card on File from a Payment ID](https://developer.squareup.com/docs/cards-api/walkthrough/card-from-payment-id)  
> [Charge a Card on File](https://developer.squareup.com/docs/reader-sdk/cookbook/charge-cards-on-file)  
> [Integrate Customer Profiles with Other Services](https://developer.squareup.com/docs/customers-api/use-the-api/integrate-with-other-services)

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.  
Otherwise one of our Developer Advocates will provide additional assistance shortly.

---

<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 1, 2024, 5:47pm UTC](https://developer.squareup.com/forums/t/get-the-card-id-of-the-card-on-file-from-invoice-payment/17511/3 "2024-07-01T17:47:06Z")

</div>

With payments and recurring invoices the `card_id` is never exposed for security reasons. You can call [ListCards](https://developer.squareup.com/reference/square/cards-api/list-cards) and set the `customer_id` as a query parameter to get all the cards from a customer profile. With the card response you can match the `fingerprint` of the payment to the `fingerprint` of the card to know what card was used for the payment. 🙂
