How to save the card information obtained by Square Payment Form

How can I save the card information obtained by Square Payment Form?
What variables should I send to the server side?

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

Additional Documentation

Collecting Information
Cards API
Cards API

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.

For storing a card on file you’ll use the Cards API to save the customers card on file from the token that’s collected from the Web Payments SDK. :slight_smile:

In the following code

result.token

variable?

Here’s a general explanation of how result.token is used in the context of the Square Web Payments SDK:

Usage of result.token

  1. Payment Method Request:
  • When you use the Web Payments SDK to collect payment information from the customer, you typically call a method to request a payment token. This involves displaying the payment form and handling the customer’s input.
  1. Handling the Response:
  • Once the customer submits their payment information, the SDK processes this information and returns a result object. This object contains the token property, which is the payment token.
  1. Using the Token:
  • The result.token is then sent to your server, where you can use it to create a payment or store it for future transactions (if allowed by the customer’s consent and Square’s policies).
  • On the server side, you would use the Square Payments API to create a payment using this token. :slight_smile:

Understood. Just to confirm, if I implement the client side using the code below as a reference, does that mean it is compatible with 3DS?

Yes, it’s compatible with 3DS. Here is a link to our update Charge and Store quickstart example. :slight_smile:

The server-side python square API version is

square_version='2023-04-19',.

will it still support the 3DS?

Yes, it will support 3DS with version 2023-04-19. :slight_smile: