Save Cards on File
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.
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_WRITEpermission to save a card on file and
PAYMENTS_WRITEpermission 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
Customerobject using the Customers API. You can follow Use the Customers API to create your first
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.
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.