Use the Reader SDK card on file workflow to create a customer card for an existing Customer object.
Reader SDK

Save Cards on File

Java (Android)

Use the Reader SDK card-on-file workflow to create a customer card for an existing Customer object. The card-on-file workflow is a sequence of screens used by customers to specify that they want to save their card information for future purchases.

Important

Always ask customers for permission before saving their card information. For example, include a checkbox in your purchase flow that customers can select to specify that they want to save their card information for future purchases.

Linking cards on file without obtaining customer permission can result in your application being disabled without notice.

  • 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.

Did you know?

The card-on-file workflow begins with an asynchronous call to Square servers, which can be slow depending on network conditions.

You should display a spinner or loading indicator before starting the card-on-file workflow and clear it when you receive the result (success or failure) so users know that work is being performed in the background.

Use the CustomerCardManager class to create a new customer card manager to securely collect card information. Customer card information is stored on Square servers, not on the device running the Reader SDK, so you need to implement a callback to handle the response from Square.

Use the customer card manager to start the StoreCard activity and link the card to an existing customer ID.

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