# Execute payment with previously saved card

**URL:** <https://developer.squareup.com/forums/t/execute-payment-with-previously-saved-card/20112>\
**Category:** Questions\
**Tags:** customers-api, payments-api, cards-api\
**Created:** [December 15, 2024, 8:28pm UTC](https://developer.squareup.com/forums/t/execute-payment-with-previously-saved-card/20112 "2024-12-15T20:28:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![axel21](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@axel21](https://developer.squareup.com/forums/u/axel21)\
**Post date:** [December 15, 2024, 8:28pm UTC](https://developer.squareup.com/forums/t/execute-payment-with-previously-saved-card/20112/1 "2024-12-15T20:28:40Z")

</div>

Hi  
I need to make a payment with the card that was attached to the customer.  
how could I do that?  
the goal is to have some clients with saved cards and to have possibility to charge their cards, but its not a recurrent event  
as I understand this action is possible in case of storing client’s cards but how to implement that?

---

<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:** [December 15, 2024, 8:29pm UTC](https://developer.squareup.com/forums/t/execute-payment-with-previously-saved-card/20112/2 "2024-12-15T20:29:02Z")

</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:

> **[Charge a Card on File](https://developer.squareup.com/docs/reader-sdk/cookbook/charge-cards-on-file)**
>
> Create a seamless purchase experience for returning customers and enable recurring payments.

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

> **Additional Documentation**
>
> [Cards API](https://developer.squareup.com/docs/cards-api/overview)  
> [Save a Card on File](https://developer.squareup.com/docs/reader-sdk/cookbook/save-cards-on-file)  
> [Create a Card on File and a Payment](https://developer.squareup.com/docs/cards-api/walkthrough-seller-card)

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:** ![axel21](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@axel21](https://developer.squareup.com/forums/u/axel21)\
**Post date:** [December 15, 2024, 8:38pm UTC](https://developer.squareup.com/forums/t/execute-payment-with-previously-saved-card/20112/3 "2024-12-15T20:38:57Z")

</div>

**Card on file** - A seller can store customer profiles in the seller’s Customer Directory and then add a card on file for the customer. Applications can later charge the card on file by setting the card ID as the `source_id` value in a `CreatePayment` request. In this case, the `customer_id` is also required in the request.  
could you describe this in more details

---

<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:** [December 16, 2024, 6:20pm UTC](https://developer.squareup.com/forums/t/execute-payment-with-previously-saved-card/20112/4 "2024-12-16T18:20:53Z")

</div>

To make a payment with a card attached to a customer, you would use the Payments API and the Cards API.

First, you would save a card on file for a customer using the Cards API’s CreateCard endpoint. This requires a payment token, which can be generated using the Web Payments SDK or In-App Payments SDK.

Once the card is saved on file, you can use the Payments API’s CreatePayment endpoint to process a payment with the saved card. In the CreatePayment request, you would set the source\_id to the card ID of the saved card and the customer\_id to the ID of the customer.

Remember to always ask customers for permission before saving their card information and charging their cards.

_This answer was reviewed by @Bryan-Square._
