Create a seamless purchase experience for returning customers and enable recurring payments.
Reader SDK

Charge Cards on File

Create a seamless purchase experience for returning customers and enable recurring payments.

  • You need an access token. If you are using OAuth, you need CUSTOMERS_WRITE permission to save a card on file and PAYMENTS_WRITE permission to process payments with the saved card. Cards on file are automatically updated on a monthly basis to confirm that they are still valid and can be charged.

  • You need to create a Customer object using the Customers API. You can follow Use the Customers API to create your first Customer object.

  • You need a customer card on file. You can follow Save a Card on File to save a card with the Reader SDK.

After you save a card on file, you can use the Payments API and call the CreatePayment endpoint to process the saved card. If you are using OAuth, you need PAYMENTS_WRITE permission.

To charge a saved card, use the Payments API and set the source_id and customer_id fields in the CreatePayment object:

  • Replace {CARD_ID} with an existing card ID.

  • Replace {CUSTOMER_ID} with an existing customer ID.

  • Replace {LOCATION_ID} with an existing location ID.

Create Payment
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
curl https://connect.squareup.com/v2/payments \
  -X POST \
  -H 'Square-Version: 2022-11-16' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "idempotency_key": "e9bab191-d493-4d26-b5fb-ee589ad0203f",
    "source_id": "{CARD_ID}",
    "customer_id": "{CUSTOMER_ID}",
    "location_id": "{LOCATION_ID}",
    "amount_money": {
      "amount": 100,
      "currency": "USD"
    }
  }'

If you need more assistance, contact Developer Support or ask for help in the Developer Forums.